CassandraTopic_manual.py
Go to the documentation of this file.
00001 from CassandraTopic_ import *
00002 
00003 class CassandraTopic_manual(CassandraTopic_ros):
00004     def __init__(self, MsgClass):        
00005         CassandraTopic_ros.__init__(MsgClass)
00006     
00007     def getColumnValidationClasses(self):
00008         
00009         classes = {'.transforms.header' : 'ros',
00010                    '.transforms.child_frame_id' : 'ros',
00011                    '.transforms.transform' : 'string' }
00012         
00013         spec = super(CassandraTopic_manual, self).getColumnValidationClasses()
00014         
00015         # delete the plain ros stuff, because it is already inserted
00016         for cls in classes.keys():
00017             if classes[cls] == 'ros':
00018                 classes.pop(cls)
00019         
00020         # remove the non ros stuff from the validation classes ...
00021         for key in spec.keys():
00022             for cls in classes.keys():
00023                 if key.find(cls) == 0:
00024                     spec.pop(cls)
00025         
00026         # insert the missing validation classes
00027         for cls in classes.keys():
00028             spec[cls] = classes[cls]
00029             
00030         self.column_validation_classes = spec
00031                     
00032         return spec
00033          
00034     def encode(self, msg):
00035         return self._ros_to_cassandra(msg)
00036     
00037     def _value_to_cassandra(self ,data, parent):
00038         
00039         if self.column_validation_classes.has_key(parent):
00040             if self.column_validation_classes[parent] == 'string':
00041                 return { parent : rosjson.ros_message_to_json(data) }
00042         
00043         return super(CassandraTopic_manual, self)._value_to_cassandra(self ,data, parent)
00044 
00045     
00046 #   def decode(self, data):
00047 #        data = json.loads(data['manual'])


cassandra_ros
Author(s):
autogenerated on Thu Jun 6 2019 21:09:27