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


test_rosjava_jni
Author(s): Jason Wolfe (jawolfe@willowgarage.com)
autogenerated on Thu Jan 2 2014 11:07:07