00001 """autogenerated by genmsg_py from ThroughputMessage.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class ThroughputMessage(roslib.message.Message):
00007 _md5sum = "dda33390139e301b6c212139192418ca"
00008 _type = "perf_roscpp/ThroughputMessage"
00009 _has_header = False
00010 _full_text = """uint8[] array
00011
00012
00013 """
00014 __slots__ = ['array']
00015 _slot_types = ['uint8[]']
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 array
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(ThroughputMessage, self).__init__(*args, **kwds)
00033
00034 if self.array is None:
00035 self.array = ''
00036 else:
00037 self.array = ''
00038
00039 def _get_types(self):
00040 """
00041 internal API method
00042 """
00043 return self._slot_types
00044
00045 def serialize(self, buff):
00046 """
00047 serialize message into buffer
00048 @param buff: buffer
00049 @type buff: StringIO
00050 """
00051 try:
00052 _x = self.array
00053 length = len(_x)
00054
00055 if type(_x) in [list, tuple]:
00056 buff.write(struct.pack('<I%sB'%length, length, *_x))
00057 else:
00058 buff.write(struct.pack('<I%ss'%length, length, _x))
00059 except struct.error, se: self._check_types(se)
00060 except TypeError, te: self._check_types(te)
00061
00062 def deserialize(self, str):
00063 """
00064 unpack serialized message in str into this message instance
00065 @param str: byte array of serialized message
00066 @type str: str
00067 """
00068 try:
00069 end = 0
00070 start = end
00071 end += 4
00072 (length,) = _struct_I.unpack(str[start:end])
00073 start = end
00074 end += length
00075 self.array = str[start:end]
00076 return self
00077 except struct.error, e:
00078 raise roslib.message.DeserializationError(e)
00079
00080
00081 def serialize_numpy(self, buff, numpy):
00082 """
00083 serialize message with numpy array types into buffer
00084 @param buff: buffer
00085 @type buff: StringIO
00086 @param numpy: numpy python module
00087 @type numpy module
00088 """
00089 try:
00090 _x = self.array
00091 length = len(_x)
00092
00093 if type(_x) in [list, tuple]:
00094 buff.write(struct.pack('<I%sB'%length, length, *_x))
00095 else:
00096 buff.write(struct.pack('<I%ss'%length, length, _x))
00097 except struct.error, se: self._check_types(se)
00098 except TypeError, te: self._check_types(te)
00099
00100 def deserialize_numpy(self, str, numpy):
00101 """
00102 unpack serialized message in str into this message instance using numpy for array types
00103 @param str: byte array of serialized message
00104 @type str: str
00105 @param numpy: numpy python module
00106 @type numpy: module
00107 """
00108 try:
00109 end = 0
00110 start = end
00111 end += 4
00112 (length,) = _struct_I.unpack(str[start:end])
00113 start = end
00114 end += length
00115 self.array = str[start:end]
00116 return self
00117 except struct.error, e:
00118 raise roslib.message.DeserializationError(e)
00119
00120 _struct_I = roslib.message.struct_I