_HeaderTestTwo.py
Go to the documentation of this file.
00001 """autogenerated by genpy from rosbridge_test/HeaderTestTwo.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 HeaderTestTwo(genpy.Message):
00010   _md5sum = "d7be0bb39af8fb9129d5a76e6b63a290"
00011   _type = "rosbridge_test/HeaderTestTwo"
00012   _has_header = True #flag to mark the presence of a Header object
00013   _full_text = """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(HeaderTestTwo, 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 = std_msgs.msg.Header()
00055     else:
00056       self.header = std_msgs.msg.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       _x = self
00071       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00072       _x = self.header.frame_id
00073       length = len(_x)
00074       if python3 or type(_x) == unicode:
00075         _x = _x.encode('utf-8')
00076         length = len(_x)
00077       buff.write(struct.pack('<I%ss'%length, length, _x))
00078     except struct.error as se: self._check_types(se)
00079     except TypeError as te: self._check_types(te)
00080 
00081   def deserialize(self, str):
00082     """
00083     unpack serialized message in str into this message instance
00084     :param str: byte array of serialized message, ``str``
00085     """
00086     try:
00087       if self.header is None:
00088         self.header = std_msgs.msg.Header()
00089       end = 0
00090       _x = self
00091       start = end
00092       end += 12
00093       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00094       start = end
00095       end += 4
00096       (length,) = _struct_I.unpack(str[start:end])
00097       start = end
00098       end += length
00099       if python3:
00100         self.header.frame_id = str[start:end].decode('utf-8')
00101       else:
00102         self.header.frame_id = str[start:end]
00103       return self
00104     except struct.error as e:
00105       raise genpy.DeserializationError(e) #most likely buffer underfill
00106 
00107 
00108   def serialize_numpy(self, buff, numpy):
00109     """
00110     serialize message with numpy array types into buffer
00111     :param buff: buffer, ``StringIO``
00112     :param numpy: numpy python module
00113     """
00114     try:
00115       _x = self
00116       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00117       _x = self.header.frame_id
00118       length = len(_x)
00119       if python3 or type(_x) == unicode:
00120         _x = _x.encode('utf-8')
00121         length = len(_x)
00122       buff.write(struct.pack('<I%ss'%length, length, _x))
00123     except struct.error as se: self._check_types(se)
00124     except TypeError as te: self._check_types(te)
00125 
00126   def deserialize_numpy(self, str, numpy):
00127     """
00128     unpack serialized message in str into this message instance using numpy for array types
00129     :param str: byte array of serialized message, ``str``
00130     :param numpy: numpy python module
00131     """
00132     try:
00133       if self.header is None:
00134         self.header = std_msgs.msg.Header()
00135       end = 0
00136       _x = self
00137       start = end
00138       end += 12
00139       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00140       start = end
00141       end += 4
00142       (length,) = _struct_I.unpack(str[start:end])
00143       start = end
00144       end += length
00145       if python3:
00146         self.header.frame_id = str[start:end].decode('utf-8')
00147       else:
00148         self.header.frame_id = str[start:end]
00149       return self
00150     except struct.error as e:
00151       raise genpy.DeserializationError(e) #most likely buffer underfill
00152 
00153 _struct_I = genpy.struct_I
00154 _struct_3I = struct.Struct("<3I")


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