$search
00001 """autogenerated by genmsg_py from TBoxObject.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 00006 class TBoxObject(roslib.message.Message): 00007 _md5sum = "fbdf9bcb056031485032d3fa4ff08d71" 00008 _type = "srs_knowledge/TBoxObject" 00009 _has_header = False #flag to mark the presence of a Header object 00010 _full_text = """int32 class_id 00011 string name 00012 string description 00013 string[] properties 00014 int32[] subjects 00015 """ 00016 __slots__ = ['class_id','name','description','properties','subjects'] 00017 _slot_types = ['int32','string','string','string[]','int32[]'] 00018 00019 def __init__(self, *args, **kwds): 00020 """ 00021 Constructor. Any message fields that are implicitly/explicitly 00022 set to None will be assigned a default value. The recommend 00023 use is keyword arguments as this is more robust to future message 00024 changes. You cannot mix in-order arguments and keyword arguments. 00025 00026 The available fields are: 00027 class_id,name,description,properties,subjects 00028 00029 @param args: complete set of field values, in .msg order 00030 @param kwds: use keyword arguments corresponding to message field names 00031 to set specific fields. 00032 """ 00033 if args or kwds: 00034 super(TBoxObject, self).__init__(*args, **kwds) 00035 #message fields cannot be None, assign default values for those that are 00036 if self.class_id is None: 00037 self.class_id = 0 00038 if self.name is None: 00039 self.name = '' 00040 if self.description is None: 00041 self.description = '' 00042 if self.properties is None: 00043 self.properties = [] 00044 if self.subjects is None: 00045 self.subjects = [] 00046 else: 00047 self.class_id = 0 00048 self.name = '' 00049 self.description = '' 00050 self.properties = [] 00051 self.subjects = [] 00052 00053 def _get_types(self): 00054 """ 00055 internal API method 00056 """ 00057 return self._slot_types 00058 00059 def serialize(self, buff): 00060 """ 00061 serialize message into buffer 00062 @param buff: buffer 00063 @type buff: StringIO 00064 """ 00065 try: 00066 buff.write(_struct_i.pack(self.class_id)) 00067 _x = self.name 00068 length = len(_x) 00069 buff.write(struct.pack('<I%ss'%length, length, _x)) 00070 _x = self.description 00071 length = len(_x) 00072 buff.write(struct.pack('<I%ss'%length, length, _x)) 00073 length = len(self.properties) 00074 buff.write(_struct_I.pack(length)) 00075 for val1 in self.properties: 00076 length = len(val1) 00077 buff.write(struct.pack('<I%ss'%length, length, val1)) 00078 length = len(self.subjects) 00079 buff.write(_struct_I.pack(length)) 00080 pattern = '<%si'%length 00081 buff.write(struct.pack(pattern, *self.subjects)) 00082 except struct.error as se: self._check_types(se) 00083 except TypeError as te: self._check_types(te) 00084 00085 def deserialize(self, str): 00086 """ 00087 unpack serialized message in str into this message instance 00088 @param str: byte array of serialized message 00089 @type str: str 00090 """ 00091 try: 00092 end = 0 00093 start = end 00094 end += 4 00095 (self.class_id,) = _struct_i.unpack(str[start:end]) 00096 start = end 00097 end += 4 00098 (length,) = _struct_I.unpack(str[start:end]) 00099 start = end 00100 end += length 00101 self.name = str[start:end] 00102 start = end 00103 end += 4 00104 (length,) = _struct_I.unpack(str[start:end]) 00105 start = end 00106 end += length 00107 self.description = str[start:end] 00108 start = end 00109 end += 4 00110 (length,) = _struct_I.unpack(str[start:end]) 00111 self.properties = [] 00112 for i in range(0, length): 00113 start = end 00114 end += 4 00115 (length,) = _struct_I.unpack(str[start:end]) 00116 start = end 00117 end += length 00118 val1 = str[start:end] 00119 self.properties.append(val1) 00120 start = end 00121 end += 4 00122 (length,) = _struct_I.unpack(str[start:end]) 00123 pattern = '<%si'%length 00124 start = end 00125 end += struct.calcsize(pattern) 00126 self.subjects = struct.unpack(pattern, str[start:end]) 00127 return self 00128 except struct.error as e: 00129 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00130 00131 00132 def serialize_numpy(self, buff, numpy): 00133 """ 00134 serialize message with numpy array types into buffer 00135 @param buff: buffer 00136 @type buff: StringIO 00137 @param numpy: numpy python module 00138 @type numpy module 00139 """ 00140 try: 00141 buff.write(_struct_i.pack(self.class_id)) 00142 _x = self.name 00143 length = len(_x) 00144 buff.write(struct.pack('<I%ss'%length, length, _x)) 00145 _x = self.description 00146 length = len(_x) 00147 buff.write(struct.pack('<I%ss'%length, length, _x)) 00148 length = len(self.properties) 00149 buff.write(_struct_I.pack(length)) 00150 for val1 in self.properties: 00151 length = len(val1) 00152 buff.write(struct.pack('<I%ss'%length, length, val1)) 00153 length = len(self.subjects) 00154 buff.write(_struct_I.pack(length)) 00155 pattern = '<%si'%length 00156 buff.write(self.subjects.tostring()) 00157 except struct.error as se: self._check_types(se) 00158 except TypeError as te: self._check_types(te) 00159 00160 def deserialize_numpy(self, str, numpy): 00161 """ 00162 unpack serialized message in str into this message instance using numpy for array types 00163 @param str: byte array of serialized message 00164 @type str: str 00165 @param numpy: numpy python module 00166 @type numpy: module 00167 """ 00168 try: 00169 end = 0 00170 start = end 00171 end += 4 00172 (self.class_id,) = _struct_i.unpack(str[start:end]) 00173 start = end 00174 end += 4 00175 (length,) = _struct_I.unpack(str[start:end]) 00176 start = end 00177 end += length 00178 self.name = str[start:end] 00179 start = end 00180 end += 4 00181 (length,) = _struct_I.unpack(str[start:end]) 00182 start = end 00183 end += length 00184 self.description = str[start:end] 00185 start = end 00186 end += 4 00187 (length,) = _struct_I.unpack(str[start:end]) 00188 self.properties = [] 00189 for i in range(0, length): 00190 start = end 00191 end += 4 00192 (length,) = _struct_I.unpack(str[start:end]) 00193 start = end 00194 end += length 00195 val1 = str[start:end] 00196 self.properties.append(val1) 00197 start = end 00198 end += 4 00199 (length,) = _struct_I.unpack(str[start:end]) 00200 pattern = '<%si'%length 00201 start = end 00202 end += struct.calcsize(pattern) 00203 self.subjects = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length) 00204 return self 00205 except struct.error as e: 00206 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00207 00208 _struct_I = roslib.message.struct_I 00209 _struct_i = struct.Struct("<i")