00001 """autogenerated by genmsg_py from SameSubMsg2.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class SameSubMsg2(roslib.message.Message):
00007 _md5sum = "49145a54e4be1a218629e518575a0bf3"
00008 _type = "test_roslib_comm/SameSubMsg2"
00009 _has_header = False
00010 _full_text = """int32 a
00011 float32 b
00012 string c
00013 uint64[10] d
00014 float64[] e
00015 """
00016 __slots__ = ['a','b','c','d','e']
00017 _slot_types = ['int32','float32','string','uint64[10]','float64[]']
00018
00019 def __init__(self, *args, **kwds):
00020 """
00021 Constructor. Any message fields that are implicitly/explicitly
00022 set to None will be assigned a default value. The recommend
00023 use is keyword arguments as this is more robust to future message
00024 changes. You cannot mix in-order arguments and keyword arguments.
00025
00026 The available fields are:
00027 a,b,c,d,e
00028
00029 @param args: complete set of field values, in .msg order
00030 @param kwds: use keyword arguments corresponding to message field names
00031 to set specific fields.
00032 """
00033 if args or kwds:
00034 super(SameSubMsg2, self).__init__(*args, **kwds)
00035
00036 if self.a is None:
00037 self.a = 0
00038 if self.b is None:
00039 self.b = 0.
00040 if self.c is None:
00041 self.c = ''
00042 if self.d is None:
00043 self.d = [0,0,0,0,0,0,0,0,0,0]
00044 if self.e is None:
00045 self.e = []
00046 else:
00047 self.a = 0
00048 self.b = 0.
00049 self.c = ''
00050 self.d = [0,0,0,0,0,0,0,0,0,0]
00051 self.e = []
00052
00053 def _get_types(self):
00054 """
00055 internal API method
00056 """
00057 return self._slot_types
00058
00059 def serialize(self, buff):
00060 """
00061 serialize message into buffer
00062 @param buff: buffer
00063 @type buff: StringIO
00064 """
00065 try:
00066 _x = self
00067 buff.write(_struct_if.pack(_x.a, _x.b))
00068 _x = self.c
00069 length = len(_x)
00070 buff.write(struct.pack('<I%ss'%length, length, _x))
00071 buff.write(_struct_10Q.pack(*self.d))
00072 length = len(self.e)
00073 buff.write(_struct_I.pack(length))
00074 pattern = '<%sd'%length
00075 buff.write(struct.pack(pattern, *self.e))
00076 except struct.error, se: self._check_types(se)
00077 except TypeError, te: self._check_types(te)
00078
00079 def deserialize(self, str):
00080 """
00081 unpack serialized message in str into this message instance
00082 @param str: byte array of serialized message
00083 @type str: str
00084 """
00085 try:
00086 end = 0
00087 _x = self
00088 start = end
00089 end += 8
00090 (_x.a, _x.b,) = _struct_if.unpack(str[start:end])
00091 start = end
00092 end += 4
00093 (length,) = _struct_I.unpack(str[start:end])
00094 start = end
00095 end += length
00096 self.c = str[start:end]
00097 start = end
00098 end += 80
00099 self.d = _struct_10Q.unpack(str[start:end])
00100 start = end
00101 end += 4
00102 (length,) = _struct_I.unpack(str[start:end])
00103 pattern = '<%sd'%length
00104 start = end
00105 end += struct.calcsize(pattern)
00106 self.e = struct.unpack(pattern, str[start:end])
00107 return self
00108 except struct.error, e:
00109 raise roslib.message.DeserializationError(e)
00110
00111
00112 def serialize_numpy(self, buff, numpy):
00113 """
00114 serialize message with numpy array types into buffer
00115 @param buff: buffer
00116 @type buff: StringIO
00117 @param numpy: numpy python module
00118 @type numpy module
00119 """
00120 try:
00121 _x = self
00122 buff.write(_struct_if.pack(_x.a, _x.b))
00123 _x = self.c
00124 length = len(_x)
00125 buff.write(struct.pack('<I%ss'%length, length, _x))
00126 buff.write(self.d.tostring())
00127 length = len(self.e)
00128 buff.write(_struct_I.pack(length))
00129 pattern = '<%sd'%length
00130 buff.write(self.e.tostring())
00131 except struct.error, se: self._check_types(se)
00132 except TypeError, te: self._check_types(te)
00133
00134 def deserialize_numpy(self, str, numpy):
00135 """
00136 unpack serialized message in str into this message instance using numpy for array types
00137 @param str: byte array of serialized message
00138 @type str: str
00139 @param numpy: numpy python module
00140 @type numpy: module
00141 """
00142 try:
00143 end = 0
00144 _x = self
00145 start = end
00146 end += 8
00147 (_x.a, _x.b,) = _struct_if.unpack(str[start:end])
00148 start = end
00149 end += 4
00150 (length,) = _struct_I.unpack(str[start:end])
00151 start = end
00152 end += length
00153 self.c = str[start:end]
00154 start = end
00155 end += 80
00156 self.d = numpy.frombuffer(str[start:end], dtype=numpy.uint64, count=10)
00157 start = end
00158 end += 4
00159 (length,) = _struct_I.unpack(str[start:end])
00160 pattern = '<%sd'%length
00161 start = end
00162 end += struct.calcsize(pattern)
00163 self.e = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00164 return self
00165 except struct.error, e:
00166 raise roslib.message.DeserializationError(e)
00167
00168 _struct_I = roslib.message.struct_I
00169 _struct_10Q = struct.Struct("<10Q")
00170 _struct_if = struct.Struct("<if")