00001 """autogenerated by genpy from ml_classifiers/AddClassDataRequest.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 AddClassDataRequest(genpy.Message):
00010 _md5sum = "572733f6e77cd60bddc5c0b72307999c"
00011 _type = "ml_classifiers/AddClassDataRequest"
00012 _has_header = False
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(AddClassDataRequest, self).__init__(*args, **kwds)
00041
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)
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)
00204
00205 _struct_I = genpy.struct_I
00206 """autogenerated by genpy from ml_classifiers/AddClassDataResponse.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 AddClassDataResponse(genpy.Message):
00214 _md5sum = "358e233cde0c8a8bcfea4ce193f8fc15"
00215 _type = "ml_classifiers/AddClassDataResponse"
00216 _has_header = False
00217 _full_text = """bool success
00218
00219
00220
00221
00222
00223
00224 """
00225 __slots__ = ['success']
00226 _slot_types = ['bool']
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 success
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(AddClassDataResponse, self).__init__(*args, **kwds)
00244
00245 if self.success is None:
00246 self.success = False
00247 else:
00248 self.success = False
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 buff.write(_struct_B.pack(self.success))
00263 except struct.error as se: self._check_types(se)
00264 except TypeError as te: self._check_types(te)
00265
00266 def deserialize(self, str):
00267 """
00268 unpack serialized message in str into this message instance
00269 :param str: byte array of serialized message, ``str``
00270 """
00271 try:
00272 end = 0
00273 start = end
00274 end += 1
00275 (self.success,) = _struct_B.unpack(str[start:end])
00276 self.success = bool(self.success)
00277 return self
00278 except struct.error as e:
00279 raise genpy.DeserializationError(e)
00280
00281
00282 def serialize_numpy(self, buff, numpy):
00283 """
00284 serialize message with numpy array types into buffer
00285 :param buff: buffer, ``StringIO``
00286 :param numpy: numpy python module
00287 """
00288 try:
00289 buff.write(_struct_B.pack(self.success))
00290 except struct.error as se: self._check_types(se)
00291 except TypeError as te: self._check_types(te)
00292
00293 def deserialize_numpy(self, str, numpy):
00294 """
00295 unpack serialized message in str into this message instance using numpy for array types
00296 :param str: byte array of serialized message, ``str``
00297 :param numpy: numpy python module
00298 """
00299 try:
00300 end = 0
00301 start = end
00302 end += 1
00303 (self.success,) = _struct_B.unpack(str[start:end])
00304 self.success = bool(self.success)
00305 return self
00306 except struct.error as e:
00307 raise genpy.DeserializationError(e)
00308
00309 _struct_I = genpy.struct_I
00310 _struct_B = struct.Struct("<B")
00311 class AddClassData(object):
00312 _type = 'ml_classifiers/AddClassData'
00313 _md5sum = 'd4c3cb23d4d2e3dec5588818fec39e8c'
00314 _request_class = AddClassDataRequest
00315 _response_class = AddClassDataResponse