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