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