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