00001 """autogenerated by genmsg_py from FixedLengthStringArray.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class FixedLengthStringArray(roslib.message.Message):
00007 _md5sum = "8e291ac046196a95bbe34c1555b382cc"
00008 _type = "test_roscpp_serialization/FixedLengthStringArray"
00009 _has_header = False
00010 _full_text = """string[5] foo
00011
00012 """
00013 __slots__ = ['foo']
00014 _slot_types = ['string[5]']
00015
00016 def __init__(self, *args, **kwds):
00017 """
00018 Constructor. Any message fields that are implicitly/explicitly
00019 set to None will be assigned a default value. The recommend
00020 use is keyword arguments as this is more robust to future message
00021 changes. You cannot mix in-order arguments and keyword arguments.
00022
00023 The available fields are:
00024 foo
00025
00026 @param args: complete set of field values, in .msg order
00027 @param kwds: use keyword arguments corresponding to message field names
00028 to set specific fields.
00029 """
00030 if args or kwds:
00031 super(FixedLengthStringArray, self).__init__(*args, **kwds)
00032
00033 if self.foo is None:
00034 self.foo = ['','','','','']
00035 else:
00036 self.foo = ['','','','','']
00037
00038 def _get_types(self):
00039 """
00040 internal API method
00041 """
00042 return self._slot_types
00043
00044 def serialize(self, buff):
00045 """
00046 serialize message into buffer
00047 @param buff: buffer
00048 @type buff: StringIO
00049 """
00050 try:
00051 for val1 in self.foo:
00052 length = len(val1)
00053 buff.write(struct.pack('<I%ss'%length, length, val1))
00054 except struct.error, se: self._check_types(se)
00055 except TypeError, te: self._check_types(te)
00056
00057 def deserialize(self, str):
00058 """
00059 unpack serialized message in str into this message instance
00060 @param str: byte array of serialized message
00061 @type str: str
00062 """
00063 try:
00064 end = 0
00065 self.foo = []
00066 for i in xrange(0, 5):
00067 start = end
00068 end += 4
00069 (length,) = _struct_I.unpack(str[start:end])
00070 start = end
00071 end += length
00072 val1 = str[start:end]
00073 self.foo.append(val1)
00074 return self
00075 except struct.error, e:
00076 raise roslib.message.DeserializationError(e)
00077
00078
00079 def serialize_numpy(self, buff, numpy):
00080 """
00081 serialize message with numpy array types into buffer
00082 @param buff: buffer
00083 @type buff: StringIO
00084 @param numpy: numpy python module
00085 @type numpy module
00086 """
00087 try:
00088 for val1 in self.foo:
00089 length = len(val1)
00090 buff.write(struct.pack('<I%ss'%length, length, val1))
00091 except struct.error, se: self._check_types(se)
00092 except TypeError, te: self._check_types(te)
00093
00094 def deserialize_numpy(self, str, numpy):
00095 """
00096 unpack serialized message in str into this message instance using numpy for array types
00097 @param str: byte array of serialized message
00098 @type str: str
00099 @param numpy: numpy python module
00100 @type numpy: module
00101 """
00102 try:
00103 end = 0
00104 self.foo = []
00105 for i in xrange(0, 5):
00106 start = end
00107 end += 4
00108 (length,) = _struct_I.unpack(str[start:end])
00109 start = end
00110 end += length
00111 val1 = str[start:end]
00112 self.foo.append(val1)
00113 return self
00114 except struct.error, e:
00115 raise roslib.message.DeserializationError(e)
00116
00117 _struct_I = roslib.message.struct_I