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