00001 """autogenerated by genpy from roboframenet_msgs/Procedure.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 roboframenet_msgs.msg
00008
00009 class Procedure(genpy.Message):
00010 _md5sum = "737111e9f6697d31eca2c3093b6a96ef"
00011 _type = "roboframenet_msgs/Procedure"
00012 _has_header = False
00013 _full_text = """# A Procedure is a listof(listof(FilledSemanticFrame)).
00014 # Each outer list is a sequence of FilledSemanticFrame which should be
00015 # executed in-order.
00016 # To run a procedure, execute each outer list's FilledSemanticFrame-s in
00017 # order. If any FilledSemanticFrame on a given outer list fails,
00018 # continue at the start of the next outer list. Stop running the
00019 # procedure if all of an outer list's frames succeed (success) or
00020 # if all outer lists have been exhausted (failure).
00021 FilledSemanticFrameList[] frame_lists
00022 ================================================================================
00023 MSG: roboframenet_msgs/FilledSemanticFrameList
00024 FilledSemanticFrame[] frames
00025
00026 ================================================================================
00027 MSG: roboframenet_msgs/FilledSemanticFrame
00028 string name
00029 FilledFrameElement[] frame_elements
00030 string[] action_server_topics
00031
00032 ================================================================================
00033 MSG: roboframenet_msgs/FilledFrameElement
00034 string name # eg object, recipient
00035 string argument # eg apple, bob
00036
00037 """
00038 __slots__ = ['frame_lists']
00039 _slot_types = ['roboframenet_msgs/FilledSemanticFrameList[]']
00040
00041 def __init__(self, *args, **kwds):
00042 """
00043 Constructor. Any message fields that are implicitly/explicitly
00044 set to None will be assigned a default value. The recommend
00045 use is keyword arguments as this is more robust to future message
00046 changes. You cannot mix in-order arguments and keyword arguments.
00047
00048 The available fields are:
00049 frame_lists
00050
00051 :param args: complete set of field values, in .msg order
00052 :param kwds: use keyword arguments corresponding to message field names
00053 to set specific fields.
00054 """
00055 if args or kwds:
00056 super(Procedure, self).__init__(*args, **kwds)
00057
00058 if self.frame_lists is None:
00059 self.frame_lists = []
00060 else:
00061 self.frame_lists = []
00062
00063 def _get_types(self):
00064 """
00065 internal API method
00066 """
00067 return self._slot_types
00068
00069 def serialize(self, buff):
00070 """
00071 serialize message into buffer
00072 :param buff: buffer, ``StringIO``
00073 """
00074 try:
00075 length = len(self.frame_lists)
00076 buff.write(_struct_I.pack(length))
00077 for val1 in self.frame_lists:
00078 length = len(val1.frames)
00079 buff.write(_struct_I.pack(length))
00080 for val2 in val1.frames:
00081 _x = val2.name
00082 length = len(_x)
00083 if python3 or type(_x) == unicode:
00084 _x = _x.encode('utf-8')
00085 length = len(_x)
00086 buff.write(struct.pack('<I%ss'%length, length, _x))
00087 length = len(val2.frame_elements)
00088 buff.write(_struct_I.pack(length))
00089 for val3 in val2.frame_elements:
00090 _x = val3.name
00091 length = len(_x)
00092 if python3 or type(_x) == unicode:
00093 _x = _x.encode('utf-8')
00094 length = len(_x)
00095 buff.write(struct.pack('<I%ss'%length, length, _x))
00096 _x = val3.argument
00097 length = len(_x)
00098 if python3 or type(_x) == unicode:
00099 _x = _x.encode('utf-8')
00100 length = len(_x)
00101 buff.write(struct.pack('<I%ss'%length, length, _x))
00102 length = len(val2.action_server_topics)
00103 buff.write(_struct_I.pack(length))
00104 for val3 in val2.action_server_topics:
00105 length = len(val3)
00106 if python3 or type(val3) == unicode:
00107 val3 = val3.encode('utf-8')
00108 length = len(val3)
00109 buff.write(struct.pack('<I%ss'%length, length, val3))
00110 except struct.error as se: self._check_types(se)
00111 except TypeError as te: self._check_types(te)
00112
00113 def deserialize(self, str):
00114 """
00115 unpack serialized message in str into this message instance
00116 :param str: byte array of serialized message, ``str``
00117 """
00118 try:
00119 if self.frame_lists is None:
00120 self.frame_lists = None
00121 end = 0
00122 start = end
00123 end += 4
00124 (length,) = _struct_I.unpack(str[start:end])
00125 self.frame_lists = []
00126 for i in range(0, length):
00127 val1 = roboframenet_msgs.msg.FilledSemanticFrameList()
00128 start = end
00129 end += 4
00130 (length,) = _struct_I.unpack(str[start:end])
00131 val1.frames = []
00132 for i in range(0, length):
00133 val2 = roboframenet_msgs.msg.FilledSemanticFrame()
00134 start = end
00135 end += 4
00136 (length,) = _struct_I.unpack(str[start:end])
00137 start = end
00138 end += length
00139 if python3:
00140 val2.name = str[start:end].decode('utf-8')
00141 else:
00142 val2.name = str[start:end]
00143 start = end
00144 end += 4
00145 (length,) = _struct_I.unpack(str[start:end])
00146 val2.frame_elements = []
00147 for i in range(0, length):
00148 val3 = roboframenet_msgs.msg.FilledFrameElement()
00149 start = end
00150 end += 4
00151 (length,) = _struct_I.unpack(str[start:end])
00152 start = end
00153 end += length
00154 if python3:
00155 val3.name = str[start:end].decode('utf-8')
00156 else:
00157 val3.name = str[start:end]
00158 start = end
00159 end += 4
00160 (length,) = _struct_I.unpack(str[start:end])
00161 start = end
00162 end += length
00163 if python3:
00164 val3.argument = str[start:end].decode('utf-8')
00165 else:
00166 val3.argument = str[start:end]
00167 val2.frame_elements.append(val3)
00168 start = end
00169 end += 4
00170 (length,) = _struct_I.unpack(str[start:end])
00171 val2.action_server_topics = []
00172 for i in range(0, length):
00173 start = end
00174 end += 4
00175 (length,) = _struct_I.unpack(str[start:end])
00176 start = end
00177 end += length
00178 if python3:
00179 val3 = str[start:end].decode('utf-8')
00180 else:
00181 val3 = str[start:end]
00182 val2.action_server_topics.append(val3)
00183 val1.frames.append(val2)
00184 self.frame_lists.append(val1)
00185 return self
00186 except struct.error as e:
00187 raise genpy.DeserializationError(e)
00188
00189
00190 def serialize_numpy(self, buff, numpy):
00191 """
00192 serialize message with numpy array types into buffer
00193 :param buff: buffer, ``StringIO``
00194 :param numpy: numpy python module
00195 """
00196 try:
00197 length = len(self.frame_lists)
00198 buff.write(_struct_I.pack(length))
00199 for val1 in self.frame_lists:
00200 length = len(val1.frames)
00201 buff.write(_struct_I.pack(length))
00202 for val2 in val1.frames:
00203 _x = val2.name
00204 length = len(_x)
00205 if python3 or type(_x) == unicode:
00206 _x = _x.encode('utf-8')
00207 length = len(_x)
00208 buff.write(struct.pack('<I%ss'%length, length, _x))
00209 length = len(val2.frame_elements)
00210 buff.write(_struct_I.pack(length))
00211 for val3 in val2.frame_elements:
00212 _x = val3.name
00213 length = len(_x)
00214 if python3 or type(_x) == unicode:
00215 _x = _x.encode('utf-8')
00216 length = len(_x)
00217 buff.write(struct.pack('<I%ss'%length, length, _x))
00218 _x = val3.argument
00219 length = len(_x)
00220 if python3 or type(_x) == unicode:
00221 _x = _x.encode('utf-8')
00222 length = len(_x)
00223 buff.write(struct.pack('<I%ss'%length, length, _x))
00224 length = len(val2.action_server_topics)
00225 buff.write(_struct_I.pack(length))
00226 for val3 in val2.action_server_topics:
00227 length = len(val3)
00228 if python3 or type(val3) == unicode:
00229 val3 = val3.encode('utf-8')
00230 length = len(val3)
00231 buff.write(struct.pack('<I%ss'%length, length, val3))
00232 except struct.error as se: self._check_types(se)
00233 except TypeError as te: self._check_types(te)
00234
00235 def deserialize_numpy(self, str, numpy):
00236 """
00237 unpack serialized message in str into this message instance using numpy for array types
00238 :param str: byte array of serialized message, ``str``
00239 :param numpy: numpy python module
00240 """
00241 try:
00242 if self.frame_lists is None:
00243 self.frame_lists = None
00244 end = 0
00245 start = end
00246 end += 4
00247 (length,) = _struct_I.unpack(str[start:end])
00248 self.frame_lists = []
00249 for i in range(0, length):
00250 val1 = roboframenet_msgs.msg.FilledSemanticFrameList()
00251 start = end
00252 end += 4
00253 (length,) = _struct_I.unpack(str[start:end])
00254 val1.frames = []
00255 for i in range(0, length):
00256 val2 = roboframenet_msgs.msg.FilledSemanticFrame()
00257 start = end
00258 end += 4
00259 (length,) = _struct_I.unpack(str[start:end])
00260 start = end
00261 end += length
00262 if python3:
00263 val2.name = str[start:end].decode('utf-8')
00264 else:
00265 val2.name = str[start:end]
00266 start = end
00267 end += 4
00268 (length,) = _struct_I.unpack(str[start:end])
00269 val2.frame_elements = []
00270 for i in range(0, length):
00271 val3 = roboframenet_msgs.msg.FilledFrameElement()
00272 start = end
00273 end += 4
00274 (length,) = _struct_I.unpack(str[start:end])
00275 start = end
00276 end += length
00277 if python3:
00278 val3.name = str[start:end].decode('utf-8')
00279 else:
00280 val3.name = str[start:end]
00281 start = end
00282 end += 4
00283 (length,) = _struct_I.unpack(str[start:end])
00284 start = end
00285 end += length
00286 if python3:
00287 val3.argument = str[start:end].decode('utf-8')
00288 else:
00289 val3.argument = str[start:end]
00290 val2.frame_elements.append(val3)
00291 start = end
00292 end += 4
00293 (length,) = _struct_I.unpack(str[start:end])
00294 val2.action_server_topics = []
00295 for i in range(0, length):
00296 start = end
00297 end += 4
00298 (length,) = _struct_I.unpack(str[start:end])
00299 start = end
00300 end += length
00301 if python3:
00302 val3 = str[start:end].decode('utf-8')
00303 else:
00304 val3 = str[start:end]
00305 val2.action_server_topics.append(val3)
00306 val1.frames.append(val2)
00307 self.frame_lists.append(val1)
00308 return self
00309 except struct.error as e:
00310 raise genpy.DeserializationError(e)
00311
00312 _struct_I = genpy.struct_I