_guiGoal.py
Go to the documentation of this file.
00001 """autogenerated by genpy from tibi_dabo_msgs/guiGoal.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 guiGoal(genpy.Message):
00009   _md5sum = "a03dac294464868ec258d52997d3f312"
00010   _type = "tibi_dabo_msgs/guiGoal"
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 #goal definition
00014 int32 cmd_id 
00015 float64[] num_params
00016 string[] string_params
00017 
00018 """
00019   __slots__ = ['cmd_id','num_params','string_params']
00020   _slot_types = ['int32','float64[]','string[]']
00021 
00022   def __init__(self, *args, **kwds):
00023     """
00024     Constructor. Any message fields that are implicitly/explicitly
00025     set to None will be assigned a default value. The recommend
00026     use is keyword arguments as this is more robust to future message
00027     changes.  You cannot mix in-order arguments and keyword arguments.
00028 
00029     The available fields are:
00030        cmd_id,num_params,string_params
00031 
00032     :param args: complete set of field values, in .msg order
00033     :param kwds: use keyword arguments corresponding to message field names
00034     to set specific fields.
00035     """
00036     if args or kwds:
00037       super(guiGoal, self).__init__(*args, **kwds)
00038       #message fields cannot be None, assign default values for those that are
00039       if self.cmd_id is None:
00040         self.cmd_id = 0
00041       if self.num_params is None:
00042         self.num_params = []
00043       if self.string_params is None:
00044         self.string_params = []
00045     else:
00046       self.cmd_id = 0
00047       self.num_params = []
00048       self.string_params = []
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       buff.write(_struct_i.pack(self.cmd_id))
00063       length = len(self.num_params)
00064       buff.write(_struct_I.pack(length))
00065       pattern = '<%sd'%length
00066       buff.write(struct.pack(pattern, *self.num_params))
00067       length = len(self.string_params)
00068       buff.write(_struct_I.pack(length))
00069       for val1 in self.string_params:
00070         length = len(val1)
00071         if python3 or type(val1) == unicode:
00072           val1 = val1.encode('utf-8')
00073           length = len(val1)
00074         buff.write(struct.pack('<I%ss'%length, length, val1))
00075     except struct.error as se: self._check_types(se)
00076     except TypeError as te: self._check_types(te)
00077 
00078   def deserialize(self, str):
00079     """
00080     unpack serialized message in str into this message instance
00081     :param str: byte array of serialized message, ``str``
00082     """
00083     try:
00084       end = 0
00085       start = end
00086       end += 4
00087       (self.cmd_id,) = _struct_i.unpack(str[start:end])
00088       start = end
00089       end += 4
00090       (length,) = _struct_I.unpack(str[start:end])
00091       pattern = '<%sd'%length
00092       start = end
00093       end += struct.calcsize(pattern)
00094       self.num_params = struct.unpack(pattern, str[start:end])
00095       start = end
00096       end += 4
00097       (length,) = _struct_I.unpack(str[start:end])
00098       self.string_params = []
00099       for i in range(0, length):
00100         start = end
00101         end += 4
00102         (length,) = _struct_I.unpack(str[start:end])
00103         start = end
00104         end += length
00105         if python3:
00106           val1 = str[start:end].decode('utf-8')
00107         else:
00108           val1 = str[start:end]
00109         self.string_params.append(val1)
00110       return self
00111     except struct.error as e:
00112       raise genpy.DeserializationError(e) #most likely buffer underfill
00113 
00114 
00115   def serialize_numpy(self, buff, numpy):
00116     """
00117     serialize message with numpy array types into buffer
00118     :param buff: buffer, ``StringIO``
00119     :param numpy: numpy python module
00120     """
00121     try:
00122       buff.write(_struct_i.pack(self.cmd_id))
00123       length = len(self.num_params)
00124       buff.write(_struct_I.pack(length))
00125       pattern = '<%sd'%length
00126       buff.write(self.num_params.tostring())
00127       length = len(self.string_params)
00128       buff.write(_struct_I.pack(length))
00129       for val1 in self.string_params:
00130         length = len(val1)
00131         if python3 or type(val1) == unicode:
00132           val1 = val1.encode('utf-8')
00133           length = len(val1)
00134         buff.write(struct.pack('<I%ss'%length, length, val1))
00135     except struct.error as se: self._check_types(se)
00136     except TypeError as te: self._check_types(te)
00137 
00138   def deserialize_numpy(self, str, numpy):
00139     """
00140     unpack serialized message in str into this message instance using numpy for array types
00141     :param str: byte array of serialized message, ``str``
00142     :param numpy: numpy python module
00143     """
00144     try:
00145       end = 0
00146       start = end
00147       end += 4
00148       (self.cmd_id,) = _struct_i.unpack(str[start:end])
00149       start = end
00150       end += 4
00151       (length,) = _struct_I.unpack(str[start:end])
00152       pattern = '<%sd'%length
00153       start = end
00154       end += struct.calcsize(pattern)
00155       self.num_params = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00156       start = end
00157       end += 4
00158       (length,) = _struct_I.unpack(str[start:end])
00159       self.string_params = []
00160       for i in range(0, length):
00161         start = end
00162         end += 4
00163         (length,) = _struct_I.unpack(str[start:end])
00164         start = end
00165         end += length
00166         if python3:
00167           val1 = str[start:end].decode('utf-8')
00168         else:
00169           val1 = str[start:end]
00170         self.string_params.append(val1)
00171       return self
00172     except struct.error as e:
00173       raise genpy.DeserializationError(e) #most likely buffer underfill
00174 
00175 _struct_I = genpy.struct_I
00176 _struct_i = struct.Struct("<i")


tibi_dabo_msgs
Author(s): Sergi Hernandez Juan
autogenerated on Fri Dec 6 2013 20:03:32