_ClassifyData.py
Go to the documentation of this file.
00001 """autogenerated by genpy from ml_classifiers/ClassifyDataRequest.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 ml_classifiers.msg
00008 
00009 class ClassifyDataRequest(genpy.Message):
00010   _md5sum = "572733f6e77cd60bddc5c0b72307999c"
00011   _type = "ml_classifiers/ClassifyDataRequest"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """string identifier
00014 ClassDataPoint[] data
00015 
00016 ================================================================================
00017 MSG: ml_classifiers/ClassDataPoint
00018 string target_class
00019 float64[] point
00020 
00021 """
00022   __slots__ = ['identifier','data']
00023   _slot_types = ['string','ml_classifiers/ClassDataPoint[]']
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        identifier,data
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(ClassifyDataRequest, self).__init__(*args, **kwds)
00041       #message fields cannot be None, assign default values for those that are
00042       if self.identifier is None:
00043         self.identifier = ''
00044       if self.data is None:
00045         self.data = []
00046     else:
00047       self.identifier = ''
00048       self.data = []
00049 
00050   def _get_types(self):
00051     """
00052     internal API method
00053     """
00054     return self._slot_types
00055 
00056   def serialize(self, buff):
00057     """
00058     serialize message into buffer
00059     :param buff: buffer, ``StringIO``
00060     """
00061     try:
00062       _x = self.identifier
00063       length = len(_x)
00064       if python3 or type(_x) == unicode:
00065         _x = _x.encode('utf-8')
00066         length = len(_x)
00067       buff.write(struct.pack('<I%ss'%length, length, _x))
00068       length = len(self.data)
00069       buff.write(_struct_I.pack(length))
00070       for val1 in self.data:
00071         _x = val1.target_class
00072         length = len(_x)
00073         if python3 or type(_x) == unicode:
00074           _x = _x.encode('utf-8')
00075           length = len(_x)
00076         buff.write(struct.pack('<I%ss'%length, length, _x))
00077         length = len(val1.point)
00078         buff.write(_struct_I.pack(length))
00079         pattern = '<%sd'%length
00080         buff.write(struct.pack(pattern, *val1.point))
00081     except struct.error as se: self._check_types(se)
00082     except TypeError as te: self._check_types(te)
00083 
00084   def deserialize(self, str):
00085     """
00086     unpack serialized message in str into this message instance
00087     :param str: byte array of serialized message, ``str``
00088     """
00089     try:
00090       if self.data is None:
00091         self.data = None
00092       end = 0
00093       start = end
00094       end += 4
00095       (length,) = _struct_I.unpack(str[start:end])
00096       start = end
00097       end += length
00098       if python3:
00099         self.identifier = str[start:end].decode('utf-8')
00100       else:
00101         self.identifier = str[start:end]
00102       start = end
00103       end += 4
00104       (length,) = _struct_I.unpack(str[start:end])
00105       self.data = []
00106       for i in range(0, length):
00107         val1 = ml_classifiers.msg.ClassDataPoint()
00108         start = end
00109         end += 4
00110         (length,) = _struct_I.unpack(str[start:end])
00111         start = end
00112         end += length
00113         if python3:
00114           val1.target_class = str[start:end].decode('utf-8')
00115         else:
00116           val1.target_class = str[start:end]
00117         start = end
00118         end += 4
00119         (length,) = _struct_I.unpack(str[start:end])
00120         pattern = '<%sd'%length
00121         start = end
00122         end += struct.calcsize(pattern)
00123         val1.point = struct.unpack(pattern, str[start:end])
00124         self.data.append(val1)
00125       return self
00126     except struct.error as e:
00127       raise genpy.DeserializationError(e) #most likely buffer underfill
00128 
00129 
00130   def serialize_numpy(self, buff, numpy):
00131     """
00132     serialize message with numpy array types into buffer
00133     :param buff: buffer, ``StringIO``
00134     :param numpy: numpy python module
00135     """
00136     try:
00137       _x = self.identifier
00138       length = len(_x)
00139       if python3 or type(_x) == unicode:
00140         _x = _x.encode('utf-8')
00141         length = len(_x)
00142       buff.write(struct.pack('<I%ss'%length, length, _x))
00143       length = len(self.data)
00144       buff.write(_struct_I.pack(length))
00145       for val1 in self.data:
00146         _x = val1.target_class
00147         length = len(_x)
00148         if python3 or type(_x) == unicode:
00149           _x = _x.encode('utf-8')
00150           length = len(_x)
00151         buff.write(struct.pack('<I%ss'%length, length, _x))
00152         length = len(val1.point)
00153         buff.write(_struct_I.pack(length))
00154         pattern = '<%sd'%length
00155         buff.write(val1.point.tostring())
00156     except struct.error as se: self._check_types(se)
00157     except TypeError as te: self._check_types(te)
00158 
00159   def deserialize_numpy(self, str, numpy):
00160     """
00161     unpack serialized message in str into this message instance using numpy for array types
00162     :param str: byte array of serialized message, ``str``
00163     :param numpy: numpy python module
00164     """
00165     try:
00166       if self.data is None:
00167         self.data = None
00168       end = 0
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.identifier = str[start:end].decode('utf-8')
00176       else:
00177         self.identifier = str[start:end]
00178       start = end
00179       end += 4
00180       (length,) = _struct_I.unpack(str[start:end])
00181       self.data = []
00182       for i in range(0, length):
00183         val1 = ml_classifiers.msg.ClassDataPoint()
00184         start = end
00185         end += 4
00186         (length,) = _struct_I.unpack(str[start:end])
00187         start = end
00188         end += length
00189         if python3:
00190           val1.target_class = str[start:end].decode('utf-8')
00191         else:
00192           val1.target_class = str[start:end]
00193         start = end
00194         end += 4
00195         (length,) = _struct_I.unpack(str[start:end])
00196         pattern = '<%sd'%length
00197         start = end
00198         end += struct.calcsize(pattern)
00199         val1.point = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00200         self.data.append(val1)
00201       return self
00202     except struct.error as e:
00203       raise genpy.DeserializationError(e) #most likely buffer underfill
00204 
00205 _struct_I = genpy.struct_I
00206 """autogenerated by genpy from ml_classifiers/ClassifyDataResponse.msg. Do not edit."""
00207 import sys
00208 python3 = True if sys.hexversion > 0x03000000 else False
00209 import genpy
00210 import struct
00211 
00212 
00213 class ClassifyDataResponse(genpy.Message):
00214   _md5sum = "5ce145dc8157b011850524b4b0ffd0b7"
00215   _type = "ml_classifiers/ClassifyDataResponse"
00216   _has_header = False #flag to mark the presence of a Header object
00217   _full_text = """string[] classifications
00218 
00219 
00220 
00221 
00222 
00223 
00224 """
00225   __slots__ = ['classifications']
00226   _slot_types = ['string[]']
00227 
00228   def __init__(self, *args, **kwds):
00229     """
00230     Constructor. Any message fields that are implicitly/explicitly
00231     set to None will be assigned a default value. The recommend
00232     use is keyword arguments as this is more robust to future message
00233     changes.  You cannot mix in-order arguments and keyword arguments.
00234 
00235     The available fields are:
00236        classifications
00237 
00238     :param args: complete set of field values, in .msg order
00239     :param kwds: use keyword arguments corresponding to message field names
00240     to set specific fields.
00241     """
00242     if args or kwds:
00243       super(ClassifyDataResponse, self).__init__(*args, **kwds)
00244       #message fields cannot be None, assign default values for those that are
00245       if self.classifications is None:
00246         self.classifications = []
00247     else:
00248       self.classifications = []
00249 
00250   def _get_types(self):
00251     """
00252     internal API method
00253     """
00254     return self._slot_types
00255 
00256   def serialize(self, buff):
00257     """
00258     serialize message into buffer
00259     :param buff: buffer, ``StringIO``
00260     """
00261     try:
00262       length = len(self.classifications)
00263       buff.write(_struct_I.pack(length))
00264       for val1 in self.classifications:
00265         length = len(val1)
00266         if python3 or type(val1) == unicode:
00267           val1 = val1.encode('utf-8')
00268           length = len(val1)
00269         buff.write(struct.pack('<I%ss'%length, length, val1))
00270     except struct.error as se: self._check_types(se)
00271     except TypeError as te: self._check_types(te)
00272 
00273   def deserialize(self, str):
00274     """
00275     unpack serialized message in str into this message instance
00276     :param str: byte array of serialized message, ``str``
00277     """
00278     try:
00279       end = 0
00280       start = end
00281       end += 4
00282       (length,) = _struct_I.unpack(str[start:end])
00283       self.classifications = []
00284       for i in range(0, length):
00285         start = end
00286         end += 4
00287         (length,) = _struct_I.unpack(str[start:end])
00288         start = end
00289         end += length
00290         if python3:
00291           val1 = str[start:end].decode('utf-8')
00292         else:
00293           val1 = str[start:end]
00294         self.classifications.append(val1)
00295       return self
00296     except struct.error as e:
00297       raise genpy.DeserializationError(e) #most likely buffer underfill
00298 
00299 
00300   def serialize_numpy(self, buff, numpy):
00301     """
00302     serialize message with numpy array types into buffer
00303     :param buff: buffer, ``StringIO``
00304     :param numpy: numpy python module
00305     """
00306     try:
00307       length = len(self.classifications)
00308       buff.write(_struct_I.pack(length))
00309       for val1 in self.classifications:
00310         length = len(val1)
00311         if python3 or type(val1) == unicode:
00312           val1 = val1.encode('utf-8')
00313           length = len(val1)
00314         buff.write(struct.pack('<I%ss'%length, length, val1))
00315     except struct.error as se: self._check_types(se)
00316     except TypeError as te: self._check_types(te)
00317 
00318   def deserialize_numpy(self, str, numpy):
00319     """
00320     unpack serialized message in str into this message instance using numpy for array types
00321     :param str: byte array of serialized message, ``str``
00322     :param numpy: numpy python module
00323     """
00324     try:
00325       end = 0
00326       start = end
00327       end += 4
00328       (length,) = _struct_I.unpack(str[start:end])
00329       self.classifications = []
00330       for i in range(0, length):
00331         start = end
00332         end += 4
00333         (length,) = _struct_I.unpack(str[start:end])
00334         start = end
00335         end += length
00336         if python3:
00337           val1 = str[start:end].decode('utf-8')
00338         else:
00339           val1 = str[start:end]
00340         self.classifications.append(val1)
00341       return self
00342     except struct.error as e:
00343       raise genpy.DeserializationError(e) #most likely buffer underfill
00344 
00345 _struct_I = genpy.struct_I
00346 class ClassifyData(object):
00347   _type          = 'ml_classifiers/ClassifyData'
00348   _md5sum = '5ee7ec82bea2c231e357662def7bf4a4'
00349   _request_class  = ClassifyDataRequest
00350   _response_class = ClassifyDataResponse


ml_classifiers
Author(s): Scott Niekum
autogenerated on Fri Jan 3 2014 11:30:23