_WMPHeader.py
Go to the documentation of this file.
00001 """autogenerated by genpy from ros_rt_wmp_msgs/WMPHeader.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 WMPHeader(genpy.Message):
00009   _md5sum = "9bd25a24cf41c1aa3862b0720ca415b7"
00010   _type = "ros_rt_wmp_msgs/WMPHeader"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """uint8 source
00013 uint8[] dest
00014 uint8 priority
00015 uint8 deadline
00016 string sub_topic
00017 
00018 
00019 """
00020   __slots__ = ['source','dest','priority','deadline','sub_topic']
00021   _slot_types = ['uint8','uint8[]','uint8','uint8','string']
00022 
00023   def __init__(self, *args, **kwds):
00024     """
00025     Constructor. Any message fields that are implicitly/explicitly
00026     set to None will be assigned a default value. The recommend
00027     use is keyword arguments as this is more robust to future message
00028     changes.  You cannot mix in-order arguments and keyword arguments.
00029 
00030     The available fields are:
00031        source,dest,priority,deadline,sub_topic
00032 
00033     :param args: complete set of field values, in .msg order
00034     :param kwds: use keyword arguments corresponding to message field names
00035     to set specific fields.
00036     """
00037     if args or kwds:
00038       super(WMPHeader, self).__init__(*args, **kwds)
00039       #message fields cannot be None, assign default values for those that are
00040       if self.source is None:
00041         self.source = 0
00042       if self.dest is None:
00043         self.dest = ''
00044       if self.priority is None:
00045         self.priority = 0
00046       if self.deadline is None:
00047         self.deadline = 0
00048       if self.sub_topic is None:
00049         self.sub_topic = ''
00050     else:
00051       self.source = 0
00052       self.dest = ''
00053       self.priority = 0
00054       self.deadline = 0
00055       self.sub_topic = ''
00056 
00057   def _get_types(self):
00058     """
00059     internal API method
00060     """
00061     return self._slot_types
00062 
00063   def serialize(self, buff):
00064     """
00065     serialize message into buffer
00066     :param buff: buffer, ``StringIO``
00067     """
00068     try:
00069       buff.write(_struct_B.pack(self.source))
00070       _x = self.dest
00071       length = len(_x)
00072       # - if encoded as a list instead, serialize as bytes instead of string
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       _x = self
00078       buff.write(_struct_2B.pack(_x.priority, _x.deadline))
00079       _x = self.sub_topic
00080       length = len(_x)
00081       if python3 or type(_x) == unicode:
00082         _x = _x.encode('utf-8')
00083         length = len(_x)
00084       buff.write(struct.pack('<I%ss'%length, length, _x))
00085     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00086     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00087 
00088   def deserialize(self, str):
00089     """
00090     unpack serialized message in str into this message instance
00091     :param str: byte array of serialized message, ``str``
00092     """
00093     try:
00094       end = 0
00095       start = end
00096       end += 1
00097       (self.source,) = _struct_B.unpack(str[start:end])
00098       start = end
00099       end += 4
00100       (length,) = _struct_I.unpack(str[start:end])
00101       start = end
00102       end += length
00103       self.dest = str[start:end]
00104       _x = self
00105       start = end
00106       end += 2
00107       (_x.priority, _x.deadline,) = _struct_2B.unpack(str[start:end])
00108       start = end
00109       end += 4
00110       (length,) = _struct_I.unpack(str[start:end])
00111       start = end
00112       end += length
00113       if python3:
00114         self.sub_topic = str[start:end].decode('utf-8')
00115       else:
00116         self.sub_topic = str[start:end]
00117       return self
00118     except struct.error as e:
00119       raise genpy.DeserializationError(e) #most likely buffer underfill
00120 
00121 
00122   def serialize_numpy(self, buff, numpy):
00123     """
00124     serialize message with numpy array types into buffer
00125     :param buff: buffer, ``StringIO``
00126     :param numpy: numpy python module
00127     """
00128     try:
00129       buff.write(_struct_B.pack(self.source))
00130       _x = self.dest
00131       length = len(_x)
00132       # - if encoded as a list instead, serialize as bytes instead of string
00133       if type(_x) in [list, tuple]:
00134         buff.write(struct.pack('<I%sB'%length, length, *_x))
00135       else:
00136         buff.write(struct.pack('<I%ss'%length, length, _x))
00137       _x = self
00138       buff.write(_struct_2B.pack(_x.priority, _x.deadline))
00139       _x = self.sub_topic
00140       length = len(_x)
00141       if python3 or type(_x) == unicode:
00142         _x = _x.encode('utf-8')
00143         length = len(_x)
00144       buff.write(struct.pack('<I%ss'%length, length, _x))
00145     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00146     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00147 
00148   def deserialize_numpy(self, str, numpy):
00149     """
00150     unpack serialized message in str into this message instance using numpy for array types
00151     :param str: byte array of serialized message, ``str``
00152     :param numpy: numpy python module
00153     """
00154     try:
00155       end = 0
00156       start = end
00157       end += 1
00158       (self.source,) = _struct_B.unpack(str[start:end])
00159       start = end
00160       end += 4
00161       (length,) = _struct_I.unpack(str[start:end])
00162       start = end
00163       end += length
00164       self.dest = str[start:end]
00165       _x = self
00166       start = end
00167       end += 2
00168       (_x.priority, _x.deadline,) = _struct_2B.unpack(str[start:end])
00169       start = end
00170       end += 4
00171       (length,) = _struct_I.unpack(str[start:end])
00172       start = end
00173       end += length
00174       if python3:
00175         self.sub_topic = str[start:end].decode('utf-8')
00176       else:
00177         self.sub_topic = str[start:end]
00178       return self
00179     except struct.error as e:
00180       raise genpy.DeserializationError(e) #most likely buffer underfill
00181 
00182 _struct_I = genpy.struct_I
00183 _struct_B = struct.Struct("<B")
00184 _struct_2B = struct.Struct("<2B")


ros_rt_wmp_msgs
Author(s): Pablo Urcola
autogenerated on Mon Oct 6 2014 08:26:58