Go to the documentation of this file.00001 """autogenerated by genpy from nasa_r2_common_msgs/MappedType.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 MappedType(genpy.Message):
00009 _md5sum = "f61664a4dc14b6b365fb43df66f4679e"
00010 _type = "nasa_r2_common_msgs/MappedType"
00011 _has_header = False
00012 _full_text = """uint8 STRING = 0
00013 uint8 UINT16 = 1
00014 uint8 INT16 = 2
00015 uint8 UINT32 = 3
00016 uint8 INT32 = 4
00017 uint8 FLOAT32 = 5
00018 uint8 BOOL = 6
00019
00020 uint8 type
00021
00022 """
00023
00024 STRING = 0
00025 UINT16 = 1
00026 INT16 = 2
00027 UINT32 = 3
00028 INT32 = 4
00029 FLOAT32 = 5
00030 BOOL = 6
00031
00032 __slots__ = ['type']
00033 _slot_types = ['uint8']
00034
00035 def __init__(self, *args, **kwds):
00036 """
00037 Constructor. Any message fields that are implicitly/explicitly
00038 set to None will be assigned a default value. The recommend
00039 use is keyword arguments as this is more robust to future message
00040 changes. You cannot mix in-order arguments and keyword arguments.
00041
00042 The available fields are:
00043 type
00044
00045 :param args: complete set of field values, in .msg order
00046 :param kwds: use keyword arguments corresponding to message field names
00047 to set specific fields.
00048 """
00049 if args or kwds:
00050 super(MappedType, self).__init__(*args, **kwds)
00051
00052 if self.type is None:
00053 self.type = 0
00054 else:
00055 self.type = 0
00056
00057 def _get_types(self):
00058 """
00059 internal API method
00060 """
00061 return self._slot_types
00062
00063 def serialize(self, buff):
00064 """
00065 serialize message into buffer
00066 :param buff: buffer, ``StringIO``
00067 """
00068 try:
00069 buff.write(_struct_B.pack(self.type))
00070 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00071 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00072
00073 def deserialize(self, str):
00074 """
00075 unpack serialized message in str into this message instance
00076 :param str: byte array of serialized message, ``str``
00077 """
00078 try:
00079 end = 0
00080 start = end
00081 end += 1
00082 (self.type,) = _struct_B.unpack(str[start:end])
00083 return self
00084 except struct.error as e:
00085 raise genpy.DeserializationError(e)
00086
00087
00088 def serialize_numpy(self, buff, numpy):
00089 """
00090 serialize message with numpy array types into buffer
00091 :param buff: buffer, ``StringIO``
00092 :param numpy: numpy python module
00093 """
00094 try:
00095 buff.write(_struct_B.pack(self.type))
00096 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00097 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00098
00099 def deserialize_numpy(self, str, numpy):
00100 """
00101 unpack serialized message in str into this message instance using numpy for array types
00102 :param str: byte array of serialized message, ``str``
00103 :param numpy: numpy python module
00104 """
00105 try:
00106 end = 0
00107 start = end
00108 end += 1
00109 (self.type,) = _struct_B.unpack(str[start:end])
00110 return self
00111 except struct.error as e:
00112 raise genpy.DeserializationError(e)
00113
00114 _struct_I = genpy.struct_I
00115 _struct_B = struct.Struct("<B")