00001 """autogenerated by genmsg_py from ArrayOfMsgs.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import roslib.rostime
00006 import std_msgs.msg
00007
00008 class ArrayOfMsgs(roslib.message.Message):
00009 _md5sum = "1f4cf3ffabe2555a0cfe19c974f01a01"
00010 _type = "test_roslib_comm/ArrayOfMsgs"
00011 _has_header = False
00012 _full_text = """std_msgs/String[] strings
00013 std_msgs/Time[] times
00014 std_msgs/MultiArrayLayout[] muls
00015 ================================================================================
00016 MSG: std_msgs/String
00017 string data
00018
00019 ================================================================================
00020 MSG: std_msgs/Time
00021 time data
00022
00023 ================================================================================
00024 MSG: std_msgs/MultiArrayLayout
00025 # The multiarray declares a generic multi-dimensional array of a
00026 # particular data type. Dimensions are ordered from outer most
00027 # to inner most.
00028
00029 MultiArrayDimension[] dim # Array of dimension properties
00030 uint32 data_offset # padding bytes at front of data
00031
00032 # Accessors should ALWAYS be written in terms of dimension stride
00033 # and specified outer-most dimension first.
00034 #
00035 # multiarray(i,j,k) = data[data_offset + dim_stride[1]*i + dim_stride[2]*j + k]
00036 #
00037 # A standard, 3-channel 640x480 image with interleaved color channels
00038 # would be specified as:
00039 #
00040 # dim[0].label = "height"
00041 # dim[0].size = 480
00042 # dim[0].stride = 3*640*480 = 921600 (note dim[0] stride is just size of image)
00043 # dim[1].label = "width"
00044 # dim[1].size = 640
00045 # dim[1].stride = 3*640 = 1920
00046 # dim[2].label = "channel"
00047 # dim[2].size = 3
00048 # dim[2].stride = 3
00049 #
00050 # multiarray(i,j,k) refers to the ith row, jth column, and kth channel.
00051 ================================================================================
00052 MSG: std_msgs/MultiArrayDimension
00053 string label # label of given dimension
00054 uint32 size # size of given dimension (in type units)
00055 uint32 stride # stride of given dimension
00056 """
00057 __slots__ = ['strings','times','muls']
00058 _slot_types = ['std_msgs/String[]','std_msgs/Time[]','std_msgs/MultiArrayLayout[]']
00059
00060 def __init__(self, *args, **kwds):
00061 """
00062 Constructor. Any message fields that are implicitly/explicitly
00063 set to None will be assigned a default value. The recommend
00064 use is keyword arguments as this is more robust to future message
00065 changes. You cannot mix in-order arguments and keyword arguments.
00066
00067 The available fields are:
00068 strings,times,muls
00069
00070 @param args: complete set of field values, in .msg order
00071 @param kwds: use keyword arguments corresponding to message field names
00072 to set specific fields.
00073 """
00074 if args or kwds:
00075 super(ArrayOfMsgs, self).__init__(*args, **kwds)
00076
00077 if self.strings is None:
00078 self.strings = []
00079 if self.times is None:
00080 self.times = []
00081 if self.muls is None:
00082 self.muls = []
00083 else:
00084 self.strings = []
00085 self.times = []
00086 self.muls = []
00087
00088 def _get_types(self):
00089 """
00090 internal API method
00091 """
00092 return self._slot_types
00093
00094 def serialize(self, buff):
00095 """
00096 serialize message into buffer
00097 @param buff: buffer
00098 @type buff: StringIO
00099 """
00100 try:
00101 length = len(self.strings)
00102 buff.write(_struct_I.pack(length))
00103 for val1 in self.strings:
00104 _x = val1.data
00105 length = len(_x)
00106 buff.write(struct.pack('<I%ss'%length, length, _x))
00107 length = len(self.times)
00108 buff.write(_struct_I.pack(length))
00109 for val1 in self.times:
00110 _v1 = val1.data
00111 _x = _v1
00112 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00113 length = len(self.muls)
00114 buff.write(_struct_I.pack(length))
00115 for val1 in self.muls:
00116 length = len(val1.dim)
00117 buff.write(_struct_I.pack(length))
00118 for val2 in val1.dim:
00119 _x = val2.label
00120 length = len(_x)
00121 buff.write(struct.pack('<I%ss'%length, length, _x))
00122 _x = val2
00123 buff.write(_struct_2I.pack(_x.size, _x.stride))
00124 buff.write(_struct_I.pack(val1.data_offset))
00125 except struct.error, se: self._check_types(se)
00126 except TypeError, te: self._check_types(te)
00127
00128 def deserialize(self, str):
00129 """
00130 unpack serialized message in str into this message instance
00131 @param str: byte array of serialized message
00132 @type str: str
00133 """
00134 try:
00135 end = 0
00136 start = end
00137 end += 4
00138 (length,) = _struct_I.unpack(str[start:end])
00139 self.strings = []
00140 for i in xrange(0, length):
00141 val1 = std_msgs.msg.String()
00142 start = end
00143 end += 4
00144 (length,) = _struct_I.unpack(str[start:end])
00145 start = end
00146 end += length
00147 val1.data = str[start:end]
00148 self.strings.append(val1)
00149 start = end
00150 end += 4
00151 (length,) = _struct_I.unpack(str[start:end])
00152 self.times = []
00153 for i in xrange(0, length):
00154 val1 = std_msgs.msg.Time()
00155 _v2 = val1.data
00156 _x = _v2
00157 start = end
00158 end += 8
00159 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00160 self.times.append(val1)
00161 start = end
00162 end += 4
00163 (length,) = _struct_I.unpack(str[start:end])
00164 self.muls = []
00165 for i in xrange(0, length):
00166 val1 = std_msgs.msg.MultiArrayLayout()
00167 start = end
00168 end += 4
00169 (length,) = _struct_I.unpack(str[start:end])
00170 val1.dim = []
00171 for i in xrange(0, length):
00172 val2 = std_msgs.msg.MultiArrayDimension()
00173 start = end
00174 end += 4
00175 (length,) = _struct_I.unpack(str[start:end])
00176 start = end
00177 end += length
00178 val2.label = str[start:end]
00179 _x = val2
00180 start = end
00181 end += 8
00182 (_x.size, _x.stride,) = _struct_2I.unpack(str[start:end])
00183 val1.dim.append(val2)
00184 start = end
00185 end += 4
00186 (val1.data_offset,) = _struct_I.unpack(str[start:end])
00187 self.muls.append(val1)
00188 return self
00189 except struct.error, e:
00190 raise roslib.message.DeserializationError(e)
00191
00192
00193 def serialize_numpy(self, buff, numpy):
00194 """
00195 serialize message with numpy array types into buffer
00196 @param buff: buffer
00197 @type buff: StringIO
00198 @param numpy: numpy python module
00199 @type numpy module
00200 """
00201 try:
00202 length = len(self.strings)
00203 buff.write(_struct_I.pack(length))
00204 for val1 in self.strings:
00205 _x = val1.data
00206 length = len(_x)
00207 buff.write(struct.pack('<I%ss'%length, length, _x))
00208 length = len(self.times)
00209 buff.write(_struct_I.pack(length))
00210 for val1 in self.times:
00211 _v3 = val1.data
00212 _x = _v3
00213 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00214 length = len(self.muls)
00215 buff.write(_struct_I.pack(length))
00216 for val1 in self.muls:
00217 length = len(val1.dim)
00218 buff.write(_struct_I.pack(length))
00219 for val2 in val1.dim:
00220 _x = val2.label
00221 length = len(_x)
00222 buff.write(struct.pack('<I%ss'%length, length, _x))
00223 _x = val2
00224 buff.write(_struct_2I.pack(_x.size, _x.stride))
00225 buff.write(_struct_I.pack(val1.data_offset))
00226 except struct.error, se: self._check_types(se)
00227 except TypeError, te: self._check_types(te)
00228
00229 def deserialize_numpy(self, str, numpy):
00230 """
00231 unpack serialized message in str into this message instance using numpy for array types
00232 @param str: byte array of serialized message
00233 @type str: str
00234 @param numpy: numpy python module
00235 @type numpy: module
00236 """
00237 try:
00238 end = 0
00239 start = end
00240 end += 4
00241 (length,) = _struct_I.unpack(str[start:end])
00242 self.strings = []
00243 for i in xrange(0, length):
00244 val1 = std_msgs.msg.String()
00245 start = end
00246 end += 4
00247 (length,) = _struct_I.unpack(str[start:end])
00248 start = end
00249 end += length
00250 val1.data = str[start:end]
00251 self.strings.append(val1)
00252 start = end
00253 end += 4
00254 (length,) = _struct_I.unpack(str[start:end])
00255 self.times = []
00256 for i in xrange(0, length):
00257 val1 = std_msgs.msg.Time()
00258 _v4 = val1.data
00259 _x = _v4
00260 start = end
00261 end += 8
00262 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00263 self.times.append(val1)
00264 start = end
00265 end += 4
00266 (length,) = _struct_I.unpack(str[start:end])
00267 self.muls = []
00268 for i in xrange(0, length):
00269 val1 = std_msgs.msg.MultiArrayLayout()
00270 start = end
00271 end += 4
00272 (length,) = _struct_I.unpack(str[start:end])
00273 val1.dim = []
00274 for i in xrange(0, length):
00275 val2 = std_msgs.msg.MultiArrayDimension()
00276 start = end
00277 end += 4
00278 (length,) = _struct_I.unpack(str[start:end])
00279 start = end
00280 end += length
00281 val2.label = str[start:end]
00282 _x = val2
00283 start = end
00284 end += 8
00285 (_x.size, _x.stride,) = _struct_2I.unpack(str[start:end])
00286 val1.dim.append(val2)
00287 start = end
00288 end += 4
00289 (val1.data_offset,) = _struct_I.unpack(str[start:end])
00290 self.muls.append(val1)
00291 return self
00292 except struct.error, e:
00293 raise roslib.message.DeserializationError(e)
00294
00295 _struct_I = roslib.message.struct_I
00296 _struct_2I = struct.Struct("<2I")