_EmptySemanticFrame.py
Go to the documentation of this file.
00001 """autogenerated by genpy from roboframenet_msgs/EmptySemanticFrame.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 EmptySemanticFrame(genpy.Message):
00010   _md5sum = "7e363b67e656a5799fe51a2012c51f8a"
00011   _type = "roboframenet_msgs/EmptySemanticFrame"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """string name
00014 EmptyFrameElement[] frame_elements
00015 
00016 ================================================================================
00017 MSG: roboframenet_msgs/EmptyFrameElement
00018 string name   # eg object, recipient
00019 string default
00020 bool is_core
00021 
00022 """
00023   __slots__ = ['name','frame_elements']
00024   _slot_types = ['string','roboframenet_msgs/EmptyFrameElement[]']
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        name,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(EmptySemanticFrame, self).__init__(*args, **kwds)
00042       #message fields cannot be None, assign default values for those that are
00043       if self.name is None:
00044         self.name = ''
00045       if self.frame_elements is None:
00046         self.frame_elements = []
00047     else:
00048       self.name = ''
00049       self.frame_elements = []
00050 
00051   def _get_types(self):
00052     """
00053     internal API method
00054     """
00055     return self._slot_types
00056 
00057   def serialize(self, buff):
00058     """
00059     serialize message into buffer
00060     :param buff: buffer, ``StringIO``
00061     """
00062     try:
00063       _x = self.name
00064       length = len(_x)
00065       if python3 or type(_x) == unicode:
00066         _x = _x.encode('utf-8')
00067         length = len(_x)
00068       buff.write(struct.pack('<I%ss'%length, length, _x))
00069       length = len(self.frame_elements)
00070       buff.write(_struct_I.pack(length))
00071       for val1 in self.frame_elements:
00072         _x = val1.name
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         _x = val1.default
00079         length = len(_x)
00080         if python3 or type(_x) == unicode:
00081           _x = _x.encode('utf-8')
00082           length = len(_x)
00083         buff.write(struct.pack('<I%ss'%length, length, _x))
00084         buff.write(_struct_B.pack(val1.is_core))
00085     except struct.error as se: self._check_types(se)
00086     except TypeError as te: self._check_types(te)
00087 
00088   def deserialize(self, str):
00089     """
00090     unpack serialized message in str into this message instance
00091     :param str: byte array of serialized message, ``str``
00092     """
00093     try:
00094       if self.frame_elements is None:
00095         self.frame_elements = None
00096       end = 0
00097       start = end
00098       end += 4
00099       (length,) = _struct_I.unpack(str[start:end])
00100       start = end
00101       end += length
00102       if python3:
00103         self.name = str[start:end].decode('utf-8')
00104       else:
00105         self.name = str[start:end]
00106       start = end
00107       end += 4
00108       (length,) = _struct_I.unpack(str[start:end])
00109       self.frame_elements = []
00110       for i in range(0, length):
00111         val1 = roboframenet_msgs.msg.EmptyFrameElement()
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.name = str[start:end].decode('utf-8')
00119         else:
00120           val1.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.default = str[start:end].decode('utf-8')
00128         else:
00129           val1.default = str[start:end]
00130         start = end
00131         end += 1
00132         (val1.is_core,) = _struct_B.unpack(str[start:end])
00133         val1.is_core = bool(val1.is_core)
00134         self.frame_elements.append(val1)
00135       return self
00136     except struct.error as e:
00137       raise genpy.DeserializationError(e) #most likely buffer underfill
00138 
00139 
00140   def serialize_numpy(self, buff, numpy):
00141     """
00142     serialize message with numpy array types into buffer
00143     :param buff: buffer, ``StringIO``
00144     :param numpy: numpy python module
00145     """
00146     try:
00147       _x = self.name
00148       length = len(_x)
00149       if python3 or type(_x) == unicode:
00150         _x = _x.encode('utf-8')
00151         length = len(_x)
00152       buff.write(struct.pack('<I%ss'%length, length, _x))
00153       length = len(self.frame_elements)
00154       buff.write(_struct_I.pack(length))
00155       for val1 in self.frame_elements:
00156         _x = val1.name
00157         length = len(_x)
00158         if python3 or type(_x) == unicode:
00159           _x = _x.encode('utf-8')
00160           length = len(_x)
00161         buff.write(struct.pack('<I%ss'%length, length, _x))
00162         _x = val1.default
00163         length = len(_x)
00164         if python3 or type(_x) == unicode:
00165           _x = _x.encode('utf-8')
00166           length = len(_x)
00167         buff.write(struct.pack('<I%ss'%length, length, _x))
00168         buff.write(_struct_B.pack(val1.is_core))
00169     except struct.error as se: self._check_types(se)
00170     except TypeError as te: self._check_types(te)
00171 
00172   def deserialize_numpy(self, str, numpy):
00173     """
00174     unpack serialized message in str into this message instance using numpy for array types
00175     :param str: byte array of serialized message, ``str``
00176     :param numpy: numpy python module
00177     """
00178     try:
00179       if self.frame_elements is None:
00180         self.frame_elements = None
00181       end = 0
00182       start = end
00183       end += 4
00184       (length,) = _struct_I.unpack(str[start:end])
00185       start = end
00186       end += length
00187       if python3:
00188         self.name = str[start:end].decode('utf-8')
00189       else:
00190         self.name = str[start:end]
00191       start = end
00192       end += 4
00193       (length,) = _struct_I.unpack(str[start:end])
00194       self.frame_elements = []
00195       for i in range(0, length):
00196         val1 = roboframenet_msgs.msg.EmptyFrameElement()
00197         start = end
00198         end += 4
00199         (length,) = _struct_I.unpack(str[start:end])
00200         start = end
00201         end += length
00202         if python3:
00203           val1.name = str[start:end].decode('utf-8')
00204         else:
00205           val1.name = str[start:end]
00206         start = end
00207         end += 4
00208         (length,) = _struct_I.unpack(str[start:end])
00209         start = end
00210         end += length
00211         if python3:
00212           val1.default = str[start:end].decode('utf-8')
00213         else:
00214           val1.default = str[start:end]
00215         start = end
00216         end += 1
00217         (val1.is_core,) = _struct_B.unpack(str[start:end])
00218         val1.is_core = bool(val1.is_core)
00219         self.frame_elements.append(val1)
00220       return self
00221     except struct.error as e:
00222       raise genpy.DeserializationError(e) #most likely buffer underfill
00223 
00224 _struct_I = genpy.struct_I
00225 _struct_B = struct.Struct("<B")


roboframenet_msgs
Author(s): Brian Thomas
autogenerated on Fri Dec 6 2013 20:32:42