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