_Poison.py
Go to the documentation of this file.
00001 """autogenerated by genpy from brics_actuator/Poison.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 Poison(genpy.Message):
00009   _md5sum = "b16420a6fd4cc18f64b776ee10e98bb0"
00010   _type = "brics_actuator/Poison"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """string originator             # node id
00013 string description              # encoding still an issue
00014 float32 qos                     # reliability of the channel
00015                                 # 0..1 where 1 means healthy
00016 
00017 """
00018   __slots__ = ['originator','description','qos']
00019   _slot_types = ['string','string','float32']
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        originator,description,qos
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(Poison, self).__init__(*args, **kwds)
00037       #message fields cannot be None, assign default values for those that are
00038       if self.originator is None:
00039         self.originator = ''
00040       if self.description is None:
00041         self.description = ''
00042       if self.qos is None:
00043         self.qos = 0.
00044     else:
00045       self.originator = ''
00046       self.description = ''
00047       self.qos = 0.
00048 
00049   def _get_types(self):
00050     """
00051     internal API method
00052     """
00053     return self._slot_types
00054 
00055   def serialize(self, buff):
00056     """
00057     serialize message into buffer
00058     :param buff: buffer, ``StringIO``
00059     """
00060     try:
00061       _x = self.originator
00062       length = len(_x)
00063       if python3 or type(_x) == unicode:
00064         _x = _x.encode('utf-8')
00065         length = len(_x)
00066       buff.write(struct.pack('<I%ss'%length, length, _x))
00067       _x = self.description
00068       length = len(_x)
00069       if python3 or type(_x) == unicode:
00070         _x = _x.encode('utf-8')
00071         length = len(_x)
00072       buff.write(struct.pack('<I%ss'%length, length, _x))
00073       buff.write(_struct_f.pack(self.qos))
00074     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00075     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00076 
00077   def deserialize(self, str):
00078     """
00079     unpack serialized message in str into this message instance
00080     :param str: byte array of serialized message, ``str``
00081     """
00082     try:
00083       end = 0
00084       start = end
00085       end += 4
00086       (length,) = _struct_I.unpack(str[start:end])
00087       start = end
00088       end += length
00089       if python3:
00090         self.originator = str[start:end].decode('utf-8')
00091       else:
00092         self.originator = str[start:end]
00093       start = end
00094       end += 4
00095       (length,) = _struct_I.unpack(str[start:end])
00096       start = end
00097       end += length
00098       if python3:
00099         self.description = str[start:end].decode('utf-8')
00100       else:
00101         self.description = str[start:end]
00102       start = end
00103       end += 4
00104       (self.qos,) = _struct_f.unpack(str[start:end])
00105       return self
00106     except struct.error as e:
00107       raise genpy.DeserializationError(e) #most likely buffer underfill
00108 
00109 
00110   def serialize_numpy(self, buff, numpy):
00111     """
00112     serialize message with numpy array types into buffer
00113     :param buff: buffer, ``StringIO``
00114     :param numpy: numpy python module
00115     """
00116     try:
00117       _x = self.originator
00118       length = len(_x)
00119       if python3 or type(_x) == unicode:
00120         _x = _x.encode('utf-8')
00121         length = len(_x)
00122       buff.write(struct.pack('<I%ss'%length, length, _x))
00123       _x = self.description
00124       length = len(_x)
00125       if python3 or type(_x) == unicode:
00126         _x = _x.encode('utf-8')
00127         length = len(_x)
00128       buff.write(struct.pack('<I%ss'%length, length, _x))
00129       buff.write(_struct_f.pack(self.qos))
00130     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00131     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00132 
00133   def deserialize_numpy(self, str, numpy):
00134     """
00135     unpack serialized message in str into this message instance using numpy for array types
00136     :param str: byte array of serialized message, ``str``
00137     :param numpy: numpy python module
00138     """
00139     try:
00140       end = 0
00141       start = end
00142       end += 4
00143       (length,) = _struct_I.unpack(str[start:end])
00144       start = end
00145       end += length
00146       if python3:
00147         self.originator = str[start:end].decode('utf-8')
00148       else:
00149         self.originator = str[start:end]
00150       start = end
00151       end += 4
00152       (length,) = _struct_I.unpack(str[start:end])
00153       start = end
00154       end += length
00155       if python3:
00156         self.description = str[start:end].decode('utf-8')
00157       else:
00158         self.description = str[start:end]
00159       start = end
00160       end += 4
00161       (self.qos,) = _struct_f.unpack(str[start:end])
00162       return self
00163     except struct.error as e:
00164       raise genpy.DeserializationError(e) #most likely buffer underfill
00165 
00166 _struct_I = genpy.struct_I
00167 _struct_f = struct.Struct("<f")


brics_actuator
Author(s): Alexander Bubeck
autogenerated on Sun Oct 5 2014 22:58:19