_classifier_update.py
Go to the documentation of this file.
00001 """autogenerated by genpy from iri_publish_params/classifier_update.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 iri_publish_params.msg
00008 
00009 class classifier_update(genpy.Message):
00010   _md5sum = "a27aec3298bbdcd2bd8ad5da8e997b16"
00011   _type = "iri_publish_params/classifier_update"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """classifier_params[] update_params
00014 int32 selected_centroid
00015 int32 filter_method
00016 
00017 ================================================================================
00018 MSG: iri_publish_params/classifier_params
00019 float32[] params
00020 
00021 """
00022   __slots__ = ['update_params','selected_centroid','filter_method']
00023   _slot_types = ['iri_publish_params/classifier_params[]','int32','int32']
00024 
00025   def __init__(self, *args, **kwds):
00026     """
00027     Constructor. Any message fields that are implicitly/explicitly
00028     set to None will be assigned a default value. The recommend
00029     use is keyword arguments as this is more robust to future message
00030     changes.  You cannot mix in-order arguments and keyword arguments.
00031 
00032     The available fields are:
00033        update_params,selected_centroid,filter_method
00034 
00035     :param args: complete set of field values, in .msg order
00036     :param kwds: use keyword arguments corresponding to message field names
00037     to set specific fields.
00038     """
00039     if args or kwds:
00040       super(classifier_update, self).__init__(*args, **kwds)
00041       #message fields cannot be None, assign default values for those that are
00042       if self.update_params is None:
00043         self.update_params = []
00044       if self.selected_centroid is None:
00045         self.selected_centroid = 0
00046       if self.filter_method is None:
00047         self.filter_method = 0
00048     else:
00049       self.update_params = []
00050       self.selected_centroid = 0
00051       self.filter_method = 0
00052 
00053   def _get_types(self):
00054     """
00055     internal API method
00056     """
00057     return self._slot_types
00058 
00059   def serialize(self, buff):
00060     """
00061     serialize message into buffer
00062     :param buff: buffer, ``StringIO``
00063     """
00064     try:
00065       length = len(self.update_params)
00066       buff.write(_struct_I.pack(length))
00067       for val1 in self.update_params:
00068         length = len(val1.params)
00069         buff.write(_struct_I.pack(length))
00070         pattern = '<%sf'%length
00071         buff.write(struct.pack(pattern, *val1.params))
00072       _x = self
00073       buff.write(_struct_2i.pack(_x.selected_centroid, _x.filter_method))
00074     except struct.error as se: self._check_types(se)
00075     except TypeError as te: self._check_types(te)
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       if self.update_params is None:
00084         self.update_params = None
00085       end = 0
00086       start = end
00087       end += 4
00088       (length,) = _struct_I.unpack(str[start:end])
00089       self.update_params = []
00090       for i in range(0, length):
00091         val1 = iri_publish_params.msg.classifier_params()
00092         start = end
00093         end += 4
00094         (length,) = _struct_I.unpack(str[start:end])
00095         pattern = '<%sf'%length
00096         start = end
00097         end += struct.calcsize(pattern)
00098         val1.params = struct.unpack(pattern, str[start:end])
00099         self.update_params.append(val1)
00100       _x = self
00101       start = end
00102       end += 8
00103       (_x.selected_centroid, _x.filter_method,) = _struct_2i.unpack(str[start:end])
00104       return self
00105     except struct.error as e:
00106       raise genpy.DeserializationError(e) #most likely buffer underfill
00107 
00108 
00109   def serialize_numpy(self, buff, numpy):
00110     """
00111     serialize message with numpy array types into buffer
00112     :param buff: buffer, ``StringIO``
00113     :param numpy: numpy python module
00114     """
00115     try:
00116       length = len(self.update_params)
00117       buff.write(_struct_I.pack(length))
00118       for val1 in self.update_params:
00119         length = len(val1.params)
00120         buff.write(_struct_I.pack(length))
00121         pattern = '<%sf'%length
00122         buff.write(val1.params.tostring())
00123       _x = self
00124       buff.write(_struct_2i.pack(_x.selected_centroid, _x.filter_method))
00125     except struct.error as se: self._check_types(se)
00126     except TypeError as te: self._check_types(te)
00127 
00128   def deserialize_numpy(self, str, numpy):
00129     """
00130     unpack serialized message in str into this message instance using numpy for array types
00131     :param str: byte array of serialized message, ``str``
00132     :param numpy: numpy python module
00133     """
00134     try:
00135       if self.update_params is None:
00136         self.update_params = None
00137       end = 0
00138       start = end
00139       end += 4
00140       (length,) = _struct_I.unpack(str[start:end])
00141       self.update_params = []
00142       for i in range(0, length):
00143         val1 = iri_publish_params.msg.classifier_params()
00144         start = end
00145         end += 4
00146         (length,) = _struct_I.unpack(str[start:end])
00147         pattern = '<%sf'%length
00148         start = end
00149         end += struct.calcsize(pattern)
00150         val1.params = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00151         self.update_params.append(val1)
00152       _x = self
00153       start = end
00154       end += 8
00155       (_x.selected_centroid, _x.filter_method,) = _struct_2i.unpack(str[start:end])
00156       return self
00157     except struct.error as e:
00158       raise genpy.DeserializationError(e) #most likely buffer underfill
00159 
00160 _struct_I = genpy.struct_I
00161 _struct_2i = struct.Struct("<2i")


iri_publish_params
Author(s): Arnau Ramisa
autogenerated on Fri Dec 6 2013 21:13:34