1
2 """autogenerated by genpy from controller_manager_msgs/HardwareInterfaceResources.msg. Do not edit."""
3 import sys
4 python3 = True if sys.hexversion > 0x03000000 else False
5 import genpy
6 import struct
7
8
10 _md5sum = "f25b55cbf1d1f76e82e5ec9e83f76258"
11 _type = "controller_manager_msgs/HardwareInterfaceResources"
12 _has_header = False
13 _full_text = """# Type of hardware interface
14 string hardware_interface
15 # List of resources belonging to the hardware interface
16 string[] resources
17 """
18 __slots__ = ['hardware_interface','resources']
19 _slot_types = ['string','string[]']
20
22 """
23 Constructor. Any message fields that are implicitly/explicitly
24 set to None will be assigned a default value. The recommend
25 use is keyword arguments as this is more robust to future message
26 changes. You cannot mix in-order arguments and keyword arguments.
27
28 The available fields are:
29 hardware_interface,resources
30
31 :param args: complete set of field values, in .msg order
32 :param kwds: use keyword arguments corresponding to message field names
33 to set specific fields.
34 """
35 if args or kwds:
36 super(HardwareInterfaceResources, self).__init__(*args, **kwds)
37
38 if self.hardware_interface is None:
39 self.hardware_interface = ''
40 if self.resources is None:
41 self.resources = []
42 else:
43 self.hardware_interface = ''
44 self.resources = []
45
47 """
48 internal API method
49 """
50 return self._slot_types
51
53 """
54 serialize message into buffer
55 :param buff: buffer, ``StringIO``
56 """
57 try:
58 _x = self.hardware_interface
59 length = len(_x)
60 if python3 or type(_x) == unicode:
61 _x = _x.encode('utf-8')
62 length = len(_x)
63 if python3:
64 buff.write(struct.pack('<I%sB'%length, length, *_x))
65 else:
66 buff.write(struct.pack('<I%ss'%length, length, _x))
67 length = len(self.resources)
68 buff.write(_struct_I.pack(length))
69 for val1 in self.resources:
70 length = len(val1)
71 if python3 or type(val1) == unicode:
72 val1 = val1.encode('utf-8')
73 length = len(val1)
74 if python3:
75 buff.write(struct.pack('<I%sB'%length, length, *val1))
76 else:
77 buff.write(struct.pack('<I%ss'%length, length, val1))
78 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))
79 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))
80
82 """
83 unpack serialized message in str into this message instance
84 :param str: byte array of serialized message, ``str``
85 """
86 try:
87 end = 0
88 start = end
89 end += 4
90 (length,) = _struct_I.unpack(str[start:end])
91 start = end
92 end += length
93 if python3:
94 self.hardware_interface = str[start:end].decode('utf-8')
95 else:
96 self.hardware_interface = str[start:end]
97 start = end
98 end += 4
99 (length,) = _struct_I.unpack(str[start:end])
100 self.resources = []
101 for i in range(0, length):
102 start = end
103 end += 4
104 (length,) = _struct_I.unpack(str[start:end])
105 start = end
106 end += length
107 if python3:
108 val1 = str[start:end].decode('utf-8')
109 else:
110 val1 = str[start:end]
111 self.resources.append(val1)
112 return self
113 except struct.error as e:
114 raise genpy.DeserializationError(e)
115
116
118 """
119 serialize message with numpy array types into buffer
120 :param buff: buffer, ``StringIO``
121 :param numpy: numpy python module
122 """
123 try:
124 _x = self.hardware_interface
125 length = len(_x)
126 if python3 or type(_x) == unicode:
127 _x = _x.encode('utf-8')
128 length = len(_x)
129 if python3:
130 buff.write(struct.pack('<I%sB'%length, length, *_x))
131 else:
132 buff.write(struct.pack('<I%ss'%length, length, _x))
133 length = len(self.resources)
134 buff.write(_struct_I.pack(length))
135 for val1 in self.resources:
136 length = len(val1)
137 if python3 or type(val1) == unicode:
138 val1 = val1.encode('utf-8')
139 length = len(val1)
140 if python3:
141 buff.write(struct.pack('<I%sB'%length, length, *val1))
142 else:
143 buff.write(struct.pack('<I%ss'%length, length, val1))
144 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))
145 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))
146
148 """
149 unpack serialized message in str into this message instance using numpy for array types
150 :param str: byte array of serialized message, ``str``
151 :param numpy: numpy python module
152 """
153 try:
154 end = 0
155 start = end
156 end += 4
157 (length,) = _struct_I.unpack(str[start:end])
158 start = end
159 end += length
160 if python3:
161 self.hardware_interface = str[start:end].decode('utf-8')
162 else:
163 self.hardware_interface = str[start:end]
164 start = end
165 end += 4
166 (length,) = _struct_I.unpack(str[start:end])
167 self.resources = []
168 for i in range(0, length):
169 start = end
170 end += 4
171 (length,) = _struct_I.unpack(str[start:end])
172 start = end
173 end += length
174 if python3:
175 val1 = str[start:end].decode('utf-8')
176 else:
177 val1 = str[start:end]
178 self.resources.append(val1)
179 return self
180 except struct.error as e:
181 raise genpy.DeserializationError(e)
182
183 _struct_I = genpy.struct_I
184