00001 """autogenerated by genpy from sr_robot_msgs/config.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 config(genpy.Message):
00009 _md5sum = "aad3efafb735fbac1153457b0e7c6e24"
00010 _type = "sr_robot_msgs/config"
00011 _has_header = False
00012 _full_text = """# modify the config of a node
00013 # e.g. change the transmission rate
00014 string node_name
00015 string[] list_of_parameters
00016 uint8 length_of_list
00017
00018 """
00019 __slots__ = ['node_name','list_of_parameters','length_of_list']
00020 _slot_types = ['string','string[]','uint8']
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 node_name,list_of_parameters,length_of_list
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(config, self).__init__(*args, **kwds)
00038
00039 if self.node_name is None:
00040 self.node_name = ''
00041 if self.list_of_parameters is None:
00042 self.list_of_parameters = []
00043 if self.length_of_list is None:
00044 self.length_of_list = 0
00045 else:
00046 self.node_name = ''
00047 self.list_of_parameters = []
00048 self.length_of_list = 0
00049
00050 def _get_types(self):
00051 """
00052 internal API method
00053 """
00054 return self._slot_types
00055
00056 def serialize(self, buff):
00057 """
00058 serialize message into buffer
00059 :param buff: buffer, ``StringIO``
00060 """
00061 try:
00062 _x = self.node_name
00063 length = len(_x)
00064 if python3 or type(_x) == unicode:
00065 _x = _x.encode('utf-8')
00066 length = len(_x)
00067 buff.write(struct.pack('<I%ss'%length, length, _x))
00068 length = len(self.list_of_parameters)
00069 buff.write(_struct_I.pack(length))
00070 for val1 in self.list_of_parameters:
00071 length = len(val1)
00072 if python3 or type(val1) == unicode:
00073 val1 = val1.encode('utf-8')
00074 length = len(val1)
00075 buff.write(struct.pack('<I%ss'%length, length, val1))
00076 buff.write(_struct_B.pack(self.length_of_list))
00077 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00078 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00079
00080 def deserialize(self, str):
00081 """
00082 unpack serialized message in str into this message instance
00083 :param str: byte array of serialized message, ``str``
00084 """
00085 try:
00086 end = 0
00087 start = end
00088 end += 4
00089 (length,) = _struct_I.unpack(str[start:end])
00090 start = end
00091 end += length
00092 if python3:
00093 self.node_name = str[start:end].decode('utf-8')
00094 else:
00095 self.node_name = str[start:end]
00096 start = end
00097 end += 4
00098 (length,) = _struct_I.unpack(str[start:end])
00099 self.list_of_parameters = []
00100 for i in range(0, length):
00101 start = end
00102 end += 4
00103 (length,) = _struct_I.unpack(str[start:end])
00104 start = end
00105 end += length
00106 if python3:
00107 val1 = str[start:end].decode('utf-8')
00108 else:
00109 val1 = str[start:end]
00110 self.list_of_parameters.append(val1)
00111 start = end
00112 end += 1
00113 (self.length_of_list,) = _struct_B.unpack(str[start:end])
00114 return self
00115 except struct.error as e:
00116 raise genpy.DeserializationError(e)
00117
00118
00119 def serialize_numpy(self, buff, numpy):
00120 """
00121 serialize message with numpy array types into buffer
00122 :param buff: buffer, ``StringIO``
00123 :param numpy: numpy python module
00124 """
00125 try:
00126 _x = self.node_name
00127 length = len(_x)
00128 if python3 or type(_x) == unicode:
00129 _x = _x.encode('utf-8')
00130 length = len(_x)
00131 buff.write(struct.pack('<I%ss'%length, length, _x))
00132 length = len(self.list_of_parameters)
00133 buff.write(_struct_I.pack(length))
00134 for val1 in self.list_of_parameters:
00135 length = len(val1)
00136 if python3 or type(val1) == unicode:
00137 val1 = val1.encode('utf-8')
00138 length = len(val1)
00139 buff.write(struct.pack('<I%ss'%length, length, val1))
00140 buff.write(_struct_B.pack(self.length_of_list))
00141 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00142 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00143
00144 def deserialize_numpy(self, str, numpy):
00145 """
00146 unpack serialized message in str into this message instance using numpy for array types
00147 :param str: byte array of serialized message, ``str``
00148 :param numpy: numpy python module
00149 """
00150 try:
00151 end = 0
00152 start = end
00153 end += 4
00154 (length,) = _struct_I.unpack(str[start:end])
00155 start = end
00156 end += length
00157 if python3:
00158 self.node_name = str[start:end].decode('utf-8')
00159 else:
00160 self.node_name = str[start:end]
00161 start = end
00162 end += 4
00163 (length,) = _struct_I.unpack(str[start:end])
00164 self.list_of_parameters = []
00165 for i in range(0, length):
00166 start = end
00167 end += 4
00168 (length,) = _struct_I.unpack(str[start:end])
00169 start = end
00170 end += length
00171 if python3:
00172 val1 = str[start:end].decode('utf-8')
00173 else:
00174 val1 = str[start:end]
00175 self.list_of_parameters.append(val1)
00176 start = end
00177 end += 1
00178 (self.length_of_list,) = _struct_B.unpack(str[start:end])
00179 return self
00180 except struct.error as e:
00181 raise genpy.DeserializationError(e)
00182
00183 _struct_I = genpy.struct_I
00184 _struct_B = struct.Struct("<B")