_srs_actionFeedback.py
Go to the documentation of this file.
00001 """autogenerated by genpy from srs_decision_making_interface/srs_actionFeedback.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 srs_actionFeedback(genpy.Message):
00009   _md5sum = "0e36b97f48749b0648782cf298eb80be"
00010   _type = "srs_decision_making_interface/srs_actionFeedback"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00013 #define a feedback message
00014 string current_state         # to deprecate
00015 bool solution_required       # to deprecate
00016 uint32 exceptional_case_id   # to deprecate
00017 string json_feedback         # new added feedback in json (test by ze)
00018 
00019 
00020 """
00021   __slots__ = ['current_state','solution_required','exceptional_case_id','json_feedback']
00022   _slot_types = ['string','bool','uint32','string']
00023 
00024   def __init__(self, *args, **kwds):
00025     """
00026     Constructor. Any message fields that are implicitly/explicitly
00027     set to None will be assigned a default value. The recommend
00028     use is keyword arguments as this is more robust to future message
00029     changes.  You cannot mix in-order arguments and keyword arguments.
00030 
00031     The available fields are:
00032        current_state,solution_required,exceptional_case_id,json_feedback
00033 
00034     :param args: complete set of field values, in .msg order
00035     :param kwds: use keyword arguments corresponding to message field names
00036     to set specific fields.
00037     """
00038     if args or kwds:
00039       super(srs_actionFeedback, self).__init__(*args, **kwds)
00040       #message fields cannot be None, assign default values for those that are
00041       if self.current_state is None:
00042         self.current_state = ''
00043       if self.solution_required is None:
00044         self.solution_required = False
00045       if self.exceptional_case_id is None:
00046         self.exceptional_case_id = 0
00047       if self.json_feedback is None:
00048         self.json_feedback = ''
00049     else:
00050       self.current_state = ''
00051       self.solution_required = False
00052       self.exceptional_case_id = 0
00053       self.json_feedback = ''
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.current_state
00068       length = len(_x)
00069       if python3 or type(_x) == unicode:
00070         _x = _x.encode('utf-8')
00071         length = len(_x)
00072       buff.write(struct.pack('<I%ss'%length, length, _x))
00073       _x = self
00074       buff.write(_struct_BI.pack(_x.solution_required, _x.exceptional_case_id))
00075       _x = self.json_feedback
00076       length = len(_x)
00077       if python3 or type(_x) == unicode:
00078         _x = _x.encode('utf-8')
00079         length = len(_x)
00080       buff.write(struct.pack('<I%ss'%length, length, _x))
00081     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00082     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
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       end = 0
00091       start = end
00092       end += 4
00093       (length,) = _struct_I.unpack(str[start:end])
00094       start = end
00095       end += length
00096       if python3:
00097         self.current_state = str[start:end].decode('utf-8')
00098       else:
00099         self.current_state = str[start:end]
00100       _x = self
00101       start = end
00102       end += 5
00103       (_x.solution_required, _x.exceptional_case_id,) = _struct_BI.unpack(str[start:end])
00104       self.solution_required = bool(self.solution_required)
00105       start = end
00106       end += 4
00107       (length,) = _struct_I.unpack(str[start:end])
00108       start = end
00109       end += length
00110       if python3:
00111         self.json_feedback = str[start:end].decode('utf-8')
00112       else:
00113         self.json_feedback = str[start:end]
00114       return self
00115     except struct.error as e:
00116       raise genpy.DeserializationError(e) #most likely buffer underfill
00117 
00118 
00119   def serialize_numpy(self, buff, numpy):
00120     """
00121     serialize message with numpy array types into buffer
00122     :param buff: buffer, ``StringIO``
00123     :param numpy: numpy python module
00124     """
00125     try:
00126       _x = self.current_state
00127       length = len(_x)
00128       if python3 or type(_x) == unicode:
00129         _x = _x.encode('utf-8')
00130         length = len(_x)
00131       buff.write(struct.pack('<I%ss'%length, length, _x))
00132       _x = self
00133       buff.write(_struct_BI.pack(_x.solution_required, _x.exceptional_case_id))
00134       _x = self.json_feedback
00135       length = len(_x)
00136       if python3 or type(_x) == unicode:
00137         _x = _x.encode('utf-8')
00138         length = len(_x)
00139       buff.write(struct.pack('<I%ss'%length, length, _x))
00140     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00141     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00142 
00143   def deserialize_numpy(self, str, numpy):
00144     """
00145     unpack serialized message in str into this message instance using numpy for array types
00146     :param str: byte array of serialized message, ``str``
00147     :param numpy: numpy python module
00148     """
00149     try:
00150       end = 0
00151       start = end
00152       end += 4
00153       (length,) = _struct_I.unpack(str[start:end])
00154       start = end
00155       end += length
00156       if python3:
00157         self.current_state = str[start:end].decode('utf-8')
00158       else:
00159         self.current_state = str[start:end]
00160       _x = self
00161       start = end
00162       end += 5
00163       (_x.solution_required, _x.exceptional_case_id,) = _struct_BI.unpack(str[start:end])
00164       self.solution_required = bool(self.solution_required)
00165       start = end
00166       end += 4
00167       (length,) = _struct_I.unpack(str[start:end])
00168       start = end
00169       end += length
00170       if python3:
00171         self.json_feedback = str[start:end].decode('utf-8')
00172       else:
00173         self.json_feedback = str[start:end]
00174       return self
00175     except struct.error as e:
00176       raise genpy.DeserializationError(e) #most likely buffer underfill
00177 
00178 _struct_I = genpy.struct_I
00179 _struct_BI = struct.Struct("<BI")


srs_decision_making_interface
Author(s): renxi
autogenerated on Mon Oct 6 2014 08:36:17