_TestDataTypes.py
Go to the documentation of this file.
00001 """autogenerated by genpy from test_rosjava_jni/TestDataTypes.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 genpy
00008 import std_msgs.msg
00009 
00010 class TestDataTypes(genpy.Message):
00011   _md5sum = "25bc379e8ef2913896f76e9ef8bedbdc"
00012   _type = "test_rosjava_jni/TestDataTypes"
00013   _has_header = False #flag to mark the presence of a Header object
00014   _full_text = """# Test all primitive types
00015 byte     byte_
00016 char     char_
00017 uint8    uint8_
00018 int8     int8_
00019 uint16   uint16_
00020 int16    int16_
00021 uint32   uint32_
00022 int32    int32_
00023 uint64   uint64_
00024 int64    int64_
00025 float32  float32_
00026 float64  float64_
00027 string   string_
00028 time     time_
00029 duration duration_
00030 
00031 # Test a smattering of array types
00032 byte[]     byte_v
00033 byte[2]    byte_f
00034 float64[]  float64_v
00035 float64[2] float64_f
00036 string[]   string_v
00037 string[2]  string_f
00038 time[]     time_v
00039 time[2]    time_f
00040 
00041 # Test submsgs, including both fixed and var length
00042 std_msgs/Byte    Byte_
00043 std_msgs/Byte[]  Byte_v
00044 
00045 std_msgs/ByteMultiArray    ByteMultiArray_
00046 std_msgs/ByteMultiArray[]  ByteMultiArray_v
00047 
00048 # Unfortunately, can't test these because roscpp message generation
00049 # is broken.  Hopefully rosjava works correctly ...
00050 # TODO: put these back in.
00051 
00052 # std_msgs/Byte[2] Byte_f
00053 # std_msgs/ByteMultiArray[2] ByteMultiArray_f
00054 
00055 ================================================================================
00056 MSG: std_msgs/Byte
00057 byte data
00058 
00059 ================================================================================
00060 MSG: std_msgs/ByteMultiArray
00061 # Please look at the MultiArrayLayout message definition for
00062 # documentation on all multiarrays.
00063 
00064 MultiArrayLayout  layout        # specification of data layout
00065 byte[]            data          # array of data
00066 
00067 
00068 ================================================================================
00069 MSG: std_msgs/MultiArrayLayout
00070 # The multiarray declares a generic multi-dimensional array of a
00071 # particular data type.  Dimensions are ordered from outer most
00072 # to inner most.
00073 
00074 MultiArrayDimension[] dim # Array of dimension properties
00075 uint32 data_offset        # padding bytes at front of data
00076 
00077 # Accessors should ALWAYS be written in terms of dimension stride
00078 # and specified outer-most dimension first.
00079 # 
00080 # multiarray(i,j,k) = data[data_offset + dim_stride[1]*i + dim_stride[2]*j + k]
00081 #
00082 # A standard, 3-channel 640x480 image with interleaved color channels
00083 # would be specified as:
00084 #
00085 # dim[0].label  = "height"
00086 # dim[0].size   = 480
00087 # dim[0].stride = 3*640*480 = 921600  (note dim[0] stride is just size of image)
00088 # dim[1].label  = "width"
00089 # dim[1].size   = 640
00090 # dim[1].stride = 3*640 = 1920
00091 # dim[2].label  = "channel"
00092 # dim[2].size   = 3
00093 # dim[2].stride = 3
00094 #
00095 # multiarray(i,j,k) refers to the ith row, jth column, and kth channel.
00096 ================================================================================
00097 MSG: std_msgs/MultiArrayDimension
00098 string label   # label of given dimension
00099 uint32 size    # size of given dimension (in type units)
00100 uint32 stride  # stride of given dimension
00101 """
00102   __slots__ = ['byte_','char_','uint8_','int8_','uint16_','int16_','uint32_','int32_','uint64_','int64_','float32_','float64_','string_','time_','duration_','byte_v','byte_f','float64_v','float64_f','string_v','string_f','time_v','time_f','Byte_','Byte_v','ByteMultiArray_','ByteMultiArray_v']
00103   _slot_types = ['byte','char','uint8','int8','uint16','int16','uint32','int32','uint64','int64','float32','float64','string','time','duration','byte[]','byte[2]','float64[]','float64[2]','string[]','string[2]','time[]','time[2]','std_msgs/Byte','std_msgs/Byte[]','std_msgs/ByteMultiArray','std_msgs/ByteMultiArray[]']
00104 
00105   def __init__(self, *args, **kwds):
00106     """
00107     Constructor. Any message fields that are implicitly/explicitly
00108     set to None will be assigned a default value. The recommend
00109     use is keyword arguments as this is more robust to future message
00110     changes.  You cannot mix in-order arguments and keyword arguments.
00111 
00112     The available fields are:
00113        byte_,char_,uint8_,int8_,uint16_,int16_,uint32_,int32_,uint64_,int64_,float32_,float64_,string_,time_,duration_,byte_v,byte_f,float64_v,float64_f,string_v,string_f,time_v,time_f,Byte_,Byte_v,ByteMultiArray_,ByteMultiArray_v
00114 
00115     :param args: complete set of field values, in .msg order
00116     :param kwds: use keyword arguments corresponding to message field names
00117     to set specific fields.
00118     """
00119     if args or kwds:
00120       super(TestDataTypes, self).__init__(*args, **kwds)
00121       #message fields cannot be None, assign default values for those that are
00122       if self.byte_ is None:
00123         self.byte_ = 0
00124       if self.char_ is None:
00125         self.char_ = 0
00126       if self.uint8_ is None:
00127         self.uint8_ = 0
00128       if self.int8_ is None:
00129         self.int8_ = 0
00130       if self.uint16_ is None:
00131         self.uint16_ = 0
00132       if self.int16_ is None:
00133         self.int16_ = 0
00134       if self.uint32_ is None:
00135         self.uint32_ = 0
00136       if self.int32_ is None:
00137         self.int32_ = 0
00138       if self.uint64_ is None:
00139         self.uint64_ = 0
00140       if self.int64_ is None:
00141         self.int64_ = 0
00142       if self.float32_ is None:
00143         self.float32_ = 0.
00144       if self.float64_ is None:
00145         self.float64_ = 0.
00146       if self.string_ is None:
00147         self.string_ = ''
00148       if self.time_ is None:
00149         self.time_ = genpy.Time()
00150       if self.duration_ is None:
00151         self.duration_ = genpy.Duration()
00152       if self.byte_v is None:
00153         self.byte_v = []
00154       if self.byte_f is None:
00155         self.byte_f = [0,0]
00156       if self.float64_v is None:
00157         self.float64_v = []
00158       if self.float64_f is None:
00159         self.float64_f = [0.,0.]
00160       if self.string_v is None:
00161         self.string_v = []
00162       if self.string_f is None:
00163         self.string_f = ['','']
00164       if self.time_v is None:
00165         self.time_v = []
00166       if self.time_f is None:
00167         self.time_f = [genpy.Time(),genpy.Time()]
00168       if self.Byte_ is None:
00169         self.Byte_ = std_msgs.msg.Byte()
00170       if self.Byte_v is None:
00171         self.Byte_v = []
00172       if self.ByteMultiArray_ is None:
00173         self.ByteMultiArray_ = std_msgs.msg.ByteMultiArray()
00174       if self.ByteMultiArray_v is None:
00175         self.ByteMultiArray_v = []
00176     else:
00177       self.byte_ = 0
00178       self.char_ = 0
00179       self.uint8_ = 0
00180       self.int8_ = 0
00181       self.uint16_ = 0
00182       self.int16_ = 0
00183       self.uint32_ = 0
00184       self.int32_ = 0
00185       self.uint64_ = 0
00186       self.int64_ = 0
00187       self.float32_ = 0.
00188       self.float64_ = 0.
00189       self.string_ = ''
00190       self.time_ = genpy.Time()
00191       self.duration_ = genpy.Duration()
00192       self.byte_v = []
00193       self.byte_f = [0,0]
00194       self.float64_v = []
00195       self.float64_f = [0.,0.]
00196       self.string_v = []
00197       self.string_f = ['','']
00198       self.time_v = []
00199       self.time_f = [genpy.Time(),genpy.Time()]
00200       self.Byte_ = std_msgs.msg.Byte()
00201       self.Byte_v = []
00202       self.ByteMultiArray_ = std_msgs.msg.ByteMultiArray()
00203       self.ByteMultiArray_v = []
00204 
00205   def _get_types(self):
00206     """
00207     internal API method
00208     """
00209     return self._slot_types
00210 
00211   def serialize(self, buff):
00212     """
00213     serialize message into buffer
00214     :param buff: buffer, ``StringIO``
00215     """
00216     try:
00217       _x = self
00218       buff.write(_struct_b2BbHhIiQqfd.pack(_x.byte_, _x.char_, _x.uint8_, _x.int8_, _x.uint16_, _x.int16_, _x.uint32_, _x.int32_, _x.uint64_, _x.int64_, _x.float32_, _x.float64_))
00219       _x = self.string_
00220       length = len(_x)
00221       if python3 or type(_x) == unicode:
00222         _x = _x.encode('utf-8')
00223         length = len(_x)
00224       buff.write(struct.pack('<I%ss'%length, length, _x))
00225       _x = self
00226       buff.write(_struct_2I2i.pack(_x.time_.secs, _x.time_.nsecs, _x.duration_.secs, _x.duration_.nsecs))
00227       length = len(self.byte_v)
00228       buff.write(_struct_I.pack(length))
00229       pattern = '<%sb'%length
00230       buff.write(struct.pack(pattern, *self.byte_v))
00231       buff.write(_struct_2b.pack(*self.byte_f))
00232       length = len(self.float64_v)
00233       buff.write(_struct_I.pack(length))
00234       pattern = '<%sd'%length
00235       buff.write(struct.pack(pattern, *self.float64_v))
00236       buff.write(_struct_2d.pack(*self.float64_f))
00237       length = len(self.string_v)
00238       buff.write(_struct_I.pack(length))
00239       for val1 in self.string_v:
00240         length = len(val1)
00241         if python3 or type(val1) == unicode:
00242           val1 = val1.encode('utf-8')
00243           length = len(val1)
00244         buff.write(struct.pack('<I%ss'%length, length, val1))
00245       for val1 in self.string_f:
00246         length = len(val1)
00247         if python3 or type(val1) == unicode:
00248           val1 = val1.encode('utf-8')
00249           length = len(val1)
00250         buff.write(struct.pack('<I%ss'%length, length, val1))
00251       length = len(self.time_v)
00252       buff.write(_struct_I.pack(length))
00253       for val1 in self.time_v:
00254         _x = val1
00255         buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00256       for val1 in self.time_f:
00257         _x = val1
00258         buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00259       buff.write(_struct_b.pack(self.Byte_.data))
00260       length = len(self.Byte_v)
00261       buff.write(_struct_I.pack(length))
00262       for val1 in self.Byte_v:
00263         buff.write(_struct_b.pack(val1.data))
00264       length = len(self.ByteMultiArray_.layout.dim)
00265       buff.write(_struct_I.pack(length))
00266       for val1 in self.ByteMultiArray_.layout.dim:
00267         _x = val1.label
00268         length = len(_x)
00269         if python3 or type(_x) == unicode:
00270           _x = _x.encode('utf-8')
00271           length = len(_x)
00272         buff.write(struct.pack('<I%ss'%length, length, _x))
00273         _x = val1
00274         buff.write(_struct_2I.pack(_x.size, _x.stride))
00275       buff.write(_struct_I.pack(self.ByteMultiArray_.layout.data_offset))
00276       length = len(self.ByteMultiArray_.data)
00277       buff.write(_struct_I.pack(length))
00278       pattern = '<%sb'%length
00279       buff.write(struct.pack(pattern, *self.ByteMultiArray_.data))
00280       length = len(self.ByteMultiArray_v)
00281       buff.write(_struct_I.pack(length))
00282       for val1 in self.ByteMultiArray_v:
00283         _v1 = val1.layout
00284         length = len(_v1.dim)
00285         buff.write(_struct_I.pack(length))
00286         for val3 in _v1.dim:
00287           _x = val3.label
00288           length = len(_x)
00289           if python3 or type(_x) == unicode:
00290             _x = _x.encode('utf-8')
00291             length = len(_x)
00292           buff.write(struct.pack('<I%ss'%length, length, _x))
00293           _x = val3
00294           buff.write(_struct_2I.pack(_x.size, _x.stride))
00295         buff.write(_struct_I.pack(_v1.data_offset))
00296         length = len(val1.data)
00297         buff.write(_struct_I.pack(length))
00298         pattern = '<%sb'%length
00299         buff.write(struct.pack(pattern, *val1.data))
00300     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00301     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00302 
00303   def deserialize(self, str):
00304     """
00305     unpack serialized message in str into this message instance
00306     :param str: byte array of serialized message, ``str``
00307     """
00308     try:
00309       if self.time_ is None:
00310         self.time_ = genpy.Time()
00311       if self.duration_ is None:
00312         self.duration_ = genpy.Duration()
00313       if self.time_v is None:
00314         self.time_v = None
00315       if self.time_f is None:
00316         self.time_f = None
00317       if self.Byte_ is None:
00318         self.Byte_ = std_msgs.msg.Byte()
00319       if self.Byte_v is None:
00320         self.Byte_v = None
00321       if self.ByteMultiArray_ is None:
00322         self.ByteMultiArray_ = std_msgs.msg.ByteMultiArray()
00323       if self.ByteMultiArray_v is None:
00324         self.ByteMultiArray_v = None
00325       end = 0
00326       _x = self
00327       start = end
00328       end += 44
00329       (_x.byte_, _x.char_, _x.uint8_, _x.int8_, _x.uint16_, _x.int16_, _x.uint32_, _x.int32_, _x.uint64_, _x.int64_, _x.float32_, _x.float64_,) = _struct_b2BbHhIiQqfd.unpack(str[start:end])
00330       start = end
00331       end += 4
00332       (length,) = _struct_I.unpack(str[start:end])
00333       start = end
00334       end += length
00335       if python3:
00336         self.string_ = str[start:end].decode('utf-8')
00337       else:
00338         self.string_ = str[start:end]
00339       _x = self
00340       start = end
00341       end += 16
00342       (_x.time_.secs, _x.time_.nsecs, _x.duration_.secs, _x.duration_.nsecs,) = _struct_2I2i.unpack(str[start:end])
00343       start = end
00344       end += 4
00345       (length,) = _struct_I.unpack(str[start:end])
00346       pattern = '<%sb'%length
00347       start = end
00348       end += struct.calcsize(pattern)
00349       self.byte_v = struct.unpack(pattern, str[start:end])
00350       start = end
00351       end += 2
00352       self.byte_f = _struct_2b.unpack(str[start:end])
00353       start = end
00354       end += 4
00355       (length,) = _struct_I.unpack(str[start:end])
00356       pattern = '<%sd'%length
00357       start = end
00358       end += struct.calcsize(pattern)
00359       self.float64_v = struct.unpack(pattern, str[start:end])
00360       start = end
00361       end += 16
00362       self.float64_f = _struct_2d.unpack(str[start:end])
00363       start = end
00364       end += 4
00365       (length,) = _struct_I.unpack(str[start:end])
00366       self.string_v = []
00367       for i in range(0, length):
00368         start = end
00369         end += 4
00370         (length,) = _struct_I.unpack(str[start:end])
00371         start = end
00372         end += length
00373         if python3:
00374           val1 = str[start:end].decode('utf-8')
00375         else:
00376           val1 = str[start:end]
00377         self.string_v.append(val1)
00378       self.string_f = []
00379       for i in range(0, 2):
00380         start = end
00381         end += 4
00382         (length,) = _struct_I.unpack(str[start:end])
00383         start = end
00384         end += length
00385         if python3:
00386           val1 = str[start:end].decode('utf-8')
00387         else:
00388           val1 = str[start:end]
00389         self.string_f.append(val1)
00390       start = end
00391       end += 4
00392       (length,) = _struct_I.unpack(str[start:end])
00393       self.time_v = []
00394       for i in range(0, length):
00395         val1 = genpy.Time()
00396         _x = val1
00397         start = end
00398         end += 8
00399         (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00400         self.time_v.append(val1)
00401       self.time_f = []
00402       for i in range(0, 2):
00403         val1 = genpy.Time()
00404         _x = val1
00405         start = end
00406         end += 8
00407         (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00408         self.time_f.append(val1)
00409       start = end
00410       end += 1
00411       (self.Byte_.data,) = _struct_b.unpack(str[start:end])
00412       start = end
00413       end += 4
00414       (length,) = _struct_I.unpack(str[start:end])
00415       self.Byte_v = []
00416       for i in range(0, length):
00417         val1 = std_msgs.msg.Byte()
00418         start = end
00419         end += 1
00420         (val1.data,) = _struct_b.unpack(str[start:end])
00421         self.Byte_v.append(val1)
00422       start = end
00423       end += 4
00424       (length,) = _struct_I.unpack(str[start:end])
00425       self.ByteMultiArray_.layout.dim = []
00426       for i in range(0, length):
00427         val1 = std_msgs.msg.MultiArrayDimension()
00428         start = end
00429         end += 4
00430         (length,) = _struct_I.unpack(str[start:end])
00431         start = end
00432         end += length
00433         if python3:
00434           val1.label = str[start:end].decode('utf-8')
00435         else:
00436           val1.label = str[start:end]
00437         _x = val1
00438         start = end
00439         end += 8
00440         (_x.size, _x.stride,) = _struct_2I.unpack(str[start:end])
00441         self.ByteMultiArray_.layout.dim.append(val1)
00442       start = end
00443       end += 4
00444       (self.ByteMultiArray_.layout.data_offset,) = _struct_I.unpack(str[start:end])
00445       start = end
00446       end += 4
00447       (length,) = _struct_I.unpack(str[start:end])
00448       pattern = '<%sb'%length
00449       start = end
00450       end += struct.calcsize(pattern)
00451       self.ByteMultiArray_.data = struct.unpack(pattern, str[start:end])
00452       start = end
00453       end += 4
00454       (length,) = _struct_I.unpack(str[start:end])
00455       self.ByteMultiArray_v = []
00456       for i in range(0, length):
00457         val1 = std_msgs.msg.ByteMultiArray()
00458         _v2 = val1.layout
00459         start = end
00460         end += 4
00461         (length,) = _struct_I.unpack(str[start:end])
00462         _v2.dim = []
00463         for i in range(0, length):
00464           val3 = std_msgs.msg.MultiArrayDimension()
00465           start = end
00466           end += 4
00467           (length,) = _struct_I.unpack(str[start:end])
00468           start = end
00469           end += length
00470           if python3:
00471             val3.label = str[start:end].decode('utf-8')
00472           else:
00473             val3.label = str[start:end]
00474           _x = val3
00475           start = end
00476           end += 8
00477           (_x.size, _x.stride,) = _struct_2I.unpack(str[start:end])
00478           _v2.dim.append(val3)
00479         start = end
00480         end += 4
00481         (_v2.data_offset,) = _struct_I.unpack(str[start:end])
00482         start = end
00483         end += 4
00484         (length,) = _struct_I.unpack(str[start:end])
00485         pattern = '<%sb'%length
00486         start = end
00487         end += struct.calcsize(pattern)
00488         val1.data = struct.unpack(pattern, str[start:end])
00489         self.ByteMultiArray_v.append(val1)
00490       self.time_.canon()
00491       self.duration_.canon()
00492       return self
00493     except struct.error as e:
00494       raise genpy.DeserializationError(e) #most likely buffer underfill
00495 
00496 
00497   def serialize_numpy(self, buff, numpy):
00498     """
00499     serialize message with numpy array types into buffer
00500     :param buff: buffer, ``StringIO``
00501     :param numpy: numpy python module
00502     """
00503     try:
00504       _x = self
00505       buff.write(_struct_b2BbHhIiQqfd.pack(_x.byte_, _x.char_, _x.uint8_, _x.int8_, _x.uint16_, _x.int16_, _x.uint32_, _x.int32_, _x.uint64_, _x.int64_, _x.float32_, _x.float64_))
00506       _x = self.string_
00507       length = len(_x)
00508       if python3 or type(_x) == unicode:
00509         _x = _x.encode('utf-8')
00510         length = len(_x)
00511       buff.write(struct.pack('<I%ss'%length, length, _x))
00512       _x = self
00513       buff.write(_struct_2I2i.pack(_x.time_.secs, _x.time_.nsecs, _x.duration_.secs, _x.duration_.nsecs))
00514       length = len(self.byte_v)
00515       buff.write(_struct_I.pack(length))
00516       pattern = '<%sb'%length
00517       buff.write(self.byte_v.tostring())
00518       buff.write(self.byte_f.tostring())
00519       length = len(self.float64_v)
00520       buff.write(_struct_I.pack(length))
00521       pattern = '<%sd'%length
00522       buff.write(self.float64_v.tostring())
00523       buff.write(self.float64_f.tostring())
00524       length = len(self.string_v)
00525       buff.write(_struct_I.pack(length))
00526       for val1 in self.string_v:
00527         length = len(val1)
00528         if python3 or type(val1) == unicode:
00529           val1 = val1.encode('utf-8')
00530           length = len(val1)
00531         buff.write(struct.pack('<I%ss'%length, length, val1))
00532       for val1 in self.string_f:
00533         length = len(val1)
00534         if python3 or type(val1) == unicode:
00535           val1 = val1.encode('utf-8')
00536           length = len(val1)
00537         buff.write(struct.pack('<I%ss'%length, length, val1))
00538       length = len(self.time_v)
00539       buff.write(_struct_I.pack(length))
00540       for val1 in self.time_v:
00541         _x = val1
00542         buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00543       for val1 in self.time_f:
00544         _x = val1
00545         buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00546       buff.write(_struct_b.pack(self.Byte_.data))
00547       length = len(self.Byte_v)
00548       buff.write(_struct_I.pack(length))
00549       for val1 in self.Byte_v:
00550         buff.write(_struct_b.pack(val1.data))
00551       length = len(self.ByteMultiArray_.layout.dim)
00552       buff.write(_struct_I.pack(length))
00553       for val1 in self.ByteMultiArray_.layout.dim:
00554         _x = val1.label
00555         length = len(_x)
00556         if python3 or type(_x) == unicode:
00557           _x = _x.encode('utf-8')
00558           length = len(_x)
00559         buff.write(struct.pack('<I%ss'%length, length, _x))
00560         _x = val1
00561         buff.write(_struct_2I.pack(_x.size, _x.stride))
00562       buff.write(_struct_I.pack(self.ByteMultiArray_.layout.data_offset))
00563       length = len(self.ByteMultiArray_.data)
00564       buff.write(_struct_I.pack(length))
00565       pattern = '<%sb'%length
00566       buff.write(self.ByteMultiArray_.data.tostring())
00567       length = len(self.ByteMultiArray_v)
00568       buff.write(_struct_I.pack(length))
00569       for val1 in self.ByteMultiArray_v:
00570         _v3 = val1.layout
00571         length = len(_v3.dim)
00572         buff.write(_struct_I.pack(length))
00573         for val3 in _v3.dim:
00574           _x = val3.label
00575           length = len(_x)
00576           if python3 or type(_x) == unicode:
00577             _x = _x.encode('utf-8')
00578             length = len(_x)
00579           buff.write(struct.pack('<I%ss'%length, length, _x))
00580           _x = val3
00581           buff.write(_struct_2I.pack(_x.size, _x.stride))
00582         buff.write(_struct_I.pack(_v3.data_offset))
00583         length = len(val1.data)
00584         buff.write(_struct_I.pack(length))
00585         pattern = '<%sb'%length
00586         buff.write(val1.data.tostring())
00587     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00588     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00589 
00590   def deserialize_numpy(self, str, numpy):
00591     """
00592     unpack serialized message in str into this message instance using numpy for array types
00593     :param str: byte array of serialized message, ``str``
00594     :param numpy: numpy python module
00595     """
00596     try:
00597       if self.time_ is None:
00598         self.time_ = genpy.Time()
00599       if self.duration_ is None:
00600         self.duration_ = genpy.Duration()
00601       if self.time_v is None:
00602         self.time_v = None
00603       if self.time_f is None:
00604         self.time_f = None
00605       if self.Byte_ is None:
00606         self.Byte_ = std_msgs.msg.Byte()
00607       if self.Byte_v is None:
00608         self.Byte_v = None
00609       if self.ByteMultiArray_ is None:
00610         self.ByteMultiArray_ = std_msgs.msg.ByteMultiArray()
00611       if self.ByteMultiArray_v is None:
00612         self.ByteMultiArray_v = None
00613       end = 0
00614       _x = self
00615       start = end
00616       end += 44
00617       (_x.byte_, _x.char_, _x.uint8_, _x.int8_, _x.uint16_, _x.int16_, _x.uint32_, _x.int32_, _x.uint64_, _x.int64_, _x.float32_, _x.float64_,) = _struct_b2BbHhIiQqfd.unpack(str[start:end])
00618       start = end
00619       end += 4
00620       (length,) = _struct_I.unpack(str[start:end])
00621       start = end
00622       end += length
00623       if python3:
00624         self.string_ = str[start:end].decode('utf-8')
00625       else:
00626         self.string_ = str[start:end]
00627       _x = self
00628       start = end
00629       end += 16
00630       (_x.time_.secs, _x.time_.nsecs, _x.duration_.secs, _x.duration_.nsecs,) = _struct_2I2i.unpack(str[start:end])
00631       start = end
00632       end += 4
00633       (length,) = _struct_I.unpack(str[start:end])
00634       pattern = '<%sb'%length
00635       start = end
00636       end += struct.calcsize(pattern)
00637       self.byte_v = numpy.frombuffer(str[start:end], dtype=numpy.int8, count=length)
00638       start = end
00639       end += 2
00640       self.byte_f = numpy.frombuffer(str[start:end], dtype=numpy.int8, count=2)
00641       start = end
00642       end += 4
00643       (length,) = _struct_I.unpack(str[start:end])
00644       pattern = '<%sd'%length
00645       start = end
00646       end += struct.calcsize(pattern)
00647       self.float64_v = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00648       start = end
00649       end += 16
00650       self.float64_f = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=2)
00651       start = end
00652       end += 4
00653       (length,) = _struct_I.unpack(str[start:end])
00654       self.string_v = []
00655       for i in range(0, length):
00656         start = end
00657         end += 4
00658         (length,) = _struct_I.unpack(str[start:end])
00659         start = end
00660         end += length
00661         if python3:
00662           val1 = str[start:end].decode('utf-8')
00663         else:
00664           val1 = str[start:end]
00665         self.string_v.append(val1)
00666       self.string_f = []
00667       for i in range(0, 2):
00668         start = end
00669         end += 4
00670         (length,) = _struct_I.unpack(str[start:end])
00671         start = end
00672         end += length
00673         if python3:
00674           val1 = str[start:end].decode('utf-8')
00675         else:
00676           val1 = str[start:end]
00677         self.string_f.append(val1)
00678       start = end
00679       end += 4
00680       (length,) = _struct_I.unpack(str[start:end])
00681       self.time_v = []
00682       for i in range(0, length):
00683         val1 = genpy.Time()
00684         _x = val1
00685         start = end
00686         end += 8
00687         (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00688         self.time_v.append(val1)
00689       self.time_f = []
00690       for i in range(0, 2):
00691         val1 = genpy.Time()
00692         _x = val1
00693         start = end
00694         end += 8
00695         (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00696         self.time_f.append(val1)
00697       start = end
00698       end += 1
00699       (self.Byte_.data,) = _struct_b.unpack(str[start:end])
00700       start = end
00701       end += 4
00702       (length,) = _struct_I.unpack(str[start:end])
00703       self.Byte_v = []
00704       for i in range(0, length):
00705         val1 = std_msgs.msg.Byte()
00706         start = end
00707         end += 1
00708         (val1.data,) = _struct_b.unpack(str[start:end])
00709         self.Byte_v.append(val1)
00710       start = end
00711       end += 4
00712       (length,) = _struct_I.unpack(str[start:end])
00713       self.ByteMultiArray_.layout.dim = []
00714       for i in range(0, length):
00715         val1 = std_msgs.msg.MultiArrayDimension()
00716         start = end
00717         end += 4
00718         (length,) = _struct_I.unpack(str[start:end])
00719         start = end
00720         end += length
00721         if python3:
00722           val1.label = str[start:end].decode('utf-8')
00723         else:
00724           val1.label = str[start:end]
00725         _x = val1
00726         start = end
00727         end += 8
00728         (_x.size, _x.stride,) = _struct_2I.unpack(str[start:end])
00729         self.ByteMultiArray_.layout.dim.append(val1)
00730       start = end
00731       end += 4
00732       (self.ByteMultiArray_.layout.data_offset,) = _struct_I.unpack(str[start:end])
00733       start = end
00734       end += 4
00735       (length,) = _struct_I.unpack(str[start:end])
00736       pattern = '<%sb'%length
00737       start = end
00738       end += struct.calcsize(pattern)
00739       self.ByteMultiArray_.data = numpy.frombuffer(str[start:end], dtype=numpy.int8, count=length)
00740       start = end
00741       end += 4
00742       (length,) = _struct_I.unpack(str[start:end])
00743       self.ByteMultiArray_v = []
00744       for i in range(0, length):
00745         val1 = std_msgs.msg.ByteMultiArray()
00746         _v4 = val1.layout
00747         start = end
00748         end += 4
00749         (length,) = _struct_I.unpack(str[start:end])
00750         _v4.dim = []
00751         for i in range(0, length):
00752           val3 = std_msgs.msg.MultiArrayDimension()
00753           start = end
00754           end += 4
00755           (length,) = _struct_I.unpack(str[start:end])
00756           start = end
00757           end += length
00758           if python3:
00759             val3.label = str[start:end].decode('utf-8')
00760           else:
00761             val3.label = str[start:end]
00762           _x = val3
00763           start = end
00764           end += 8
00765           (_x.size, _x.stride,) = _struct_2I.unpack(str[start:end])
00766           _v4.dim.append(val3)
00767         start = end
00768         end += 4
00769         (_v4.data_offset,) = _struct_I.unpack(str[start:end])
00770         start = end
00771         end += 4
00772         (length,) = _struct_I.unpack(str[start:end])
00773         pattern = '<%sb'%length
00774         start = end
00775         end += struct.calcsize(pattern)
00776         val1.data = numpy.frombuffer(str[start:end], dtype=numpy.int8, count=length)
00777         self.ByteMultiArray_v.append(val1)
00778       self.time_.canon()
00779       self.duration_.canon()
00780       return self
00781     except struct.error as e:
00782       raise genpy.DeserializationError(e) #most likely buffer underfill
00783 
00784 _struct_I = genpy.struct_I
00785 _struct_2I2i = struct.Struct("<2I2i")
00786 _struct_b = struct.Struct("<b")
00787 _struct_b2BbHhIiQqfd = struct.Struct("<b2BbHhIiQqfd")
00788 _struct_2d = struct.Struct("<2d")
00789 _struct_2b = struct.Struct("<2b")
00790 _struct_2I = struct.Struct("<2I")


test_rosjava_jni
Author(s): Jason Wolfe (jawolfe@willowgarage.com)
autogenerated on Sun Oct 5 2014 22:54:22