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