00001 """autogenerated by genmsg_py from FillEmbedTime.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import roslib.rostime
00006 import std_msgs.msg
00007
00008 class FillEmbedTime(roslib.message.Message):
00009 _md5sum = "90e08039be001a899b8c20e680c289b0"
00010 _type = "test_roslib_comm/FillEmbedTime"
00011 _has_header = False
00012 _full_text = """time t
00013 duration d
00014 std_msgs/String str_msg
00015 std_msgs/String[] str_msg_array
00016 int32 i32
00017 ================================================================================
00018 MSG: std_msgs/String
00019 string data
00020
00021 """
00022 __slots__ = ['t','d','str_msg','str_msg_array','i32']
00023 _slot_types = ['time','duration','std_msgs/String','std_msgs/String[]','int32']
00024
00025 def __init__(self, *args, **kwds):
00026 """
00027 Constructor. Any message fields that are implicitly/explicitly
00028 set to None will be assigned a default value. The recommend
00029 use is keyword arguments as this is more robust to future message
00030 changes. You cannot mix in-order arguments and keyword arguments.
00031
00032 The available fields are:
00033 t,d,str_msg,str_msg_array,i32
00034
00035 @param args: complete set of field values, in .msg order
00036 @param kwds: use keyword arguments corresponding to message field names
00037 to set specific fields.
00038 """
00039 if args or kwds:
00040 super(FillEmbedTime, self).__init__(*args, **kwds)
00041
00042 if self.t is None:
00043 self.t = roslib.rostime.Time()
00044 if self.d is None:
00045 self.d = roslib.rostime.Duration()
00046 if self.str_msg is None:
00047 self.str_msg = std_msgs.msg.String()
00048 if self.str_msg_array is None:
00049 self.str_msg_array = []
00050 if self.i32 is None:
00051 self.i32 = 0
00052 else:
00053 self.t = roslib.rostime.Time()
00054 self.d = roslib.rostime.Duration()
00055 self.str_msg = std_msgs.msg.String()
00056 self.str_msg_array = []
00057 self.i32 = 0
00058
00059 def _get_types(self):
00060 """
00061 internal API method
00062 """
00063 return self._slot_types
00064
00065 def serialize(self, buff):
00066 """
00067 serialize message into buffer
00068 @param buff: buffer
00069 @type buff: StringIO
00070 """
00071 try:
00072 _x = self
00073 buff.write(_struct_2I2i.pack(_x.t.secs, _x.t.nsecs, _x.d.secs, _x.d.nsecs))
00074 _x = self.str_msg.data
00075 length = len(_x)
00076 buff.write(struct.pack('<I%ss'%length, length, _x))
00077 length = len(self.str_msg_array)
00078 buff.write(_struct_I.pack(length))
00079 for val1 in self.str_msg_array:
00080 _x = val1.data
00081 length = len(_x)
00082 buff.write(struct.pack('<I%ss'%length, length, _x))
00083 buff.write(_struct_i.pack(self.i32))
00084 except struct.error, se: self._check_types(se)
00085 except TypeError, te: self._check_types(te)
00086
00087 def deserialize(self, str):
00088 """
00089 unpack serialized message in str into this message instance
00090 @param str: byte array of serialized message
00091 @type str: str
00092 """
00093 try:
00094 if self.t is None:
00095 self.t = roslib.rostime.Time()
00096 if self.d is None:
00097 self.d = roslib.rostime.Duration()
00098 if self.str_msg is None:
00099 self.str_msg = std_msgs.msg.String()
00100 end = 0
00101 _x = self
00102 start = end
00103 end += 16
00104 (_x.t.secs, _x.t.nsecs, _x.d.secs, _x.d.nsecs,) = _struct_2I2i.unpack(str[start:end])
00105 start = end
00106 end += 4
00107 (length,) = _struct_I.unpack(str[start:end])
00108 start = end
00109 end += length
00110 self.str_msg.data = str[start:end]
00111 start = end
00112 end += 4
00113 (length,) = _struct_I.unpack(str[start:end])
00114 self.str_msg_array = []
00115 for i in xrange(0, length):
00116 val1 = std_msgs.msg.String()
00117 start = end
00118 end += 4
00119 (length,) = _struct_I.unpack(str[start:end])
00120 start = end
00121 end += length
00122 val1.data = str[start:end]
00123 self.str_msg_array.append(val1)
00124 start = end
00125 end += 4
00126 (self.i32,) = _struct_i.unpack(str[start:end])
00127 self.t.canon()
00128 self.d.canon()
00129 return self
00130 except struct.error, e:
00131 raise roslib.message.DeserializationError(e)
00132
00133
00134 def serialize_numpy(self, buff, numpy):
00135 """
00136 serialize message with numpy array types into buffer
00137 @param buff: buffer
00138 @type buff: StringIO
00139 @param numpy: numpy python module
00140 @type numpy module
00141 """
00142 try:
00143 _x = self
00144 buff.write(_struct_2I2i.pack(_x.t.secs, _x.t.nsecs, _x.d.secs, _x.d.nsecs))
00145 _x = self.str_msg.data
00146 length = len(_x)
00147 buff.write(struct.pack('<I%ss'%length, length, _x))
00148 length = len(self.str_msg_array)
00149 buff.write(_struct_I.pack(length))
00150 for val1 in self.str_msg_array:
00151 _x = val1.data
00152 length = len(_x)
00153 buff.write(struct.pack('<I%ss'%length, length, _x))
00154 buff.write(_struct_i.pack(self.i32))
00155 except struct.error, se: self._check_types(se)
00156 except TypeError, te: self._check_types(te)
00157
00158 def deserialize_numpy(self, str, numpy):
00159 """
00160 unpack serialized message in str into this message instance using numpy for array types
00161 @param str: byte array of serialized message
00162 @type str: str
00163 @param numpy: numpy python module
00164 @type numpy: module
00165 """
00166 try:
00167 if self.t is None:
00168 self.t = roslib.rostime.Time()
00169 if self.d is None:
00170 self.d = roslib.rostime.Duration()
00171 if self.str_msg is None:
00172 self.str_msg = std_msgs.msg.String()
00173 end = 0
00174 _x = self
00175 start = end
00176 end += 16
00177 (_x.t.secs, _x.t.nsecs, _x.d.secs, _x.d.nsecs,) = _struct_2I2i.unpack(str[start:end])
00178 start = end
00179 end += 4
00180 (length,) = _struct_I.unpack(str[start:end])
00181 start = end
00182 end += length
00183 self.str_msg.data = str[start:end]
00184 start = end
00185 end += 4
00186 (length,) = _struct_I.unpack(str[start:end])
00187 self.str_msg_array = []
00188 for i in xrange(0, length):
00189 val1 = std_msgs.msg.String()
00190 start = end
00191 end += 4
00192 (length,) = _struct_I.unpack(str[start:end])
00193 start = end
00194 end += length
00195 val1.data = str[start:end]
00196 self.str_msg_array.append(val1)
00197 start = end
00198 end += 4
00199 (self.i32,) = _struct_i.unpack(str[start:end])
00200 self.t.canon()
00201 self.d.canon()
00202 return self
00203 except struct.error, e:
00204 raise roslib.message.DeserializationError(e)
00205
00206 _struct_I = roslib.message.struct_I
00207 _struct_2I2i = struct.Struct("<2I2i")
00208 _struct_i = struct.Struct("<i")