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