00001 """autogenerated by genpy from roboframenet_msgs/FilledLexicalUnitList.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 FilledLexicalUnitList(genpy.Message):
00010 _md5sum = "ef58cd811a0a319433ad38d92b17ad4a"
00011 _type = "roboframenet_msgs/FilledLexicalUnitList"
00012 _has_header = False
00013 _full_text = """FilledLexicalUnit[] lexical_units
00014
00015 ================================================================================
00016 MSG: roboframenet_msgs/FilledLexicalUnit
00017 string frame_name
00018 string verb
00019 FilledFrameElement[] frame_elements
00020
00021 ================================================================================
00022 MSG: roboframenet_msgs/FilledFrameElement
00023 string name # eg object, recipient
00024 string argument # eg apple, bob
00025
00026 """
00027 __slots__ = ['lexical_units']
00028 _slot_types = ['roboframenet_msgs/FilledLexicalUnit[]']
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 lexical_units
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(FilledLexicalUnitList, self).__init__(*args, **kwds)
00046
00047 if self.lexical_units is None:
00048 self.lexical_units = []
00049 else:
00050 self.lexical_units = []
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.lexical_units)
00065 buff.write(_struct_I.pack(length))
00066 for val1 in self.lexical_units:
00067 _x = val1.frame_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 _x = val1.verb
00074 length = len(_x)
00075 if python3 or type(_x) == unicode:
00076 _x = _x.encode('utf-8')
00077 length = len(_x)
00078 buff.write(struct.pack('<I%ss'%length, length, _x))
00079 length = len(val1.frame_elements)
00080 buff.write(_struct_I.pack(length))
00081 for val2 in val1.frame_elements:
00082 _x = val2.name
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 _x = val2.argument
00089 length = len(_x)
00090 if python3 or type(_x) == unicode:
00091 _x = _x.encode('utf-8')
00092 length = len(_x)
00093 buff.write(struct.pack('<I%ss'%length, length, _x))
00094 except struct.error as se: self._check_types(se)
00095 except TypeError as te: self._check_types(te)
00096
00097 def deserialize(self, str):
00098 """
00099 unpack serialized message in str into this message instance
00100 :param str: byte array of serialized message, ``str``
00101 """
00102 try:
00103 if self.lexical_units is None:
00104 self.lexical_units = None
00105 end = 0
00106 start = end
00107 end += 4
00108 (length,) = _struct_I.unpack(str[start:end])
00109 self.lexical_units = []
00110 for i in range(0, length):
00111 val1 = roboframenet_msgs.msg.FilledLexicalUnit()
00112 start = end
00113 end += 4
00114 (length,) = _struct_I.unpack(str[start:end])
00115 start = end
00116 end += length
00117 if python3:
00118 val1.frame_name = str[start:end].decode('utf-8')
00119 else:
00120 val1.frame_name = str[start:end]
00121 start = end
00122 end += 4
00123 (length,) = _struct_I.unpack(str[start:end])
00124 start = end
00125 end += length
00126 if python3:
00127 val1.verb = str[start:end].decode('utf-8')
00128 else:
00129 val1.verb = str[start:end]
00130 start = end
00131 end += 4
00132 (length,) = _struct_I.unpack(str[start:end])
00133 val1.frame_elements = []
00134 for i in range(0, length):
00135 val2 = roboframenet_msgs.msg.FilledFrameElement()
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.name = str[start:end].decode('utf-8')
00143 else:
00144 val2.name = str[start:end]
00145 start = end
00146 end += 4
00147 (length,) = _struct_I.unpack(str[start:end])
00148 start = end
00149 end += length
00150 if python3:
00151 val2.argument = str[start:end].decode('utf-8')
00152 else:
00153 val2.argument = str[start:end]
00154 val1.frame_elements.append(val2)
00155 self.lexical_units.append(val1)
00156 return self
00157 except struct.error as e:
00158 raise genpy.DeserializationError(e)
00159
00160
00161 def serialize_numpy(self, buff, numpy):
00162 """
00163 serialize message with numpy array types into buffer
00164 :param buff: buffer, ``StringIO``
00165 :param numpy: numpy python module
00166 """
00167 try:
00168 length = len(self.lexical_units)
00169 buff.write(_struct_I.pack(length))
00170 for val1 in self.lexical_units:
00171 _x = val1.frame_name
00172 length = len(_x)
00173 if python3 or type(_x) == unicode:
00174 _x = _x.encode('utf-8')
00175 length = len(_x)
00176 buff.write(struct.pack('<I%ss'%length, length, _x))
00177 _x = val1.verb
00178 length = len(_x)
00179 if python3 or type(_x) == unicode:
00180 _x = _x.encode('utf-8')
00181 length = len(_x)
00182 buff.write(struct.pack('<I%ss'%length, length, _x))
00183 length = len(val1.frame_elements)
00184 buff.write(_struct_I.pack(length))
00185 for val2 in val1.frame_elements:
00186 _x = val2.name
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 = val2.argument
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 except struct.error as se: self._check_types(se)
00199 except TypeError as te: self._check_types(te)
00200
00201 def deserialize_numpy(self, str, numpy):
00202 """
00203 unpack serialized message in str into this message instance using numpy for array types
00204 :param str: byte array of serialized message, ``str``
00205 :param numpy: numpy python module
00206 """
00207 try:
00208 if self.lexical_units is None:
00209 self.lexical_units = None
00210 end = 0
00211 start = end
00212 end += 4
00213 (length,) = _struct_I.unpack(str[start:end])
00214 self.lexical_units = []
00215 for i in range(0, length):
00216 val1 = roboframenet_msgs.msg.FilledLexicalUnit()
00217 start = end
00218 end += 4
00219 (length,) = _struct_I.unpack(str[start:end])
00220 start = end
00221 end += length
00222 if python3:
00223 val1.frame_name = str[start:end].decode('utf-8')
00224 else:
00225 val1.frame_name = str[start:end]
00226 start = end
00227 end += 4
00228 (length,) = _struct_I.unpack(str[start:end])
00229 start = end
00230 end += length
00231 if python3:
00232 val1.verb = str[start:end].decode('utf-8')
00233 else:
00234 val1.verb = str[start:end]
00235 start = end
00236 end += 4
00237 (length,) = _struct_I.unpack(str[start:end])
00238 val1.frame_elements = []
00239 for i in range(0, length):
00240 val2 = roboframenet_msgs.msg.FilledFrameElement()
00241 start = end
00242 end += 4
00243 (length,) = _struct_I.unpack(str[start:end])
00244 start = end
00245 end += length
00246 if python3:
00247 val2.name = str[start:end].decode('utf-8')
00248 else:
00249 val2.name = 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 val2.argument = str[start:end].decode('utf-8')
00257 else:
00258 val2.argument = str[start:end]
00259 val1.frame_elements.append(val2)
00260 self.lexical_units.append(val1)
00261 return self
00262 except struct.error as e:
00263 raise genpy.DeserializationError(e)
00264
00265 _struct_I = genpy.struct_I