_GenericAction.py
Go to the documentation of this file.
00001 """autogenerated by genpy from srs_knowledge/GenericAction.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 GenericAction(genpy.Message):
00009   _md5sum = "a7c1a26d90fbf6bc86a183b38fc4ed58"
00010   _type = "srs_knowledge/GenericAction"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# use a list as the information container of an action
00013 # BE CAREFUL WHEN USING IT. FOR FLEXIBILITY REASON OR TESTING NEW ADDED ACTION TYPE 
00014 # string[] actionInfo    # to deprecate
00015 string jsonActionInfo
00016 
00017 """
00018   __slots__ = ['jsonActionInfo']
00019   _slot_types = ['string']
00020 
00021   def __init__(self, *args, **kwds):
00022     """
00023     Constructor. Any message fields that are implicitly/explicitly
00024     set to None will be assigned a default value. The recommend
00025     use is keyword arguments as this is more robust to future message
00026     changes.  You cannot mix in-order arguments and keyword arguments.
00027 
00028     The available fields are:
00029        jsonActionInfo
00030 
00031     :param args: complete set of field values, in .msg order
00032     :param kwds: use keyword arguments corresponding to message field names
00033     to set specific fields.
00034     """
00035     if args or kwds:
00036       super(GenericAction, self).__init__(*args, **kwds)
00037       #message fields cannot be None, assign default values for those that are
00038       if self.jsonActionInfo is None:
00039         self.jsonActionInfo = ''
00040     else:
00041       self.jsonActionInfo = ''
00042 
00043   def _get_types(self):
00044     """
00045     internal API method
00046     """
00047     return self._slot_types
00048 
00049   def serialize(self, buff):
00050     """
00051     serialize message into buffer
00052     :param buff: buffer, ``StringIO``
00053     """
00054     try:
00055       _x = self.jsonActionInfo
00056       length = len(_x)
00057       if python3 or type(_x) == unicode:
00058         _x = _x.encode('utf-8')
00059         length = len(_x)
00060       buff.write(struct.pack('<I%ss'%length, length, _x))
00061     except struct.error as se: self._check_types(se)
00062     except TypeError as te: self._check_types(te)
00063 
00064   def deserialize(self, str):
00065     """
00066     unpack serialized message in str into this message instance
00067     :param str: byte array of serialized message, ``str``
00068     """
00069     try:
00070       end = 0
00071       start = end
00072       end += 4
00073       (length,) = _struct_I.unpack(str[start:end])
00074       start = end
00075       end += length
00076       if python3:
00077         self.jsonActionInfo = str[start:end].decode('utf-8')
00078       else:
00079         self.jsonActionInfo = str[start:end]
00080       return self
00081     except struct.error as e:
00082       raise genpy.DeserializationError(e) #most likely buffer underfill
00083 
00084 
00085   def serialize_numpy(self, buff, numpy):
00086     """
00087     serialize message with numpy array types into buffer
00088     :param buff: buffer, ``StringIO``
00089     :param numpy: numpy python module
00090     """
00091     try:
00092       _x = self.jsonActionInfo
00093       length = len(_x)
00094       if python3 or type(_x) == unicode:
00095         _x = _x.encode('utf-8')
00096         length = len(_x)
00097       buff.write(struct.pack('<I%ss'%length, length, _x))
00098     except struct.error as se: self._check_types(se)
00099     except TypeError as te: self._check_types(te)
00100 
00101   def deserialize_numpy(self, str, numpy):
00102     """
00103     unpack serialized message in str into this message instance using numpy for array types
00104     :param str: byte array of serialized message, ``str``
00105     :param numpy: numpy python module
00106     """
00107     try:
00108       end = 0
00109       start = end
00110       end += 4
00111       (length,) = _struct_I.unpack(str[start:end])
00112       start = end
00113       end += length
00114       if python3:
00115         self.jsonActionInfo = str[start:end].decode('utf-8')
00116       else:
00117         self.jsonActionInfo = str[start:end]
00118       return self
00119     except struct.error as e:
00120       raise genpy.DeserializationError(e) #most likely buffer underfill
00121 
00122 _struct_I = genpy.struct_I


srs_knowledge
Author(s): Ze Ji
autogenerated on Sun Jan 5 2014 12:03:26