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