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