Go to the documentation of this file.00001 """autogenerated by genpy from demo_msgs/ListTasks.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007 import demo_msgs.msg
00008
00009 class ListTasks(genpy.Message):
00010 _md5sum = "6f8c4b4a4010a09d0fb694e49e8bc30c"
00011 _type = "demo_msgs/ListTasks"
00012 _has_header = False
00013 _full_text = """Task[] tasks
00014
00015 ================================================================================
00016 MSG: demo_msgs/Task
00017 int16 task_id
00018 string status
00019
00020 """
00021 __slots__ = ['tasks']
00022 _slot_types = ['demo_msgs/Task[]']
00023
00024 def __init__(self, *args, **kwds):
00025 """
00026 Constructor. Any message fields that are implicitly/explicitly
00027 set to None will be assigned a default value. The recommend
00028 use is keyword arguments as this is more robust to future message
00029 changes. You cannot mix in-order arguments and keyword arguments.
00030
00031 The available fields are:
00032 tasks
00033
00034 :param args: complete set of field values, in .msg order
00035 :param kwds: use keyword arguments corresponding to message field names
00036 to set specific fields.
00037 """
00038 if args or kwds:
00039 super(ListTasks, self).__init__(*args, **kwds)
00040
00041 if self.tasks is None:
00042 self.tasks = []
00043 else:
00044 self.tasks = []
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.tasks)
00059 buff.write(_struct_I.pack(length))
00060 for val1 in self.tasks:
00061 buff.write(_struct_h.pack(val1.task_id))
00062 _x = val1.status
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 except struct.error as se: self._check_types(se)
00069 except TypeError as te: self._check_types(te)
00070
00071 def deserialize(self, str):
00072 """
00073 unpack serialized message in str into this message instance
00074 :param str: byte array of serialized message, ``str``
00075 """
00076 try:
00077 if self.tasks is None:
00078 self.tasks = None
00079 end = 0
00080 start = end
00081 end += 4
00082 (length,) = _struct_I.unpack(str[start:end])
00083 self.tasks = []
00084 for i in range(0, length):
00085 val1 = demo_msgs.msg.Task()
00086 start = end
00087 end += 2
00088 (val1.task_id,) = _struct_h.unpack(str[start:end])
00089 start = end
00090 end += 4
00091 (length,) = _struct_I.unpack(str[start:end])
00092 start = end
00093 end += length
00094 if python3:
00095 val1.status = str[start:end].decode('utf-8')
00096 else:
00097 val1.status = str[start:end]
00098 self.tasks.append(val1)
00099 return self
00100 except struct.error as e:
00101 raise genpy.DeserializationError(e)
00102
00103
00104 def serialize_numpy(self, buff, numpy):
00105 """
00106 serialize message with numpy array types into buffer
00107 :param buff: buffer, ``StringIO``
00108 :param numpy: numpy python module
00109 """
00110 try:
00111 length = len(self.tasks)
00112 buff.write(_struct_I.pack(length))
00113 for val1 in self.tasks:
00114 buff.write(_struct_h.pack(val1.task_id))
00115 _x = val1.status
00116 length = len(_x)
00117 if python3 or type(_x) == unicode:
00118 _x = _x.encode('utf-8')
00119 length = len(_x)
00120 buff.write(struct.pack('<I%ss'%length, length, _x))
00121 except struct.error as se: self._check_types(se)
00122 except TypeError as te: self._check_types(te)
00123
00124 def deserialize_numpy(self, str, numpy):
00125 """
00126 unpack serialized message in str into this message instance using numpy for array types
00127 :param str: byte array of serialized message, ``str``
00128 :param numpy: numpy python module
00129 """
00130 try:
00131 if self.tasks is None:
00132 self.tasks = None
00133 end = 0
00134 start = end
00135 end += 4
00136 (length,) = _struct_I.unpack(str[start:end])
00137 self.tasks = []
00138 for i in range(0, length):
00139 val1 = demo_msgs.msg.Task()
00140 start = end
00141 end += 2
00142 (val1.task_id,) = _struct_h.unpack(str[start:end])
00143 start = end
00144 end += 4
00145 (length,) = _struct_I.unpack(str[start:end])
00146 start = end
00147 end += length
00148 if python3:
00149 val1.status = str[start:end].decode('utf-8')
00150 else:
00151 val1.status = str[start:end]
00152 self.tasks.append(val1)
00153 return self
00154 except struct.error as e:
00155 raise genpy.DeserializationError(e)
00156
00157 _struct_I = genpy.struct_I
00158 _struct_h = struct.Struct("<h")