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