_Monitors.py
Go to the documentation of this file.
00001 """autogenerated by genpy from esc_ros/Monitors.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class Monitors(genpy.Message):
00009   _md5sum = "d31933323b456d50ff33ea52591fd5f5"
00010   _type = "esc_ros/Monitors"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """string[]  names
00013 float32[] values
00014 
00015 """
00016   __slots__ = ['names','values']
00017   _slot_types = ['string[]','float32[]']
00018 
00019   def __init__(self, *args, **kwds):
00020     """
00021     Constructor. Any message fields that are implicitly/explicitly
00022     set to None will be assigned a default value. The recommend
00023     use is keyword arguments as this is more robust to future message
00024     changes.  You cannot mix in-order arguments and keyword arguments.
00025 
00026     The available fields are:
00027        names,values
00028 
00029     :param args: complete set of field values, in .msg order
00030     :param kwds: use keyword arguments corresponding to message field names
00031     to set specific fields.
00032     """
00033     if args or kwds:
00034       super(Monitors, self).__init__(*args, **kwds)
00035       #message fields cannot be None, assign default values for those that are
00036       if self.names is None:
00037         self.names = []
00038       if self.values is None:
00039         self.values = []
00040     else:
00041       self.names = []
00042       self.values = []
00043 
00044   def _get_types(self):
00045     """
00046     internal API method
00047     """
00048     return self._slot_types
00049 
00050   def serialize(self, buff):
00051     """
00052     serialize message into buffer
00053     :param buff: buffer, ``StringIO``
00054     """
00055     try:
00056       length = len(self.names)
00057       buff.write(_struct_I.pack(length))
00058       for val1 in self.names:
00059         length = len(val1)
00060         if python3 or type(val1) == unicode:
00061           val1 = val1.encode('utf-8')
00062           length = len(val1)
00063         buff.write(struct.pack('<I%ss'%length, length, val1))
00064       length = len(self.values)
00065       buff.write(_struct_I.pack(length))
00066       pattern = '<%sf'%length
00067       buff.write(struct.pack(pattern, *self.values))
00068     except struct.error as se: self._check_types(se)
00069     except TypeError as te: self._check_types(te)
00070 
00071   def deserialize(self, str):
00072     """
00073     unpack serialized message in str into this message instance
00074     :param str: byte array of serialized message, ``str``
00075     """
00076     try:
00077       end = 0
00078       start = end
00079       end += 4
00080       (length,) = _struct_I.unpack(str[start:end])
00081       self.names = []
00082       for i in range(0, length):
00083         start = end
00084         end += 4
00085         (length,) = _struct_I.unpack(str[start:end])
00086         start = end
00087         end += length
00088         if python3:
00089           val1 = str[start:end].decode('utf-8')
00090         else:
00091           val1 = str[start:end]
00092         self.names.append(val1)
00093       start = end
00094       end += 4
00095       (length,) = _struct_I.unpack(str[start:end])
00096       pattern = '<%sf'%length
00097       start = end
00098       end += struct.calcsize(pattern)
00099       self.values = struct.unpack(pattern, str[start:end])
00100       return self
00101     except struct.error as e:
00102       raise genpy.DeserializationError(e) #most likely buffer underfill
00103 
00104 
00105   def serialize_numpy(self, buff, numpy):
00106     """
00107     serialize message with numpy array types into buffer
00108     :param buff: buffer, ``StringIO``
00109     :param numpy: numpy python module
00110     """
00111     try:
00112       length = len(self.names)
00113       buff.write(_struct_I.pack(length))
00114       for val1 in self.names:
00115         length = len(val1)
00116         if python3 or type(val1) == unicode:
00117           val1 = val1.encode('utf-8')
00118           length = len(val1)
00119         buff.write(struct.pack('<I%ss'%length, length, val1))
00120       length = len(self.values)
00121       buff.write(_struct_I.pack(length))
00122       pattern = '<%sf'%length
00123       buff.write(self.values.tostring())
00124     except struct.error as se: self._check_types(se)
00125     except TypeError as te: self._check_types(te)
00126 
00127   def deserialize_numpy(self, str, numpy):
00128     """
00129     unpack serialized message in str into this message instance using numpy for array types
00130     :param str: byte array of serialized message, ``str``
00131     :param numpy: numpy python module
00132     """
00133     try:
00134       end = 0
00135       start = end
00136       end += 4
00137       (length,) = _struct_I.unpack(str[start:end])
00138       self.names = []
00139       for i in range(0, length):
00140         start = end
00141         end += 4
00142         (length,) = _struct_I.unpack(str[start:end])
00143         start = end
00144         end += length
00145         if python3:
00146           val1 = str[start:end].decode('utf-8')
00147         else:
00148           val1 = str[start:end]
00149         self.names.append(val1)
00150       start = end
00151       end += 4
00152       (length,) = _struct_I.unpack(str[start:end])
00153       pattern = '<%sf'%length
00154       start = end
00155       end += struct.calcsize(pattern)
00156       self.values = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00157       return self
00158     except struct.error as e:
00159       raise genpy.DeserializationError(e) #most likely buffer underfill
00160 
00161 _struct_I = genpy.struct_I


esc_ros
Author(s): Berk Calli and Wouter Caarls
autogenerated on Sun Jan 5 2014 11:07:02