_classification_point.py
Go to the documentation of this file.
00001 """autogenerated by genpy from lfd_common/classification_point.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 import lfd_common.msg
00008 
00009 class classification_point(genpy.Message):
00010   _md5sum = "3bdd828e2a27174a2c1b8499df259193"
00011   _type = "lfd_common/classification_point"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """# The state vector for the given data point
00014 state s
00015 # The classification label for the given vector
00016 int32 l
00017 
00018 ================================================================================
00019 MSG: lfd_common/state
00020 # The state vector
00021 float32[] state_vector
00022 
00023 """
00024   __slots__ = ['s','l']
00025   _slot_types = ['lfd_common/state','int32']
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        s,l
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(classification_point, self).__init__(*args, **kwds)
00043       #message fields cannot be None, assign default values for those that are
00044       if self.s is None:
00045         self.s = lfd_common.msg.state()
00046       if self.l is None:
00047         self.l = 0
00048     else:
00049       self.s = lfd_common.msg.state()
00050       self.l = 0
00051 
00052   def _get_types(self):
00053     """
00054     internal API method
00055     """
00056     return self._slot_types
00057 
00058   def serialize(self, buff):
00059     """
00060     serialize message into buffer
00061     :param buff: buffer, ``StringIO``
00062     """
00063     try:
00064       length = len(self.s.state_vector)
00065       buff.write(_struct_I.pack(length))
00066       pattern = '<%sf'%length
00067       buff.write(struct.pack(pattern, *self.s.state_vector))
00068       buff.write(_struct_i.pack(self.l))
00069     except struct.error as se: self._check_types(se)
00070     except TypeError as te: self._check_types(te)
00071 
00072   def deserialize(self, str):
00073     """
00074     unpack serialized message in str into this message instance
00075     :param str: byte array of serialized message, ``str``
00076     """
00077     try:
00078       if self.s is None:
00079         self.s = lfd_common.msg.state()
00080       end = 0
00081       start = end
00082       end += 4
00083       (length,) = _struct_I.unpack(str[start:end])
00084       pattern = '<%sf'%length
00085       start = end
00086       end += struct.calcsize(pattern)
00087       self.s.state_vector = struct.unpack(pattern, str[start:end])
00088       start = end
00089       end += 4
00090       (self.l,) = _struct_i.unpack(str[start:end])
00091       return self
00092     except struct.error as e:
00093       raise genpy.DeserializationError(e) #most likely buffer underfill
00094 
00095 
00096   def serialize_numpy(self, buff, numpy):
00097     """
00098     serialize message with numpy array types into buffer
00099     :param buff: buffer, ``StringIO``
00100     :param numpy: numpy python module
00101     """
00102     try:
00103       length = len(self.s.state_vector)
00104       buff.write(_struct_I.pack(length))
00105       pattern = '<%sf'%length
00106       buff.write(self.s.state_vector.tostring())
00107       buff.write(_struct_i.pack(self.l))
00108     except struct.error as se: self._check_types(se)
00109     except TypeError as te: self._check_types(te)
00110 
00111   def deserialize_numpy(self, str, numpy):
00112     """
00113     unpack serialized message in str into this message instance using numpy for array types
00114     :param str: byte array of serialized message, ``str``
00115     :param numpy: numpy python module
00116     """
00117     try:
00118       if self.s is None:
00119         self.s = lfd_common.msg.state()
00120       end = 0
00121       start = end
00122       end += 4
00123       (length,) = _struct_I.unpack(str[start:end])
00124       pattern = '<%sf'%length
00125       start = end
00126       end += struct.calcsize(pattern)
00127       self.s.state_vector = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00128       start = end
00129       end += 4
00130       (self.l,) = _struct_i.unpack(str[start:end])
00131       return self
00132     except struct.error as e:
00133       raise genpy.DeserializationError(e) #most likely buffer underfill
00134 
00135 _struct_I = genpy.struct_I
00136 _struct_i = struct.Struct("<i")


lfd_common
Author(s): Russell Toris
autogenerated on Thu Jan 2 2014 11:23:52