_TestValue.py
Go to the documentation of this file.
00001 """autogenerated by genpy from pr2_self_test_msgs/TestValue.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 TestValue(genpy.Message):
00009   _md5sum = "8fffe15af3a2ec4c24d3cf323fdfe721"
00010   _type = "pr2_self_test_msgs/TestValue"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# TestValue is recorded value during PR2 qualification
00013 string key
00014 string value
00015 string min
00016 string max
00017 """
00018   __slots__ = ['key','value','min','max']
00019   _slot_types = ['string','string','string','string']
00020 
00021   def __init__(self, *args, **kwds):
00022     """
00023     Constructor. Any message fields that are implicitly/explicitly
00024     set to None will be assigned a default value. The recommend
00025     use is keyword arguments as this is more robust to future message
00026     changes.  You cannot mix in-order arguments and keyword arguments.
00027 
00028     The available fields are:
00029        key,value,min,max
00030 
00031     :param args: complete set of field values, in .msg order
00032     :param kwds: use keyword arguments corresponding to message field names
00033     to set specific fields.
00034     """
00035     if args or kwds:
00036       super(TestValue, self).__init__(*args, **kwds)
00037       #message fields cannot be None, assign default values for those that are
00038       if self.key is None:
00039         self.key = ''
00040       if self.value is None:
00041         self.value = ''
00042       if self.min is None:
00043         self.min = ''
00044       if self.max is None:
00045         self.max = ''
00046     else:
00047       self.key = ''
00048       self.value = ''
00049       self.min = ''
00050       self.max = ''
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       _x = self.key
00065       length = len(_x)
00066       if python3 or type(_x) == unicode:
00067         _x = _x.encode('utf-8')
00068         length = len(_x)
00069       buff.write(struct.pack('<I%ss'%length, length, _x))
00070       _x = self.value
00071       length = len(_x)
00072       if python3 or type(_x) == unicode:
00073         _x = _x.encode('utf-8')
00074         length = len(_x)
00075       buff.write(struct.pack('<I%ss'%length, length, _x))
00076       _x = self.min
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 = self.max
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     except struct.error as se: self._check_types(se)
00089     except TypeError as te: self._check_types(te)
00090 
00091   def deserialize(self, str):
00092     """
00093     unpack serialized message in str into this message instance
00094     :param str: byte array of serialized message, ``str``
00095     """
00096     try:
00097       end = 0
00098       start = end
00099       end += 4
00100       (length,) = _struct_I.unpack(str[start:end])
00101       start = end
00102       end += length
00103       if python3:
00104         self.key = str[start:end].decode('utf-8')
00105       else:
00106         self.key = str[start:end]
00107       start = end
00108       end += 4
00109       (length,) = _struct_I.unpack(str[start:end])
00110       start = end
00111       end += length
00112       if python3:
00113         self.value = str[start:end].decode('utf-8')
00114       else:
00115         self.value = str[start:end]
00116       start = end
00117       end += 4
00118       (length,) = _struct_I.unpack(str[start:end])
00119       start = end
00120       end += length
00121       if python3:
00122         self.min = str[start:end].decode('utf-8')
00123       else:
00124         self.min = str[start:end]
00125       start = end
00126       end += 4
00127       (length,) = _struct_I.unpack(str[start:end])
00128       start = end
00129       end += length
00130       if python3:
00131         self.max = str[start:end].decode('utf-8')
00132       else:
00133         self.max = str[start:end]
00134       return self
00135     except struct.error as e:
00136       raise genpy.DeserializationError(e) #most likely buffer underfill
00137 
00138 
00139   def serialize_numpy(self, buff, numpy):
00140     """
00141     serialize message with numpy array types into buffer
00142     :param buff: buffer, ``StringIO``
00143     :param numpy: numpy python module
00144     """
00145     try:
00146       _x = self.key
00147       length = len(_x)
00148       if python3 or type(_x) == unicode:
00149         _x = _x.encode('utf-8')
00150         length = len(_x)
00151       buff.write(struct.pack('<I%ss'%length, length, _x))
00152       _x = self.value
00153       length = len(_x)
00154       if python3 or type(_x) == unicode:
00155         _x = _x.encode('utf-8')
00156         length = len(_x)
00157       buff.write(struct.pack('<I%ss'%length, length, _x))
00158       _x = self.min
00159       length = len(_x)
00160       if python3 or type(_x) == unicode:
00161         _x = _x.encode('utf-8')
00162         length = len(_x)
00163       buff.write(struct.pack('<I%ss'%length, length, _x))
00164       _x = self.max
00165       length = len(_x)
00166       if python3 or type(_x) == unicode:
00167         _x = _x.encode('utf-8')
00168         length = len(_x)
00169       buff.write(struct.pack('<I%ss'%length, length, _x))
00170     except struct.error as se: self._check_types(se)
00171     except TypeError as te: self._check_types(te)
00172 
00173   def deserialize_numpy(self, str, numpy):
00174     """
00175     unpack serialized message in str into this message instance using numpy for array types
00176     :param str: byte array of serialized message, ``str``
00177     :param numpy: numpy python module
00178     """
00179     try:
00180       end = 0
00181       start = end
00182       end += 4
00183       (length,) = _struct_I.unpack(str[start:end])
00184       start = end
00185       end += length
00186       if python3:
00187         self.key = str[start:end].decode('utf-8')
00188       else:
00189         self.key = str[start:end]
00190       start = end
00191       end += 4
00192       (length,) = _struct_I.unpack(str[start:end])
00193       start = end
00194       end += length
00195       if python3:
00196         self.value = str[start:end].decode('utf-8')
00197       else:
00198         self.value = str[start:end]
00199       start = end
00200       end += 4
00201       (length,) = _struct_I.unpack(str[start:end])
00202       start = end
00203       end += length
00204       if python3:
00205         self.min = str[start:end].decode('utf-8')
00206       else:
00207         self.min = str[start:end]
00208       start = end
00209       end += 4
00210       (length,) = _struct_I.unpack(str[start:end])
00211       start = end
00212       end += length
00213       if python3:
00214         self.max = str[start:end].decode('utf-8')
00215       else:
00216         self.max = str[start:end]
00217       return self
00218     except struct.error as e:
00219       raise genpy.DeserializationError(e) #most likely buffer underfill
00220 
00221 _struct_I = genpy.struct_I


pr2_self_test_msgs
Author(s): Kevin Watts
autogenerated on Sat Dec 28 2013 17:29:33