_HeaderArrayTest.py
Go to the documentation of this file.
00001 """autogenerated by genpy from rosbridge_test/HeaderArrayTest.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 HeaderArrayTest(genpy.Message):
00010   _md5sum = "d7be0bb39af8fb9129d5a76e6b63a290"
00011   _type = "rosbridge_test/HeaderArrayTest"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """std_msgs/Header[] header
00014 ================================================================================
00015 MSG: std_msgs/Header
00016 # Standard metadata for higher-level stamped data types.
00017 # This is generally used to communicate timestamped data 
00018 # in a particular coordinate frame.
00019 # 
00020 # sequence ID: consecutively increasing ID 
00021 uint32 seq
00022 #Two-integer timestamp that is expressed as:
00023 # * stamp.secs: seconds (stamp_secs) since epoch
00024 # * stamp.nsecs: nanoseconds since stamp_secs
00025 # time-handling sugar is provided by the client library
00026 time stamp
00027 #Frame this data is associated with
00028 # 0: no frame
00029 # 1: global frame
00030 string frame_id
00031 
00032 """
00033   __slots__ = ['header']
00034   _slot_types = ['std_msgs/Header[]']
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        header
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(HeaderArrayTest, self).__init__(*args, **kwds)
00052       #message fields cannot be None, assign default values for those that are
00053       if self.header is None:
00054         self.header = []
00055     else:
00056       self.header = []
00057 
00058   def _get_types(self):
00059     """
00060     internal API method
00061     """
00062     return self._slot_types
00063 
00064   def serialize(self, buff):
00065     """
00066     serialize message into buffer
00067     :param buff: buffer, ``StringIO``
00068     """
00069     try:
00070       length = len(self.header)
00071       buff.write(_struct_I.pack(length))
00072       for val1 in self.header:
00073         buff.write(_struct_I.pack(val1.seq))
00074         _v1 = val1.stamp
00075         _x = _v1
00076         buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00077         _x = val1.frame_id
00078         length = len(_x)
00079         if python3 or type(_x) == unicode:
00080           _x = _x.encode('utf-8')
00081           length = len(_x)
00082         buff.write(struct.pack('<I%ss'%length, length, _x))
00083     except struct.error as se: self._check_types(se)
00084     except TypeError as te: self._check_types(te)
00085 
00086   def deserialize(self, str):
00087     """
00088     unpack serialized message in str into this message instance
00089     :param str: byte array of serialized message, ``str``
00090     """
00091     try:
00092       if self.header is None:
00093         self.header = None
00094       end = 0
00095       start = end
00096       end += 4
00097       (length,) = _struct_I.unpack(str[start:end])
00098       self.header = []
00099       for i in range(0, length):
00100         val1 = std_msgs.msg.Header()
00101         start = end
00102         end += 4
00103         (val1.seq,) = _struct_I.unpack(str[start:end])
00104         _v2 = val1.stamp
00105         _x = _v2
00106         start = end
00107         end += 8
00108         (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00109         start = end
00110         end += 4
00111         (length,) = _struct_I.unpack(str[start:end])
00112         start = end
00113         end += length
00114         if python3:
00115           val1.frame_id = str[start:end].decode('utf-8')
00116         else:
00117           val1.frame_id = str[start:end]
00118         self.header.append(val1)
00119       return self
00120     except struct.error as e:
00121       raise genpy.DeserializationError(e) #most likely buffer underfill
00122 
00123 
00124   def serialize_numpy(self, buff, numpy):
00125     """
00126     serialize message with numpy array types into buffer
00127     :param buff: buffer, ``StringIO``
00128     :param numpy: numpy python module
00129     """
00130     try:
00131       length = len(self.header)
00132       buff.write(_struct_I.pack(length))
00133       for val1 in self.header:
00134         buff.write(_struct_I.pack(val1.seq))
00135         _v3 = val1.stamp
00136         _x = _v3
00137         buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00138         _x = val1.frame_id
00139         length = len(_x)
00140         if python3 or type(_x) == unicode:
00141           _x = _x.encode('utf-8')
00142           length = len(_x)
00143         buff.write(struct.pack('<I%ss'%length, length, _x))
00144     except struct.error as se: self._check_types(se)
00145     except TypeError as te: self._check_types(te)
00146 
00147   def deserialize_numpy(self, str, numpy):
00148     """
00149     unpack serialized message in str into this message instance using numpy for array types
00150     :param str: byte array of serialized message, ``str``
00151     :param numpy: numpy python module
00152     """
00153     try:
00154       if self.header is None:
00155         self.header = None
00156       end = 0
00157       start = end
00158       end += 4
00159       (length,) = _struct_I.unpack(str[start:end])
00160       self.header = []
00161       for i in range(0, length):
00162         val1 = std_msgs.msg.Header()
00163         start = end
00164         end += 4
00165         (val1.seq,) = _struct_I.unpack(str[start:end])
00166         _v4 = val1.stamp
00167         _x = _v4
00168         start = end
00169         end += 8
00170         (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00171         start = end
00172         end += 4
00173         (length,) = _struct_I.unpack(str[start:end])
00174         start = end
00175         end += length
00176         if python3:
00177           val1.frame_id = str[start:end].decode('utf-8')
00178         else:
00179           val1.frame_id = str[start:end]
00180         self.header.append(val1)
00181       return self
00182     except struct.error as e:
00183       raise genpy.DeserializationError(e) #most likely buffer underfill
00184 
00185 _struct_I = genpy.struct_I
00186 _struct_2I = struct.Struct("<2I")


rosbridge_test
Author(s): Jonathan Mace
autogenerated on Thu Jan 2 2014 11:54:04