_Command.py
Go to the documentation of this file.
00001 """autogenerated by genpy from demo_msgs/Command.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 Command(genpy.Message):
00009   _md5sum = "c074ad78169009bd668a677aebbc7406"
00010   _type = "demo_msgs/Command"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """string command
00013 string param
00014 string taskID
00015 
00016 """
00017   __slots__ = ['command','param','taskID']
00018   _slot_types = ['string','string','string']
00019 
00020   def __init__(self, *args, **kwds):
00021     """
00022     Constructor. Any message fields that are implicitly/explicitly
00023     set to None will be assigned a default value. The recommend
00024     use is keyword arguments as this is more robust to future message
00025     changes.  You cannot mix in-order arguments and keyword arguments.
00026 
00027     The available fields are:
00028        command,param,taskID
00029 
00030     :param args: complete set of field values, in .msg order
00031     :param kwds: use keyword arguments corresponding to message field names
00032     to set specific fields.
00033     """
00034     if args or kwds:
00035       super(Command, self).__init__(*args, **kwds)
00036       #message fields cannot be None, assign default values for those that are
00037       if self.command is None:
00038         self.command = ''
00039       if self.param is None:
00040         self.param = ''
00041       if self.taskID is None:
00042         self.taskID = ''
00043     else:
00044       self.command = ''
00045       self.param = ''
00046       self.taskID = ''
00047 
00048   def _get_types(self):
00049     """
00050     internal API method
00051     """
00052     return self._slot_types
00053 
00054   def serialize(self, buff):
00055     """
00056     serialize message into buffer
00057     :param buff: buffer, ``StringIO``
00058     """
00059     try:
00060       _x = self.command
00061       length = len(_x)
00062       if python3 or type(_x) == unicode:
00063         _x = _x.encode('utf-8')
00064         length = len(_x)
00065       buff.write(struct.pack('<I%ss'%length, length, _x))
00066       _x = self.param
00067       length = len(_x)
00068       if python3 or type(_x) == unicode:
00069         _x = _x.encode('utf-8')
00070         length = len(_x)
00071       buff.write(struct.pack('<I%ss'%length, length, _x))
00072       _x = self.taskID
00073       length = len(_x)
00074       if python3 or type(_x) == unicode:
00075         _x = _x.encode('utf-8')
00076         length = len(_x)
00077       buff.write(struct.pack('<I%ss'%length, length, _x))
00078     except struct.error as se: self._check_types(se)
00079     except TypeError as te: self._check_types(te)
00080 
00081   def deserialize(self, str):
00082     """
00083     unpack serialized message in str into this message instance
00084     :param str: byte array of serialized message, ``str``
00085     """
00086     try:
00087       end = 0
00088       start = end
00089       end += 4
00090       (length,) = _struct_I.unpack(str[start:end])
00091       start = end
00092       end += length
00093       if python3:
00094         self.command = str[start:end].decode('utf-8')
00095       else:
00096         self.command = str[start:end]
00097       start = end
00098       end += 4
00099       (length,) = _struct_I.unpack(str[start:end])
00100       start = end
00101       end += length
00102       if python3:
00103         self.param = str[start:end].decode('utf-8')
00104       else:
00105         self.param = str[start:end]
00106       start = end
00107       end += 4
00108       (length,) = _struct_I.unpack(str[start:end])
00109       start = end
00110       end += length
00111       if python3:
00112         self.taskID = str[start:end].decode('utf-8')
00113       else:
00114         self.taskID = str[start:end]
00115       return self
00116     except struct.error as e:
00117       raise genpy.DeserializationError(e) #most likely buffer underfill
00118 
00119 
00120   def serialize_numpy(self, buff, numpy):
00121     """
00122     serialize message with numpy array types into buffer
00123     :param buff: buffer, ``StringIO``
00124     :param numpy: numpy python module
00125     """
00126     try:
00127       _x = self.command
00128       length = len(_x)
00129       if python3 or type(_x) == unicode:
00130         _x = _x.encode('utf-8')
00131         length = len(_x)
00132       buff.write(struct.pack('<I%ss'%length, length, _x))
00133       _x = self.param
00134       length = len(_x)
00135       if python3 or type(_x) == unicode:
00136         _x = _x.encode('utf-8')
00137         length = len(_x)
00138       buff.write(struct.pack('<I%ss'%length, length, _x))
00139       _x = self.taskID
00140       length = len(_x)
00141       if python3 or type(_x) == unicode:
00142         _x = _x.encode('utf-8')
00143         length = len(_x)
00144       buff.write(struct.pack('<I%ss'%length, length, _x))
00145     except struct.error as se: self._check_types(se)
00146     except TypeError as te: self._check_types(te)
00147 
00148   def deserialize_numpy(self, str, numpy):
00149     """
00150     unpack serialized message in str into this message instance using numpy for array types
00151     :param str: byte array of serialized message, ``str``
00152     :param numpy: numpy python module
00153     """
00154     try:
00155       end = 0
00156       start = end
00157       end += 4
00158       (length,) = _struct_I.unpack(str[start:end])
00159       start = end
00160       end += length
00161       if python3:
00162         self.command = str[start:end].decode('utf-8')
00163       else:
00164         self.command = str[start:end]
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.param = str[start:end].decode('utf-8')
00172       else:
00173         self.param = str[start:end]
00174       start = end
00175       end += 4
00176       (length,) = _struct_I.unpack(str[start:end])
00177       start = end
00178       end += length
00179       if python3:
00180         self.taskID = str[start:end].decode('utf-8')
00181       else:
00182         self.taskID = str[start:end]
00183       return self
00184     except struct.error as e:
00185       raise genpy.DeserializationError(e) #most likely buffer underfill
00186 
00187 _struct_I = genpy.struct_I
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends


demo_msgs
Author(s): Jihoon
autogenerated on Tue Jan 15 2013 20:38:41