_PropertyTuple.py
Go to the documentation of this file.
00001 """autogenerated by genpy from srs_knowledge/PropertyTuple.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class PropertyTuple(genpy.Message):
00009   _md5sum = "91ad9ce27eca861d92b46a6fbf01654d"
00010   _type = "srs_knowledge/PropertyTuple"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """string propertyName
00013 string dataType   # float, int32, string, Literal etc
00014 string value
00015 string propertyURI
00016 
00017 
00018 """
00019   __slots__ = ['propertyName','dataType','value','propertyURI']
00020   _slot_types = ['string','string','string','string']
00021 
00022   def __init__(self, *args, **kwds):
00023     """
00024     Constructor. Any message fields that are implicitly/explicitly
00025     set to None will be assigned a default value. The recommend
00026     use is keyword arguments as this is more robust to future message
00027     changes.  You cannot mix in-order arguments and keyword arguments.
00028 
00029     The available fields are:
00030        propertyName,dataType,value,propertyURI
00031 
00032     :param args: complete set of field values, in .msg order
00033     :param kwds: use keyword arguments corresponding to message field names
00034     to set specific fields.
00035     """
00036     if args or kwds:
00037       super(PropertyTuple, self).__init__(*args, **kwds)
00038       #message fields cannot be None, assign default values for those that are
00039       if self.propertyName is None:
00040         self.propertyName = ''
00041       if self.dataType is None:
00042         self.dataType = ''
00043       if self.value is None:
00044         self.value = ''
00045       if self.propertyURI is None:
00046         self.propertyURI = ''
00047     else:
00048       self.propertyName = ''
00049       self.dataType = ''
00050       self.value = ''
00051       self.propertyURI = ''
00052 
00053   def _get_types(self):
00054     """
00055     internal API method
00056     """
00057     return self._slot_types
00058 
00059   def serialize(self, buff):
00060     """
00061     serialize message into buffer
00062     :param buff: buffer, ``StringIO``
00063     """
00064     try:
00065       _x = self.propertyName
00066       length = len(_x)
00067       if python3 or type(_x) == unicode:
00068         _x = _x.encode('utf-8')
00069         length = len(_x)
00070       buff.write(struct.pack('<I%ss'%length, length, _x))
00071       _x = self.dataType
00072       length = len(_x)
00073       if python3 or type(_x) == unicode:
00074         _x = _x.encode('utf-8')
00075         length = len(_x)
00076       buff.write(struct.pack('<I%ss'%length, length, _x))
00077       _x = self.value
00078       length = len(_x)
00079       if python3 or type(_x) == unicode:
00080         _x = _x.encode('utf-8')
00081         length = len(_x)
00082       buff.write(struct.pack('<I%ss'%length, length, _x))
00083       _x = self.propertyURI
00084       length = len(_x)
00085       if python3 or type(_x) == unicode:
00086         _x = _x.encode('utf-8')
00087         length = len(_x)
00088       buff.write(struct.pack('<I%ss'%length, length, _x))
00089     except struct.error as se: self._check_types(se)
00090     except TypeError as te: self._check_types(te)
00091 
00092   def deserialize(self, str):
00093     """
00094     unpack serialized message in str into this message instance
00095     :param str: byte array of serialized message, ``str``
00096     """
00097     try:
00098       end = 0
00099       start = end
00100       end += 4
00101       (length,) = _struct_I.unpack(str[start:end])
00102       start = end
00103       end += length
00104       if python3:
00105         self.propertyName = str[start:end].decode('utf-8')
00106       else:
00107         self.propertyName = str[start:end]
00108       start = end
00109       end += 4
00110       (length,) = _struct_I.unpack(str[start:end])
00111       start = end
00112       end += length
00113       if python3:
00114         self.dataType = str[start:end].decode('utf-8')
00115       else:
00116         self.dataType = str[start:end]
00117       start = end
00118       end += 4
00119       (length,) = _struct_I.unpack(str[start:end])
00120       start = end
00121       end += length
00122       if python3:
00123         self.value = str[start:end].decode('utf-8')
00124       else:
00125         self.value = str[start:end]
00126       start = end
00127       end += 4
00128       (length,) = _struct_I.unpack(str[start:end])
00129       start = end
00130       end += length
00131       if python3:
00132         self.propertyURI = str[start:end].decode('utf-8')
00133       else:
00134         self.propertyURI = str[start:end]
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.propertyName
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       _x = self.dataType
00154       length = len(_x)
00155       if python3 or type(_x) == unicode:
00156         _x = _x.encode('utf-8')
00157         length = len(_x)
00158       buff.write(struct.pack('<I%ss'%length, length, _x))
00159       _x = self.value
00160       length = len(_x)
00161       if python3 or type(_x) == unicode:
00162         _x = _x.encode('utf-8')
00163         length = len(_x)
00164       buff.write(struct.pack('<I%ss'%length, length, _x))
00165       _x = self.propertyURI
00166       length = len(_x)
00167       if python3 or type(_x) == unicode:
00168         _x = _x.encode('utf-8')
00169         length = len(_x)
00170       buff.write(struct.pack('<I%ss'%length, length, _x))
00171     except struct.error as se: self._check_types(se)
00172     except TypeError as te: self._check_types(te)
00173 
00174   def deserialize_numpy(self, str, numpy):
00175     """
00176     unpack serialized message in str into this message instance using numpy for array types
00177     :param str: byte array of serialized message, ``str``
00178     :param numpy: numpy python module
00179     """
00180     try:
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.propertyName = str[start:end].decode('utf-8')
00189       else:
00190         self.propertyName = str[start:end]
00191       start = end
00192       end += 4
00193       (length,) = _struct_I.unpack(str[start:end])
00194       start = end
00195       end += length
00196       if python3:
00197         self.dataType = str[start:end].decode('utf-8')
00198       else:
00199         self.dataType = str[start:end]
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.value = str[start:end].decode('utf-8')
00207       else:
00208         self.value = 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.propertyURI = str[start:end].decode('utf-8')
00216       else:
00217         self.propertyURI = str[start:end]
00218       return self
00219     except struct.error as e:
00220       raise genpy.DeserializationError(e) #most likely buffer underfill
00221 
00222 _struct_I = genpy.struct_I


srs_knowledge
Author(s): Ze Ji
autogenerated on Sun Jan 5 2014 12:03:27