_ComplexMessage.py
Go to the documentation of this file.
00001 """autogenerated by genpy from test_roslisp/ComplexMessage.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 test_roslisp.msg
00008 import std_msgs.msg
00009 
00010 class ComplexMessage(genpy.Message):
00011   _md5sum = "8bc73630573f57076b9939fd6536169a"
00012   _type = "test_roslisp/ComplexMessage"
00013   _has_header = False #flag to mark the presence of a Header object
00014   _full_text = """float32[4] x
00015 Foo[] y
00016 Foo[] z
00017 std_msgs/String[] w
00018 bool qux
00019 uint8 ind
00020 ================================================================================
00021 MSG: test_roslisp/Foo
00022 Bar y
00023 Bar[] z
00024 ================================================================================
00025 MSG: test_roslisp/Bar
00026 int32 x=10
00027 int32 y
00028 ================================================================================
00029 MSG: std_msgs/String
00030 string data
00031 
00032 """
00033   __slots__ = ['x','y','z','w','qux','ind']
00034   _slot_types = ['float32[4]','test_roslisp/Foo[]','test_roslisp/Foo[]','std_msgs/String[]','bool','uint8']
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        x,y,z,w,qux,ind
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(ComplexMessage, self).__init__(*args, **kwds)
00052       #message fields cannot be None, assign default values for those that are
00053       if self.x is None:
00054         self.x = [0.,0.,0.,0.]
00055       if self.y is None:
00056         self.y = []
00057       if self.z is None:
00058         self.z = []
00059       if self.w is None:
00060         self.w = []
00061       if self.qux is None:
00062         self.qux = False
00063       if self.ind is None:
00064         self.ind = 0
00065     else:
00066       self.x = [0.,0.,0.,0.]
00067       self.y = []
00068       self.z = []
00069       self.w = []
00070       self.qux = False
00071       self.ind = 0
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, ``StringIO``
00083     """
00084     try:
00085       buff.write(_struct_4f.pack(*self.x))
00086       length = len(self.y)
00087       buff.write(_struct_I.pack(length))
00088       for val1 in self.y:
00089         _v1 = val1.y
00090         buff.write(_struct_i.pack(_v1.y))
00091         length = len(val1.z)
00092         buff.write(_struct_I.pack(length))
00093         for val2 in val1.z:
00094           buff.write(_struct_i.pack(val2.y))
00095       length = len(self.z)
00096       buff.write(_struct_I.pack(length))
00097       for val1 in self.z:
00098         _v2 = val1.y
00099         buff.write(_struct_i.pack(_v2.y))
00100         length = len(val1.z)
00101         buff.write(_struct_I.pack(length))
00102         for val2 in val1.z:
00103           buff.write(_struct_i.pack(val2.y))
00104       length = len(self.w)
00105       buff.write(_struct_I.pack(length))
00106       for val1 in self.w:
00107         _x = val1.data
00108         length = len(_x)
00109         if python3 or type(_x) == unicode:
00110           _x = _x.encode('utf-8')
00111           length = len(_x)
00112         buff.write(struct.pack('<I%ss'%length, length, _x))
00113       _x = self
00114       buff.write(_struct_2B.pack(_x.qux, _x.ind))
00115     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00116     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00117 
00118   def deserialize(self, str):
00119     """
00120     unpack serialized message in str into this message instance
00121     :param str: byte array of serialized message, ``str``
00122     """
00123     try:
00124       if self.y is None:
00125         self.y = None
00126       if self.z is None:
00127         self.z = None
00128       if self.w is None:
00129         self.w = None
00130       end = 0
00131       start = end
00132       end += 16
00133       self.x = _struct_4f.unpack(str[start:end])
00134       start = end
00135       end += 4
00136       (length,) = _struct_I.unpack(str[start:end])
00137       self.y = []
00138       for i in range(0, length):
00139         val1 = test_roslisp.msg.Foo()
00140         _v3 = val1.y
00141         start = end
00142         end += 4
00143         (_v3.y,) = _struct_i.unpack(str[start:end])
00144         start = end
00145         end += 4
00146         (length,) = _struct_I.unpack(str[start:end])
00147         val1.z = []
00148         for i in range(0, length):
00149           val2 = test_roslisp.msg.Bar()
00150           start = end
00151           end += 4
00152           (val2.y,) = _struct_i.unpack(str[start:end])
00153           val1.z.append(val2)
00154         self.y.append(val1)
00155       start = end
00156       end += 4
00157       (length,) = _struct_I.unpack(str[start:end])
00158       self.z = []
00159       for i in range(0, length):
00160         val1 = test_roslisp.msg.Foo()
00161         _v4 = val1.y
00162         start = end
00163         end += 4
00164         (_v4.y,) = _struct_i.unpack(str[start:end])
00165         start = end
00166         end += 4
00167         (length,) = _struct_I.unpack(str[start:end])
00168         val1.z = []
00169         for i in range(0, length):
00170           val2 = test_roslisp.msg.Bar()
00171           start = end
00172           end += 4
00173           (val2.y,) = _struct_i.unpack(str[start:end])
00174           val1.z.append(val2)
00175         self.z.append(val1)
00176       start = end
00177       end += 4
00178       (length,) = _struct_I.unpack(str[start:end])
00179       self.w = []
00180       for i in range(0, length):
00181         val1 = std_msgs.msg.String()
00182         start = end
00183         end += 4
00184         (length,) = _struct_I.unpack(str[start:end])
00185         start = end
00186         end += length
00187         if python3:
00188           val1.data = str[start:end].decode('utf-8')
00189         else:
00190           val1.data = str[start:end]
00191         self.w.append(val1)
00192       _x = self
00193       start = end
00194       end += 2
00195       (_x.qux, _x.ind,) = _struct_2B.unpack(str[start:end])
00196       self.qux = bool(self.qux)
00197       return self
00198     except struct.error as e:
00199       raise genpy.DeserializationError(e) #most likely buffer underfill
00200 
00201 
00202   def serialize_numpy(self, buff, numpy):
00203     """
00204     serialize message with numpy array types into buffer
00205     :param buff: buffer, ``StringIO``
00206     :param numpy: numpy python module
00207     """
00208     try:
00209       buff.write(self.x.tostring())
00210       length = len(self.y)
00211       buff.write(_struct_I.pack(length))
00212       for val1 in self.y:
00213         _v5 = val1.y
00214         buff.write(_struct_i.pack(_v5.y))
00215         length = len(val1.z)
00216         buff.write(_struct_I.pack(length))
00217         for val2 in val1.z:
00218           buff.write(_struct_i.pack(val2.y))
00219       length = len(self.z)
00220       buff.write(_struct_I.pack(length))
00221       for val1 in self.z:
00222         _v6 = val1.y
00223         buff.write(_struct_i.pack(_v6.y))
00224         length = len(val1.z)
00225         buff.write(_struct_I.pack(length))
00226         for val2 in val1.z:
00227           buff.write(_struct_i.pack(val2.y))
00228       length = len(self.w)
00229       buff.write(_struct_I.pack(length))
00230       for val1 in self.w:
00231         _x = val1.data
00232         length = len(_x)
00233         if python3 or type(_x) == unicode:
00234           _x = _x.encode('utf-8')
00235           length = len(_x)
00236         buff.write(struct.pack('<I%ss'%length, length, _x))
00237       _x = self
00238       buff.write(_struct_2B.pack(_x.qux, _x.ind))
00239     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00240     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00241 
00242   def deserialize_numpy(self, str, numpy):
00243     """
00244     unpack serialized message in str into this message instance using numpy for array types
00245     :param str: byte array of serialized message, ``str``
00246     :param numpy: numpy python module
00247     """
00248     try:
00249       if self.y is None:
00250         self.y = None
00251       if self.z is None:
00252         self.z = None
00253       if self.w is None:
00254         self.w = None
00255       end = 0
00256       start = end
00257       end += 16
00258       self.x = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=4)
00259       start = end
00260       end += 4
00261       (length,) = _struct_I.unpack(str[start:end])
00262       self.y = []
00263       for i in range(0, length):
00264         val1 = test_roslisp.msg.Foo()
00265         _v7 = val1.y
00266         start = end
00267         end += 4
00268         (_v7.y,) = _struct_i.unpack(str[start:end])
00269         start = end
00270         end += 4
00271         (length,) = _struct_I.unpack(str[start:end])
00272         val1.z = []
00273         for i in range(0, length):
00274           val2 = test_roslisp.msg.Bar()
00275           start = end
00276           end += 4
00277           (val2.y,) = _struct_i.unpack(str[start:end])
00278           val1.z.append(val2)
00279         self.y.append(val1)
00280       start = end
00281       end += 4
00282       (length,) = _struct_I.unpack(str[start:end])
00283       self.z = []
00284       for i in range(0, length):
00285         val1 = test_roslisp.msg.Foo()
00286         _v8 = val1.y
00287         start = end
00288         end += 4
00289         (_v8.y,) = _struct_i.unpack(str[start:end])
00290         start = end
00291         end += 4
00292         (length,) = _struct_I.unpack(str[start:end])
00293         val1.z = []
00294         for i in range(0, length):
00295           val2 = test_roslisp.msg.Bar()
00296           start = end
00297           end += 4
00298           (val2.y,) = _struct_i.unpack(str[start:end])
00299           val1.z.append(val2)
00300         self.z.append(val1)
00301       start = end
00302       end += 4
00303       (length,) = _struct_I.unpack(str[start:end])
00304       self.w = []
00305       for i in range(0, length):
00306         val1 = std_msgs.msg.String()
00307         start = end
00308         end += 4
00309         (length,) = _struct_I.unpack(str[start:end])
00310         start = end
00311         end += length
00312         if python3:
00313           val1.data = str[start:end].decode('utf-8')
00314         else:
00315           val1.data = str[start:end]
00316         self.w.append(val1)
00317       _x = self
00318       start = end
00319       end += 2
00320       (_x.qux, _x.ind,) = _struct_2B.unpack(str[start:end])
00321       self.qux = bool(self.qux)
00322       return self
00323     except struct.error as e:
00324       raise genpy.DeserializationError(e) #most likely buffer underfill
00325 
00326 _struct_I = genpy.struct_I
00327 _struct_4f = struct.Struct("<4f")
00328 _struct_i = struct.Struct("<i")
00329 _struct_2B = struct.Struct("<2B")


test_roslisp
Author(s): Bhaskara Marthi
autogenerated on Wed Apr 23 2014 10:27:57