_sequenceGoal.py
Go to the documentation of this file.
00001 """autogenerated by genpy from tibi_dabo_msgs/sequenceGoal.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 sequenceGoal(genpy.Message):
00009   _md5sum = "f43f9a28a5d82ac92983f1e553ed78b4"
00010   _type = "tibi_dabo_msgs/sequenceGoal"
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 string[]  sequence_file
00015 int32[]   num_repetitions
00016 
00017 """
00018   __slots__ = ['sequence_file','num_repetitions']
00019   _slot_types = ['string[]','int32[]']
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        sequence_file,num_repetitions
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(sequenceGoal, self).__init__(*args, **kwds)
00037       #message fields cannot be None, assign default values for those that are
00038       if self.sequence_file is None:
00039         self.sequence_file = []
00040       if self.num_repetitions is None:
00041         self.num_repetitions = []
00042     else:
00043       self.sequence_file = []
00044       self.num_repetitions = []
00045 
00046   def _get_types(self):
00047     """
00048     internal API method
00049     """
00050     return self._slot_types
00051 
00052   def serialize(self, buff):
00053     """
00054     serialize message into buffer
00055     :param buff: buffer, ``StringIO``
00056     """
00057     try:
00058       length = len(self.sequence_file)
00059       buff.write(_struct_I.pack(length))
00060       for val1 in self.sequence_file:
00061         length = len(val1)
00062         if python3 or type(val1) == unicode:
00063           val1 = val1.encode('utf-8')
00064           length = len(val1)
00065         buff.write(struct.pack('<I%ss'%length, length, val1))
00066       length = len(self.num_repetitions)
00067       buff.write(_struct_I.pack(length))
00068       pattern = '<%si'%length
00069       buff.write(struct.pack(pattern, *self.num_repetitions))
00070     except struct.error as se: self._check_types(se)
00071     except TypeError as te: self._check_types(te)
00072 
00073   def deserialize(self, str):
00074     """
00075     unpack serialized message in str into this message instance
00076     :param str: byte array of serialized message, ``str``
00077     """
00078     try:
00079       end = 0
00080       start = end
00081       end += 4
00082       (length,) = _struct_I.unpack(str[start:end])
00083       self.sequence_file = []
00084       for i in range(0, length):
00085         start = end
00086         end += 4
00087         (length,) = _struct_I.unpack(str[start:end])
00088         start = end
00089         end += length
00090         if python3:
00091           val1 = str[start:end].decode('utf-8')
00092         else:
00093           val1 = str[start:end]
00094         self.sequence_file.append(val1)
00095       start = end
00096       end += 4
00097       (length,) = _struct_I.unpack(str[start:end])
00098       pattern = '<%si'%length
00099       start = end
00100       end += struct.calcsize(pattern)
00101       self.num_repetitions = struct.unpack(pattern, str[start:end])
00102       return self
00103     except struct.error as e:
00104       raise genpy.DeserializationError(e) #most likely buffer underfill
00105 
00106 
00107   def serialize_numpy(self, buff, numpy):
00108     """
00109     serialize message with numpy array types into buffer
00110     :param buff: buffer, ``StringIO``
00111     :param numpy: numpy python module
00112     """
00113     try:
00114       length = len(self.sequence_file)
00115       buff.write(_struct_I.pack(length))
00116       for val1 in self.sequence_file:
00117         length = len(val1)
00118         if python3 or type(val1) == unicode:
00119           val1 = val1.encode('utf-8')
00120           length = len(val1)
00121         buff.write(struct.pack('<I%ss'%length, length, val1))
00122       length = len(self.num_repetitions)
00123       buff.write(_struct_I.pack(length))
00124       pattern = '<%si'%length
00125       buff.write(self.num_repetitions.tostring())
00126     except struct.error as se: self._check_types(se)
00127     except TypeError as te: self._check_types(te)
00128 
00129   def deserialize_numpy(self, str, numpy):
00130     """
00131     unpack serialized message in str into this message instance using numpy for array types
00132     :param str: byte array of serialized message, ``str``
00133     :param numpy: numpy python module
00134     """
00135     try:
00136       end = 0
00137       start = end
00138       end += 4
00139       (length,) = _struct_I.unpack(str[start:end])
00140       self.sequence_file = []
00141       for i in range(0, length):
00142         start = end
00143         end += 4
00144         (length,) = _struct_I.unpack(str[start:end])
00145         start = end
00146         end += length
00147         if python3:
00148           val1 = str[start:end].decode('utf-8')
00149         else:
00150           val1 = str[start:end]
00151         self.sequence_file.append(val1)
00152       start = end
00153       end += 4
00154       (length,) = _struct_I.unpack(str[start:end])
00155       pattern = '<%si'%length
00156       start = end
00157       end += struct.calcsize(pattern)
00158       self.num_repetitions = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00159       return self
00160     except struct.error as e:
00161       raise genpy.DeserializationError(e) #most likely buffer underfill
00162 
00163 _struct_I = genpy.struct_I


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