Go to the documentation of this file.00001 """autogenerated by genpy from rve_msgs/ColorChannel.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007 import std_msgs.msg
00008
00009 class ColorChannel(genpy.Message):
00010 _md5sum = "00ea539b8abace8c98c145055575f66f"
00011 _type = "rve_msgs/ColorChannel"
00012 _has_header = False
00013 _full_text = """std_msgs/ColorRGBA[] array
00014
00015 ================================================================================
00016 MSG: std_msgs/ColorRGBA
00017 float32 r
00018 float32 g
00019 float32 b
00020 float32 a
00021
00022 """
00023 __slots__ = ['array']
00024 _slot_types = ['std_msgs/ColorRGBA[]']
00025
00026 def __init__(self, *args, **kwds):
00027 """
00028 Constructor. Any message fields that are implicitly/explicitly
00029 set to None will be assigned a default value. The recommend
00030 use is keyword arguments as this is more robust to future message
00031 changes. You cannot mix in-order arguments and keyword arguments.
00032
00033 The available fields are:
00034 array
00035
00036 :param args: complete set of field values, in .msg order
00037 :param kwds: use keyword arguments corresponding to message field names
00038 to set specific fields.
00039 """
00040 if args or kwds:
00041 super(ColorChannel, self).__init__(*args, **kwds)
00042
00043 if self.array is None:
00044 self.array = []
00045 else:
00046 self.array = []
00047
00048 def _get_types(self):
00049 """
00050 internal API method
00051 """
00052 return self._slot_types
00053
00054 def serialize(self, buff):
00055 """
00056 serialize message into buffer
00057 :param buff: buffer, ``StringIO``
00058 """
00059 try:
00060 length = len(self.array)
00061 buff.write(_struct_I.pack(length))
00062 for val1 in self.array:
00063 _x = val1
00064 buff.write(_struct_4f.pack(_x.r, _x.g, _x.b, _x.a))
00065 except struct.error as se: self._check_types(se)
00066 except TypeError as te: self._check_types(te)
00067
00068 def deserialize(self, str):
00069 """
00070 unpack serialized message in str into this message instance
00071 :param str: byte array of serialized message, ``str``
00072 """
00073 try:
00074 if self.array is None:
00075 self.array = None
00076 end = 0
00077 start = end
00078 end += 4
00079 (length,) = _struct_I.unpack(str[start:end])
00080 self.array = []
00081 for i in range(0, length):
00082 val1 = std_msgs.msg.ColorRGBA()
00083 _x = val1
00084 start = end
00085 end += 16
00086 (_x.r, _x.g, _x.b, _x.a,) = _struct_4f.unpack(str[start:end])
00087 self.array.append(val1)
00088 return self
00089 except struct.error as e:
00090 raise genpy.DeserializationError(e)
00091
00092
00093 def serialize_numpy(self, buff, numpy):
00094 """
00095 serialize message with numpy array types into buffer
00096 :param buff: buffer, ``StringIO``
00097 :param numpy: numpy python module
00098 """
00099 try:
00100 length = len(self.array)
00101 buff.write(_struct_I.pack(length))
00102 for val1 in self.array:
00103 _x = val1
00104 buff.write(_struct_4f.pack(_x.r, _x.g, _x.b, _x.a))
00105 except struct.error as se: self._check_types(se)
00106 except TypeError as te: self._check_types(te)
00107
00108 def deserialize_numpy(self, str, numpy):
00109 """
00110 unpack serialized message in str into this message instance using numpy for array types
00111 :param str: byte array of serialized message, ``str``
00112 :param numpy: numpy python module
00113 """
00114 try:
00115 if self.array is None:
00116 self.array = None
00117 end = 0
00118 start = end
00119 end += 4
00120 (length,) = _struct_I.unpack(str[start:end])
00121 self.array = []
00122 for i in range(0, length):
00123 val1 = std_msgs.msg.ColorRGBA()
00124 _x = val1
00125 start = end
00126 end += 16
00127 (_x.r, _x.g, _x.b, _x.a,) = _struct_4f.unpack(str[start:end])
00128 self.array.append(val1)
00129 return self
00130 except struct.error as e:
00131 raise genpy.DeserializationError(e)
00132
00133 _struct_I = genpy.struct_I
00134 _struct_4f = struct.Struct("<4f")