00001 """autogenerated by genmsg_py from WithHeader.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import std_msgs.msg
00006
00007 class WithHeader(roslib.message.Message):
00008 _md5sum = "ea0b9ad283b0d4dcc850b560da7b6965"
00009 _type = "test_roscpp_serialization/WithHeader"
00010 _has_header = True
00011 _full_text = """Header header
00012 uint32 a
00013
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','a']
00034 _slot_types = ['Header','uint32']
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,a
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(WithHeader, self).__init__(*args, **kwds)
00052
00053 if self.header is None:
00054 self.header = std_msgs.msg._Header.Header()
00055 if self.a is None:
00056 self.a = 0
00057 else:
00058 self.header = std_msgs.msg._Header.Header()
00059 self.a = 0
00060
00061 def _get_types(self):
00062 """
00063 internal API method
00064 """
00065 return self._slot_types
00066
00067 def serialize(self, buff):
00068 """
00069 serialize message into buffer
00070 @param buff: buffer
00071 @type buff: StringIO
00072 """
00073 try:
00074 _x = self
00075 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00076 _x = self.header.frame_id
00077 length = len(_x)
00078 buff.write(struct.pack('<I%ss'%length, length, _x))
00079 buff.write(_struct_I.pack(self.a))
00080 except struct.error, se: self._check_types(se)
00081 except TypeError, te: self._check_types(te)
00082
00083 def deserialize(self, str):
00084 """
00085 unpack serialized message in str into this message instance
00086 @param str: byte array of serialized message
00087 @type str: str
00088 """
00089 try:
00090 if self.header is None:
00091 self.header = std_msgs.msg._Header.Header()
00092 end = 0
00093 _x = self
00094 start = end
00095 end += 12
00096 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00097 start = end
00098 end += 4
00099 (length,) = _struct_I.unpack(str[start:end])
00100 start = end
00101 end += length
00102 self.header.frame_id = str[start:end]
00103 start = end
00104 end += 4
00105 (self.a,) = _struct_I.unpack(str[start:end])
00106 return self
00107 except struct.error, e:
00108 raise roslib.message.DeserializationError(e)
00109
00110
00111 def serialize_numpy(self, buff, numpy):
00112 """
00113 serialize message with numpy array types into buffer
00114 @param buff: buffer
00115 @type buff: StringIO
00116 @param numpy: numpy python module
00117 @type numpy module
00118 """
00119 try:
00120 _x = self
00121 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00122 _x = self.header.frame_id
00123 length = len(_x)
00124 buff.write(struct.pack('<I%ss'%length, length, _x))
00125 buff.write(_struct_I.pack(self.a))
00126 except struct.error, se: self._check_types(se)
00127 except TypeError, te: self._check_types(te)
00128
00129 def deserialize_numpy(self, str, numpy):
00130 """
00131 unpack serialized message in str into this message instance using numpy for array types
00132 @param str: byte array of serialized message
00133 @type str: str
00134 @param numpy: numpy python module
00135 @type numpy: module
00136 """
00137 try:
00138 if self.header is None:
00139 self.header = std_msgs.msg._Header.Header()
00140 end = 0
00141 _x = self
00142 start = end
00143 end += 12
00144 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00145 start = end
00146 end += 4
00147 (length,) = _struct_I.unpack(str[start:end])
00148 start = end
00149 end += length
00150 self.header.frame_id = str[start:end]
00151 start = end
00152 end += 4
00153 (self.a,) = _struct_I.unpack(str[start:end])
00154 return self
00155 except struct.error, e:
00156 raise roslib.message.DeserializationError(e)
00157
00158 _struct_I = roslib.message.struct_I
00159 _struct_3I = struct.Struct("<3I")