_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(se)
00086     except TypeError as te: self._check_types(te)
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       if python3:
00104         self.dest = str[start:end].decode('utf-8')
00105       else:
00106         self.dest = str[start:end]
00107       _x = self
00108       start = end
00109       end += 2
00110       (_x.priority, _x.deadline,) = _struct_2B.unpack(str[start:end])
00111       start = end
00112       end += 4
00113       (length,) = _struct_I.unpack(str[start:end])
00114       start = end
00115       end += length
00116       if python3:
00117         self.sub_topic = str[start:end].decode('utf-8')
00118       else:
00119         self.sub_topic = str[start:end]
00120       return self
00121     except struct.error as e:
00122       raise genpy.DeserializationError(e) #most likely buffer underfill
00123 
00124 
00125   def serialize_numpy(self, buff, numpy):
00126     """
00127     serialize message with numpy array types into buffer
00128     :param buff: buffer, ``StringIO``
00129     :param numpy: numpy python module
00130     """
00131     try:
00132       buff.write(_struct_B.pack(self.source))
00133       _x = self.dest
00134       length = len(_x)
00135       # - if encoded as a list instead, serialize as bytes instead of string
00136       if type(_x) in [list, tuple]:
00137         buff.write(struct.pack('<I%sB'%length, length, *_x))
00138       else:
00139         buff.write(struct.pack('<I%ss'%length, length, _x))
00140       _x = self
00141       buff.write(_struct_2B.pack(_x.priority, _x.deadline))
00142       _x = self.sub_topic
00143       length = len(_x)
00144       if python3 or type(_x) == unicode:
00145         _x = _x.encode('utf-8')
00146         length = len(_x)
00147       buff.write(struct.pack('<I%ss'%length, length, _x))
00148     except struct.error as se: self._check_types(se)
00149     except TypeError as te: self._check_types(te)
00150 
00151   def deserialize_numpy(self, str, numpy):
00152     """
00153     unpack serialized message in str into this message instance using numpy for array types
00154     :param str: byte array of serialized message, ``str``
00155     :param numpy: numpy python module
00156     """
00157     try:
00158       end = 0
00159       start = end
00160       end += 1
00161       (self.source,) = _struct_B.unpack(str[start:end])
00162       start = end
00163       end += 4
00164       (length,) = _struct_I.unpack(str[start:end])
00165       start = end
00166       end += length
00167       if python3:
00168         self.dest = str[start:end].decode('utf-8')
00169       else:
00170         self.dest = str[start:end]
00171       _x = self
00172       start = end
00173       end += 2
00174       (_x.priority, _x.deadline,) = _struct_2B.unpack(str[start:end])
00175       start = end
00176       end += 4
00177       (length,) = _struct_I.unpack(str[start:end])
00178       start = end
00179       end += length
00180       if python3:
00181         self.sub_topic = str[start:end].decode('utf-8')
00182       else:
00183         self.sub_topic = str[start:end]
00184       return self
00185     except struct.error as e:
00186       raise genpy.DeserializationError(e) #most likely buffer underfill
00187 
00188 _struct_I = genpy.struct_I
00189 _struct_B = struct.Struct("<B")
00190 _struct_2B = struct.Struct("<2B")


ros_rt_wmp_msgs
Author(s): Pablo Urcola
autogenerated on Fri Jan 3 2014 12:07:44