Go to the documentation of this file.00001 """autogenerated by genpy from geographic_msgs/KeyValue.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 KeyValue(genpy.Message):
00009 _md5sum = "cf57fdc6617a881a88c16e768132149c"
00010 _type = "geographic_msgs/KeyValue"
00011 _has_header = False
00012 _full_text = """# Geographic map tag (key, value) pair
00013 #
00014 # This is equivalent to diagnostic_msgs/KeyValue, repeated here to
00015 # avoid introducing a trivial stack dependency.
00016
00017 string key # tag label
00018 string value # corresponding value
00019
00020 """
00021 __slots__ = ['key','value']
00022 _slot_types = ['string','string']
00023
00024 def __init__(self, *args, **kwds):
00025 """
00026 Constructor. Any message fields that are implicitly/explicitly
00027 set to None will be assigned a default value. The recommend
00028 use is keyword arguments as this is more robust to future message
00029 changes. You cannot mix in-order arguments and keyword arguments.
00030
00031 The available fields are:
00032 key,value
00033
00034 :param args: complete set of field values, in .msg order
00035 :param kwds: use keyword arguments corresponding to message field names
00036 to set specific fields.
00037 """
00038 if args or kwds:
00039 super(KeyValue, self).__init__(*args, **kwds)
00040
00041 if self.key is None:
00042 self.key = ''
00043 if self.value is None:
00044 self.value = ''
00045 else:
00046 self.key = ''
00047 self.value = ''
00048
00049 def _get_types(self):
00050 """
00051 internal API method
00052 """
00053 return self._slot_types
00054
00055 def serialize(self, buff):
00056 """
00057 serialize message into buffer
00058 :param buff: buffer, ``StringIO``
00059 """
00060 try:
00061 _x = self.key
00062 length = len(_x)
00063 if python3 or type(_x) == unicode:
00064 _x = _x.encode('utf-8')
00065 length = len(_x)
00066 buff.write(struct.pack('<I%ss'%length, length, _x))
00067 _x = self.value
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 except struct.error as se: self._check_types(se)
00074 except TypeError as te: self._check_types(te)
00075
00076 def deserialize(self, str):
00077 """
00078 unpack serialized message in str into this message instance
00079 :param str: byte array of serialized message, ``str``
00080 """
00081 try:
00082 end = 0
00083 start = end
00084 end += 4
00085 (length,) = _struct_I.unpack(str[start:end])
00086 start = end
00087 end += length
00088 if python3:
00089 self.key = str[start:end].decode('utf-8')
00090 else:
00091 self.key = str[start:end]
00092 start = end
00093 end += 4
00094 (length,) = _struct_I.unpack(str[start:end])
00095 start = end
00096 end += length
00097 if python3:
00098 self.value = str[start:end].decode('utf-8')
00099 else:
00100 self.value = str[start:end]
00101 return self
00102 except struct.error as e:
00103 raise genpy.DeserializationError(e)
00104
00105
00106 def serialize_numpy(self, buff, numpy):
00107 """
00108 serialize message with numpy array types into buffer
00109 :param buff: buffer, ``StringIO``
00110 :param numpy: numpy python module
00111 """
00112 try:
00113 _x = self.key
00114 length = len(_x)
00115 if python3 or type(_x) == unicode:
00116 _x = _x.encode('utf-8')
00117 length = len(_x)
00118 buff.write(struct.pack('<I%ss'%length, length, _x))
00119 _x = self.value
00120 length = len(_x)
00121 if python3 or type(_x) == unicode:
00122 _x = _x.encode('utf-8')
00123 length = len(_x)
00124 buff.write(struct.pack('<I%ss'%length, length, _x))
00125 except struct.error as se: self._check_types(se)
00126 except TypeError as te: self._check_types(te)
00127
00128 def deserialize_numpy(self, str, numpy):
00129 """
00130 unpack serialized message in str into this message instance using numpy for array types
00131 :param str: byte array of serialized message, ``str``
00132 :param numpy: numpy python module
00133 """
00134 try:
00135 end = 0
00136 start = end
00137 end += 4
00138 (length,) = _struct_I.unpack(str[start:end])
00139 start = end
00140 end += length
00141 if python3:
00142 self.key = str[start:end].decode('utf-8')
00143 else:
00144 self.key = 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 self.value = str[start:end].decode('utf-8')
00152 else:
00153 self.value = str[start:end]
00154 return self
00155 except struct.error as e:
00156 raise genpy.DeserializationError(e)
00157
00158 _struct_I = genpy.struct_I