00001 """autogenerated by genmsg_py from KeyValue.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class KeyValue(roslib.message.Message):
00007 _md5sum = "cf57fdc6617a881a88c16e768132149c"
00008 _type = "geographic_msgs/KeyValue"
00009 _has_header = False
00010 _full_text = """# Geographic map tag (key, value) pair
00011 #
00012 # This is equivalent to diagnostic_msgs/KeyValue, repeated here to
00013 # avoid introducing a trivial stack dependency.
00014
00015 string key # tag label
00016 string value # corresponding value
00017
00018 """
00019 __slots__ = ['key','value']
00020 _slot_types = ['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 key,value
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(KeyValue, self).__init__(*args, **kwds)
00038
00039 if self.key is None:
00040 self.key = ''
00041 if self.value is None:
00042 self.value = ''
00043 else:
00044 self.key = ''
00045 self.value = ''
00046
00047 def _get_types(self):
00048 """
00049 internal API method
00050 """
00051 return self._slot_types
00052
00053 def serialize(self, buff):
00054 """
00055 serialize message into buffer
00056 @param buff: buffer
00057 @type buff: StringIO
00058 """
00059 try:
00060 _x = self.key
00061 length = len(_x)
00062 buff.write(struct.pack('<I%ss'%length, length, _x))
00063 _x = self.value
00064 length = len(_x)
00065 buff.write(struct.pack('<I%ss'%length, length, _x))
00066 except struct.error as se: self._check_types(se)
00067 except TypeError as te: self._check_types(te)
00068
00069 def deserialize(self, str):
00070 """
00071 unpack serialized message in str into this message instance
00072 @param str: byte array of serialized message
00073 @type str: str
00074 """
00075 try:
00076 end = 0
00077 start = end
00078 end += 4
00079 (length,) = _struct_I.unpack(str[start:end])
00080 start = end
00081 end += length
00082 self.key = str[start:end]
00083 start = end
00084 end += 4
00085 (length,) = _struct_I.unpack(str[start:end])
00086 start = end
00087 end += length
00088 self.value = str[start:end]
00089 return self
00090 except struct.error as e:
00091 raise roslib.message.DeserializationError(e)
00092
00093
00094 def serialize_numpy(self, buff, numpy):
00095 """
00096 serialize message with numpy array types into buffer
00097 @param buff: buffer
00098 @type buff: StringIO
00099 @param numpy: numpy python module
00100 @type numpy module
00101 """
00102 try:
00103 _x = self.key
00104 length = len(_x)
00105 buff.write(struct.pack('<I%ss'%length, length, _x))
00106 _x = self.value
00107 length = len(_x)
00108 buff.write(struct.pack('<I%ss'%length, length, _x))
00109 except struct.error as se: self._check_types(se)
00110 except TypeError as te: self._check_types(te)
00111
00112 def deserialize_numpy(self, str, numpy):
00113 """
00114 unpack serialized message in str into this message instance using numpy for array types
00115 @param str: byte array of serialized message
00116 @type str: str
00117 @param numpy: numpy python module
00118 @type numpy: module
00119 """
00120 try:
00121 end = 0
00122 start = end
00123 end += 4
00124 (length,) = _struct_I.unpack(str[start:end])
00125 start = end
00126 end += length
00127 self.key = str[start:end]
00128 start = end
00129 end += 4
00130 (length,) = _struct_I.unpack(str[start:end])
00131 start = end
00132 end += length
00133 self.value = str[start:end]
00134 return self
00135 except struct.error as e:
00136 raise roslib.message.DeserializationError(e)
00137
00138 _struct_I = roslib.message.struct_I