_CommonHeader.py
Go to the documentation of this file.
00001 """autogenerated by genpy from applanix_msgs/CommonHeader.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 CommonHeader(genpy.Message):
00009   _md5sum = "cb573def7f5977ee910df3469d33c060"
00010   _type = "applanix_msgs/CommonHeader"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """string START_GROUP=$GRP
00013 string START_MESSAGE=$MSG
00014 
00015 uint8[4] start
00016 uint16 id
00017 uint16 length
00018 
00019 """
00020   # Pseudo-constants
00021   START_GROUP = '$GRP'
00022   START_MESSAGE = '$MSG'
00023 
00024   __slots__ = ['start','id','length']
00025   _slot_types = ['uint8[4]','uint16','uint16']
00026 
00027   def __init__(self, *args, **kwds):
00028     """
00029     Constructor. Any message fields that are implicitly/explicitly
00030     set to None will be assigned a default value. The recommend
00031     use is keyword arguments as this is more robust to future message
00032     changes.  You cannot mix in-order arguments and keyword arguments.
00033 
00034     The available fields are:
00035        start,id,length
00036 
00037     :param args: complete set of field values, in .msg order
00038     :param kwds: use keyword arguments corresponding to message field names
00039     to set specific fields.
00040     """
00041     if args or kwds:
00042       super(CommonHeader, self).__init__(*args, **kwds)
00043       #message fields cannot be None, assign default values for those that are
00044       if self.start is None:
00045         self.start = chr(0)*4
00046       if self.id is None:
00047         self.id = 0
00048       if self.length is None:
00049         self.length = 0
00050     else:
00051       self.start = chr(0)*4
00052       self.id = 0
00053       self.length = 0
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, ``StringIO``
00065     """
00066     try:
00067       _x = self.start
00068       # - if encoded as a list instead, serialize as bytes instead of string
00069       if type(_x) in [list, tuple]:
00070         buff.write(_struct_4B.pack(*_x))
00071       else:
00072         buff.write(_struct_4s.pack(_x))
00073       _x = self
00074       buff.write(_struct_2H.pack(_x.id, _x.length))
00075     except struct.error as se: self._check_types(se)
00076     except TypeError as te: self._check_types(te)
00077 
00078   def deserialize(self, str):
00079     """
00080     unpack serialized message in str into this message instance
00081     :param str: byte array of serialized message, ``str``
00082     """
00083     try:
00084       end = 0
00085       start = end
00086       end += 4
00087       self.start = str[start:end]
00088       _x = self
00089       start = end
00090       end += 4
00091       (_x.id, _x.length,) = _struct_2H.unpack(str[start:end])
00092       return self
00093     except struct.error as e:
00094       raise genpy.DeserializationError(e) #most likely buffer underfill
00095 
00096 
00097   def serialize_numpy(self, buff, numpy):
00098     """
00099     serialize message with numpy array types into buffer
00100     :param buff: buffer, ``StringIO``
00101     :param numpy: numpy python module
00102     """
00103     try:
00104       _x = self.start
00105       # - if encoded as a list instead, serialize as bytes instead of string
00106       if type(_x) in [list, tuple]:
00107         buff.write(_struct_4B.pack(*_x))
00108       else:
00109         buff.write(_struct_4s.pack(_x))
00110       _x = self
00111       buff.write(_struct_2H.pack(_x.id, _x.length))
00112     except struct.error as se: self._check_types(se)
00113     except TypeError as te: self._check_types(te)
00114 
00115   def deserialize_numpy(self, str, numpy):
00116     """
00117     unpack serialized message in str into this message instance using numpy for array types
00118     :param str: byte array of serialized message, ``str``
00119     :param numpy: numpy python module
00120     """
00121     try:
00122       end = 0
00123       start = end
00124       end += 4
00125       self.start = str[start:end]
00126       _x = self
00127       start = end
00128       end += 4
00129       (_x.id, _x.length,) = _struct_2H.unpack(str[start:end])
00130       return self
00131     except struct.error as e:
00132       raise genpy.DeserializationError(e) #most likely buffer underfill
00133 
00134 _struct_I = genpy.struct_I
00135 _struct_2H = struct.Struct("<2H")
00136 _struct_4B = struct.Struct("<4B")
00137 _struct_4s = struct.Struct("<4s")


applanix_msgs
Author(s): Mike Purvis
autogenerated on Thu Jan 2 2014 11:04:51