00001 """autogenerated by genmsg_py from LatencyMessage.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class LatencyMessage(roslib.message.Message):
00007 _md5sum = "be90d117303321f392404ed7edeb7c8c"
00008 _type = "perf_roscpp/LatencyMessage"
00009 _has_header = False
00010 _full_text = """float64 publish_time
00011 float64 receipt_time
00012 uint64 count
00013 uint32 thread_index
00014 uint8[] array
00015
00016
00017 """
00018 __slots__ = ['publish_time','receipt_time','count','thread_index','array']
00019 _slot_types = ['float64','float64','uint64','uint32','uint8[]']
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 publish_time,receipt_time,count,thread_index,array
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(LatencyMessage, self).__init__(*args, **kwds)
00037
00038 if self.publish_time is None:
00039 self.publish_time = 0.
00040 if self.receipt_time is None:
00041 self.receipt_time = 0.
00042 if self.count is None:
00043 self.count = 0
00044 if self.thread_index is None:
00045 self.thread_index = 0
00046 if self.array is None:
00047 self.array = ''
00048 else:
00049 self.publish_time = 0.
00050 self.receipt_time = 0.
00051 self.count = 0
00052 self.thread_index = 0
00053 self.array = ''
00054
00055 def _get_types(self):
00056 """
00057 internal API method
00058 """
00059 return self._slot_types
00060
00061 def serialize(self, buff):
00062 """
00063 serialize message into buffer
00064 @param buff: buffer
00065 @type buff: StringIO
00066 """
00067 try:
00068 _x = self
00069 buff.write(_struct_2dQI.pack(_x.publish_time, _x.receipt_time, _x.count, _x.thread_index))
00070 _x = self.array
00071 length = len(_x)
00072
00073 if type(_x) in [list, tuple]:
00074 buff.write(struct.pack('<I%sB'%length, length, *_x))
00075 else:
00076 buff.write(struct.pack('<I%ss'%length, length, _x))
00077 except struct.error, se: self._check_types(se)
00078 except TypeError, te: self._check_types(te)
00079
00080 def deserialize(self, str):
00081 """
00082 unpack serialized message in str into this message instance
00083 @param str: byte array of serialized message
00084 @type str: str
00085 """
00086 try:
00087 end = 0
00088 _x = self
00089 start = end
00090 end += 28
00091 (_x.publish_time, _x.receipt_time, _x.count, _x.thread_index,) = _struct_2dQI.unpack(str[start:end])
00092 start = end
00093 end += 4
00094 (length,) = _struct_I.unpack(str[start:end])
00095 start = end
00096 end += length
00097 self.array = str[start:end]
00098 return self
00099 except struct.error, e:
00100 raise roslib.message.DeserializationError(e)
00101
00102
00103 def serialize_numpy(self, buff, numpy):
00104 """
00105 serialize message with numpy array types into buffer
00106 @param buff: buffer
00107 @type buff: StringIO
00108 @param numpy: numpy python module
00109 @type numpy module
00110 """
00111 try:
00112 _x = self
00113 buff.write(_struct_2dQI.pack(_x.publish_time, _x.receipt_time, _x.count, _x.thread_index))
00114 _x = self.array
00115 length = len(_x)
00116
00117 if type(_x) in [list, tuple]:
00118 buff.write(struct.pack('<I%sB'%length, length, *_x))
00119 else:
00120 buff.write(struct.pack('<I%ss'%length, length, _x))
00121 except struct.error, se: self._check_types(se)
00122 except TypeError, te: self._check_types(te)
00123
00124 def deserialize_numpy(self, str, numpy):
00125 """
00126 unpack serialized message in str into this message instance using numpy for array types
00127 @param str: byte array of serialized message
00128 @type str: str
00129 @param numpy: numpy python module
00130 @type numpy: module
00131 """
00132 try:
00133 end = 0
00134 _x = self
00135 start = end
00136 end += 28
00137 (_x.publish_time, _x.receipt_time, _x.count, _x.thread_index,) = _struct_2dQI.unpack(str[start:end])
00138 start = end
00139 end += 4
00140 (length,) = _struct_I.unpack(str[start:end])
00141 start = end
00142 end += length
00143 self.array = str[start:end]
00144 return self
00145 except struct.error, e:
00146 raise roslib.message.DeserializationError(e)
00147
00148 _struct_I = roslib.message.struct_I
00149 _struct_2dQI = struct.Struct("<2dQI")