00001 """autogenerated by genmsg_py from TestArrays.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import test_ros.msg
00006 import roslib.rostime
00007
00008 class TestArrays(roslib.message.Message):
00009 _md5sum = "4cc9b5e2cebe791aa3e994f5bc159eb6"
00010 _type = "test_ros/TestArrays"
00011 _has_header = False
00012 _full_text = """# caller_id of most recent node to send this message
00013 string caller_id
00014 # caller_id of the original node to send this message
00015 string orig_caller_id
00016
00017 int32[] int32_array
00018 float32[] float32_array
00019 time[] time_array
00020 TestString[] test_string_array
00021 # TODO: array of arrays
00022
00023 ================================================================================
00024 MSG: test_ros/TestString
00025 # Integration test message
00026 # caller_id of most recent node to send this message
00027 string caller_id
00028 # caller_id of the original node to send this message
00029 string orig_caller_id
00030 string data
00031
00032 """
00033 __slots__ = ['caller_id','orig_caller_id','int32_array','float32_array','time_array','test_string_array']
00034 _slot_types = ['string','string','int32[]','float32[]','time[]','test_ros/TestString[]']
00035
00036 def __init__(self, *args, **kwds):
00037 """
00038 Constructor. Any message fields that are implicitly/explicitly
00039 set to None will be assigned a default value. The recommend
00040 use is keyword arguments as this is more robust to future message
00041 changes. You cannot mix in-order arguments and keyword arguments.
00042
00043 The available fields are:
00044 caller_id,orig_caller_id,int32_array,float32_array,time_array,test_string_array
00045
00046 @param args: complete set of field values, in .msg order
00047 @param kwds: use keyword arguments corresponding to message field names
00048 to set specific fields.
00049 """
00050 if args or kwds:
00051 super(TestArrays, self).__init__(*args, **kwds)
00052
00053 if self.caller_id is None:
00054 self.caller_id = ''
00055 if self.orig_caller_id is None:
00056 self.orig_caller_id = ''
00057 if self.int32_array is None:
00058 self.int32_array = []
00059 if self.float32_array is None:
00060 self.float32_array = []
00061 if self.time_array is None:
00062 self.time_array = []
00063 if self.test_string_array is None:
00064 self.test_string_array = []
00065 else:
00066 self.caller_id = ''
00067 self.orig_caller_id = ''
00068 self.int32_array = []
00069 self.float32_array = []
00070 self.time_array = []
00071 self.test_string_array = []
00072
00073 def _get_types(self):
00074 """
00075 internal API method
00076 """
00077 return self._slot_types
00078
00079 def serialize(self, buff):
00080 """
00081 serialize message into buffer
00082 @param buff: buffer
00083 @type buff: StringIO
00084 """
00085 try:
00086 _x = self.caller_id
00087 length = len(_x)
00088 buff.write(struct.pack('<I%ss'%length, length, _x))
00089 _x = self.orig_caller_id
00090 length = len(_x)
00091 buff.write(struct.pack('<I%ss'%length, length, _x))
00092 length = len(self.int32_array)
00093 buff.write(_struct_I.pack(length))
00094 pattern = '<%si'%length
00095 buff.write(struct.pack(pattern, *self.int32_array))
00096 length = len(self.float32_array)
00097 buff.write(_struct_I.pack(length))
00098 pattern = '<%sf'%length
00099 buff.write(struct.pack(pattern, *self.float32_array))
00100 length = len(self.time_array)
00101 buff.write(_struct_I.pack(length))
00102 for val1 in self.time_array:
00103 _x = val1
00104 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00105 length = len(self.test_string_array)
00106 buff.write(_struct_I.pack(length))
00107 for val1 in self.test_string_array:
00108 _x = val1.caller_id
00109 length = len(_x)
00110 buff.write(struct.pack('<I%ss'%length, length, _x))
00111 _x = val1.orig_caller_id
00112 length = len(_x)
00113 buff.write(struct.pack('<I%ss'%length, length, _x))
00114 _x = val1.data
00115 length = len(_x)
00116 buff.write(struct.pack('<I%ss'%length, length, _x))
00117 except struct.error, se: self._check_types(se)
00118 except TypeError, te: self._check_types(te)
00119
00120 def deserialize(self, str):
00121 """
00122 unpack serialized message in str into this message instance
00123 @param str: byte array of serialized message
00124 @type str: str
00125 """
00126 try:
00127 end = 0
00128 start = end
00129 end += 4
00130 (length,) = _struct_I.unpack(str[start:end])
00131 start = end
00132 end += length
00133 self.caller_id = str[start:end]
00134 start = end
00135 end += 4
00136 (length,) = _struct_I.unpack(str[start:end])
00137 start = end
00138 end += length
00139 self.orig_caller_id = str[start:end]
00140 start = end
00141 end += 4
00142 (length,) = _struct_I.unpack(str[start:end])
00143 pattern = '<%si'%length
00144 start = end
00145 end += struct.calcsize(pattern)
00146 self.int32_array = struct.unpack(pattern, str[start:end])
00147 start = end
00148 end += 4
00149 (length,) = _struct_I.unpack(str[start:end])
00150 pattern = '<%sf'%length
00151 start = end
00152 end += struct.calcsize(pattern)
00153 self.float32_array = struct.unpack(pattern, str[start:end])
00154 start = end
00155 end += 4
00156 (length,) = _struct_I.unpack(str[start:end])
00157 self.time_array = []
00158 for i in xrange(0, length):
00159 val1 = roslib.rostime.Time()
00160 _x = val1
00161 start = end
00162 end += 8
00163 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00164 self.time_array.append(val1)
00165 start = end
00166 end += 4
00167 (length,) = _struct_I.unpack(str[start:end])
00168 self.test_string_array = []
00169 for i in xrange(0, length):
00170 val1 = test_ros.msg.TestString()
00171 start = end
00172 end += 4
00173 (length,) = _struct_I.unpack(str[start:end])
00174 start = end
00175 end += length
00176 val1.caller_id = str[start:end]
00177 start = end
00178 end += 4
00179 (length,) = _struct_I.unpack(str[start:end])
00180 start = end
00181 end += length
00182 val1.orig_caller_id = str[start:end]
00183 start = end
00184 end += 4
00185 (length,) = _struct_I.unpack(str[start:end])
00186 start = end
00187 end += length
00188 val1.data = str[start:end]
00189 self.test_string_array.append(val1)
00190 return self
00191 except struct.error, e:
00192 raise roslib.message.DeserializationError(e)
00193
00194
00195 def serialize_numpy(self, buff, numpy):
00196 """
00197 serialize message with numpy array types into buffer
00198 @param buff: buffer
00199 @type buff: StringIO
00200 @param numpy: numpy python module
00201 @type numpy module
00202 """
00203 try:
00204 _x = self.caller_id
00205 length = len(_x)
00206 buff.write(struct.pack('<I%ss'%length, length, _x))
00207 _x = self.orig_caller_id
00208 length = len(_x)
00209 buff.write(struct.pack('<I%ss'%length, length, _x))
00210 length = len(self.int32_array)
00211 buff.write(_struct_I.pack(length))
00212 pattern = '<%si'%length
00213 buff.write(self.int32_array.tostring())
00214 length = len(self.float32_array)
00215 buff.write(_struct_I.pack(length))
00216 pattern = '<%sf'%length
00217 buff.write(self.float32_array.tostring())
00218 length = len(self.time_array)
00219 buff.write(_struct_I.pack(length))
00220 for val1 in self.time_array:
00221 _x = val1
00222 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00223 length = len(self.test_string_array)
00224 buff.write(_struct_I.pack(length))
00225 for val1 in self.test_string_array:
00226 _x = val1.caller_id
00227 length = len(_x)
00228 buff.write(struct.pack('<I%ss'%length, length, _x))
00229 _x = val1.orig_caller_id
00230 length = len(_x)
00231 buff.write(struct.pack('<I%ss'%length, length, _x))
00232 _x = val1.data
00233 length = len(_x)
00234 buff.write(struct.pack('<I%ss'%length, length, _x))
00235 except struct.error, se: self._check_types(se)
00236 except TypeError, te: self._check_types(te)
00237
00238 def deserialize_numpy(self, str, numpy):
00239 """
00240 unpack serialized message in str into this message instance using numpy for array types
00241 @param str: byte array of serialized message
00242 @type str: str
00243 @param numpy: numpy python module
00244 @type numpy: module
00245 """
00246 try:
00247 end = 0
00248 start = end
00249 end += 4
00250 (length,) = _struct_I.unpack(str[start:end])
00251 start = end
00252 end += length
00253 self.caller_id = str[start:end]
00254 start = end
00255 end += 4
00256 (length,) = _struct_I.unpack(str[start:end])
00257 start = end
00258 end += length
00259 self.orig_caller_id = str[start:end]
00260 start = end
00261 end += 4
00262 (length,) = _struct_I.unpack(str[start:end])
00263 pattern = '<%si'%length
00264 start = end
00265 end += struct.calcsize(pattern)
00266 self.int32_array = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00267 start = end
00268 end += 4
00269 (length,) = _struct_I.unpack(str[start:end])
00270 pattern = '<%sf'%length
00271 start = end
00272 end += struct.calcsize(pattern)
00273 self.float32_array = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00274 start = end
00275 end += 4
00276 (length,) = _struct_I.unpack(str[start:end])
00277 self.time_array = []
00278 for i in xrange(0, length):
00279 val1 = roslib.rostime.Time()
00280 _x = val1
00281 start = end
00282 end += 8
00283 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00284 self.time_array.append(val1)
00285 start = end
00286 end += 4
00287 (length,) = _struct_I.unpack(str[start:end])
00288 self.test_string_array = []
00289 for i in xrange(0, length):
00290 val1 = test_ros.msg.TestString()
00291 start = end
00292 end += 4
00293 (length,) = _struct_I.unpack(str[start:end])
00294 start = end
00295 end += length
00296 val1.caller_id = str[start:end]
00297 start = end
00298 end += 4
00299 (length,) = _struct_I.unpack(str[start:end])
00300 start = end
00301 end += length
00302 val1.orig_caller_id = str[start:end]
00303 start = end
00304 end += 4
00305 (length,) = _struct_I.unpack(str[start:end])
00306 start = end
00307 end += length
00308 val1.data = str[start:end]
00309 self.test_string_array.append(val1)
00310 return self
00311 except struct.error, e:
00312 raise roslib.message.DeserializationError(e)
00313
00314 _struct_I = roslib.message.struct_I
00315 _struct_2I = struct.Struct("<2I")