00001 """autogenerated by genpy from pddl_msgs/PDDLPlannerResult.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 pddl_msgs.msg
00008
00009 class PDDLPlannerResult(genpy.Message):
00010 _md5sum = "cf11fb9ecdccedc75863b5a28d8a78c1"
00011 _type = "pddl_msgs/PDDLPlannerResult"
00012 _has_header = False
00013 _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00014 #result
00015 string[] data
00016 pddl_msgs/PDDLStep[] sequence
00017
00018 ================================================================================
00019 MSG: pddl_msgs/PDDLStep
00020 string action
00021 string[] args
00022
00023 """
00024 __slots__ = ['data','sequence']
00025 _slot_types = ['string[]','pddl_msgs/PDDLStep[]']
00026
00027 def __init__(self, *args, **kwds):
00028 """
00029 Constructor. Any message fields that are implicitly/explicitly
00030 set to None will be assigned a default value. The recommend
00031 use is keyword arguments as this is more robust to future message
00032 changes. You cannot mix in-order arguments and keyword arguments.
00033
00034 The available fields are:
00035 data,sequence
00036
00037 :param args: complete set of field values, in .msg order
00038 :param kwds: use keyword arguments corresponding to message field names
00039 to set specific fields.
00040 """
00041 if args or kwds:
00042 super(PDDLPlannerResult, self).__init__(*args, **kwds)
00043
00044 if self.data is None:
00045 self.data = []
00046 if self.sequence is None:
00047 self.sequence = []
00048 else:
00049 self.data = []
00050 self.sequence = []
00051
00052 def _get_types(self):
00053 """
00054 internal API method
00055 """
00056 return self._slot_types
00057
00058 def serialize(self, buff):
00059 """
00060 serialize message into buffer
00061 :param buff: buffer, ``StringIO``
00062 """
00063 try:
00064 length = len(self.data)
00065 buff.write(_struct_I.pack(length))
00066 for val1 in self.data:
00067 length = len(val1)
00068 if python3 or type(val1) == unicode:
00069 val1 = val1.encode('utf-8')
00070 length = len(val1)
00071 buff.write(struct.pack('<I%ss'%length, length, val1))
00072 length = len(self.sequence)
00073 buff.write(_struct_I.pack(length))
00074 for val1 in self.sequence:
00075 _x = val1.action
00076 length = len(_x)
00077 if python3 or type(_x) == unicode:
00078 _x = _x.encode('utf-8')
00079 length = len(_x)
00080 buff.write(struct.pack('<I%ss'%length, length, _x))
00081 length = len(val1.args)
00082 buff.write(_struct_I.pack(length))
00083 for val2 in val1.args:
00084 length = len(val2)
00085 if python3 or type(val2) == unicode:
00086 val2 = val2.encode('utf-8')
00087 length = len(val2)
00088 buff.write(struct.pack('<I%ss'%length, length, val2))
00089 except struct.error as se: self._check_types(se)
00090 except TypeError as te: self._check_types(te)
00091
00092 def deserialize(self, str):
00093 """
00094 unpack serialized message in str into this message instance
00095 :param str: byte array of serialized message, ``str``
00096 """
00097 try:
00098 if self.sequence is None:
00099 self.sequence = None
00100 end = 0
00101 start = end
00102 end += 4
00103 (length,) = _struct_I.unpack(str[start:end])
00104 self.data = []
00105 for i in range(0, length):
00106 start = end
00107 end += 4
00108 (length,) = _struct_I.unpack(str[start:end])
00109 start = end
00110 end += length
00111 if python3:
00112 val1 = str[start:end].decode('utf-8')
00113 else:
00114 val1 = str[start:end]
00115 self.data.append(val1)
00116 start = end
00117 end += 4
00118 (length,) = _struct_I.unpack(str[start:end])
00119 self.sequence = []
00120 for i in range(0, length):
00121 val1 = pddl_msgs.msg.PDDLStep()
00122 start = end
00123 end += 4
00124 (length,) = _struct_I.unpack(str[start:end])
00125 start = end
00126 end += length
00127 if python3:
00128 val1.action = str[start:end].decode('utf-8')
00129 else:
00130 val1.action = str[start:end]
00131 start = end
00132 end += 4
00133 (length,) = _struct_I.unpack(str[start:end])
00134 val1.args = []
00135 for i in range(0, length):
00136 start = end
00137 end += 4
00138 (length,) = _struct_I.unpack(str[start:end])
00139 start = end
00140 end += length
00141 if python3:
00142 val2 = str[start:end].decode('utf-8')
00143 else:
00144 val2 = str[start:end]
00145 val1.args.append(val2)
00146 self.sequence.append(val1)
00147 return self
00148 except struct.error as e:
00149 raise genpy.DeserializationError(e)
00150
00151
00152 def serialize_numpy(self, buff, numpy):
00153 """
00154 serialize message with numpy array types into buffer
00155 :param buff: buffer, ``StringIO``
00156 :param numpy: numpy python module
00157 """
00158 try:
00159 length = len(self.data)
00160 buff.write(_struct_I.pack(length))
00161 for val1 in self.data:
00162 length = len(val1)
00163 if python3 or type(val1) == unicode:
00164 val1 = val1.encode('utf-8')
00165 length = len(val1)
00166 buff.write(struct.pack('<I%ss'%length, length, val1))
00167 length = len(self.sequence)
00168 buff.write(_struct_I.pack(length))
00169 for val1 in self.sequence:
00170 _x = val1.action
00171 length = len(_x)
00172 if python3 or type(_x) == unicode:
00173 _x = _x.encode('utf-8')
00174 length = len(_x)
00175 buff.write(struct.pack('<I%ss'%length, length, _x))
00176 length = len(val1.args)
00177 buff.write(_struct_I.pack(length))
00178 for val2 in val1.args:
00179 length = len(val2)
00180 if python3 or type(val2) == unicode:
00181 val2 = val2.encode('utf-8')
00182 length = len(val2)
00183 buff.write(struct.pack('<I%ss'%length, length, val2))
00184 except struct.error as se: self._check_types(se)
00185 except TypeError as te: self._check_types(te)
00186
00187 def deserialize_numpy(self, str, numpy):
00188 """
00189 unpack serialized message in str into this message instance using numpy for array types
00190 :param str: byte array of serialized message, ``str``
00191 :param numpy: numpy python module
00192 """
00193 try:
00194 if self.sequence is None:
00195 self.sequence = None
00196 end = 0
00197 start = end
00198 end += 4
00199 (length,) = _struct_I.unpack(str[start:end])
00200 self.data = []
00201 for i in range(0, length):
00202 start = end
00203 end += 4
00204 (length,) = _struct_I.unpack(str[start:end])
00205 start = end
00206 end += length
00207 if python3:
00208 val1 = str[start:end].decode('utf-8')
00209 else:
00210 val1 = str[start:end]
00211 self.data.append(val1)
00212 start = end
00213 end += 4
00214 (length,) = _struct_I.unpack(str[start:end])
00215 self.sequence = []
00216 for i in range(0, length):
00217 val1 = pddl_msgs.msg.PDDLStep()
00218 start = end
00219 end += 4
00220 (length,) = _struct_I.unpack(str[start:end])
00221 start = end
00222 end += length
00223 if python3:
00224 val1.action = str[start:end].decode('utf-8')
00225 else:
00226 val1.action = str[start:end]
00227 start = end
00228 end += 4
00229 (length,) = _struct_I.unpack(str[start:end])
00230 val1.args = []
00231 for i in range(0, length):
00232 start = end
00233 end += 4
00234 (length,) = _struct_I.unpack(str[start:end])
00235 start = end
00236 end += length
00237 if python3:
00238 val2 = str[start:end].decode('utf-8')
00239 else:
00240 val2 = str[start:end]
00241 val1.args.append(val2)
00242 self.sequence.append(val1)
00243 return self
00244 except struct.error as e:
00245 raise genpy.DeserializationError(e)
00246
00247 _struct_I = genpy.struct_I