_TopicLoggerGoal.py
Go to the documentation of this file.
00001 """autogenerated by genpy from topic_logger/TopicLoggerGoal.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 TopicLoggerGoal(genpy.Message):
00009   _md5sum = "3cb1755373f328539e90d82d254cc935"
00010   _type = "topic_logger/TopicLoggerGoal"
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 command
00015 string ID
00016 string[] selectedTopics
00017 
00018 """
00019   __slots__ = ['command','ID','selectedTopics']
00020   _slot_types = ['string','string','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        command,ID,selectedTopics
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(TopicLoggerGoal, self).__init__(*args, **kwds)
00038       #message fields cannot be None, assign default values for those that are
00039       if self.command is None:
00040         self.command = ''
00041       if self.ID is None:
00042         self.ID = ''
00043       if self.selectedTopics is None:
00044         self.selectedTopics = []
00045     else:
00046       self.command = ''
00047       self.ID = ''
00048       self.selectedTopics = []
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       _x = self.command
00063       length = len(_x)
00064       if python3 or type(_x) == unicode:
00065         _x = _x.encode('utf-8')
00066         length = len(_x)
00067       buff.write(struct.pack('<I%ss'%length, length, _x))
00068       _x = self.ID
00069       length = len(_x)
00070       if python3 or type(_x) == unicode:
00071         _x = _x.encode('utf-8')
00072         length = len(_x)
00073       buff.write(struct.pack('<I%ss'%length, length, _x))
00074       length = len(self.selectedTopics)
00075       buff.write(_struct_I.pack(length))
00076       for val1 in self.selectedTopics:
00077         length = len(val1)
00078         if python3 or type(val1) == unicode:
00079           val1 = val1.encode('utf-8')
00080           length = len(val1)
00081         buff.write(struct.pack('<I%ss'%length, length, val1))
00082     except struct.error as se: self._check_types(se)
00083     except TypeError as te: self._check_types(te)
00084 
00085   def deserialize(self, str):
00086     """
00087     unpack serialized message in str into this message instance
00088     :param str: byte array of serialized message, ``str``
00089     """
00090     try:
00091       end = 0
00092       start = end
00093       end += 4
00094       (length,) = _struct_I.unpack(str[start:end])
00095       start = end
00096       end += length
00097       if python3:
00098         self.command = str[start:end].decode('utf-8')
00099       else:
00100         self.command = str[start:end]
00101       start = end
00102       end += 4
00103       (length,) = _struct_I.unpack(str[start:end])
00104       start = end
00105       end += length
00106       if python3:
00107         self.ID = str[start:end].decode('utf-8')
00108       else:
00109         self.ID = str[start:end]
00110       start = end
00111       end += 4
00112       (length,) = _struct_I.unpack(str[start:end])
00113       self.selectedTopics = []
00114       for i in range(0, length):
00115         start = end
00116         end += 4
00117         (length,) = _struct_I.unpack(str[start:end])
00118         start = end
00119         end += length
00120         if python3:
00121           val1 = str[start:end].decode('utf-8')
00122         else:
00123           val1 = str[start:end]
00124         self.selectedTopics.append(val1)
00125       return self
00126     except struct.error as e:
00127       raise genpy.DeserializationError(e) #most likely buffer underfill
00128 
00129 
00130   def serialize_numpy(self, buff, numpy):
00131     """
00132     serialize message with numpy array types into buffer
00133     :param buff: buffer, ``StringIO``
00134     :param numpy: numpy python module
00135     """
00136     try:
00137       _x = self.command
00138       length = len(_x)
00139       if python3 or type(_x) == unicode:
00140         _x = _x.encode('utf-8')
00141         length = len(_x)
00142       buff.write(struct.pack('<I%ss'%length, length, _x))
00143       _x = self.ID
00144       length = len(_x)
00145       if python3 or type(_x) == unicode:
00146         _x = _x.encode('utf-8')
00147         length = len(_x)
00148       buff.write(struct.pack('<I%ss'%length, length, _x))
00149       length = len(self.selectedTopics)
00150       buff.write(_struct_I.pack(length))
00151       for val1 in self.selectedTopics:
00152         length = len(val1)
00153         if python3 or type(val1) == unicode:
00154           val1 = val1.encode('utf-8')
00155           length = len(val1)
00156         buff.write(struct.pack('<I%ss'%length, length, val1))
00157     except struct.error as se: self._check_types(se)
00158     except TypeError as te: self._check_types(te)
00159 
00160   def deserialize_numpy(self, str, numpy):
00161     """
00162     unpack serialized message in str into this message instance using numpy for array types
00163     :param str: byte array of serialized message, ``str``
00164     :param numpy: numpy python module
00165     """
00166     try:
00167       end = 0
00168       start = end
00169       end += 4
00170       (length,) = _struct_I.unpack(str[start:end])
00171       start = end
00172       end += length
00173       if python3:
00174         self.command = str[start:end].decode('utf-8')
00175       else:
00176         self.command = str[start:end]
00177       start = end
00178       end += 4
00179       (length,) = _struct_I.unpack(str[start:end])
00180       start = end
00181       end += length
00182       if python3:
00183         self.ID = str[start:end].decode('utf-8')
00184       else:
00185         self.ID = str[start:end]
00186       start = end
00187       end += 4
00188       (length,) = _struct_I.unpack(str[start:end])
00189       self.selectedTopics = []
00190       for i in range(0, length):
00191         start = end
00192         end += 4
00193         (length,) = _struct_I.unpack(str[start:end])
00194         start = end
00195         end += length
00196         if python3:
00197           val1 = str[start:end].decode('utf-8')
00198         else:
00199           val1 = str[start:end]
00200         self.selectedTopics.append(val1)
00201       return self
00202     except struct.error as e:
00203       raise genpy.DeserializationError(e) #most likely buffer underfill
00204 
00205 _struct_I = genpy.struct_I


topic_logger
Author(s): Ralf Kempf Maintained by Sarah Osentoski and Ben Pitzer
autogenerated on Sun Jan 5 2014 11:33:05