1 """autogenerated by genpy from master_discovery_fkie/SyncMasterInfo.msg. Do not edit."""
2 import sys
3 python3 = True if sys.hexversion > 0x03000000 else False
4 import genpy
5 import struct
6
7 import master_discovery_fkie.msg
8
10 _md5sum = "9dddc0b5529eb1094056443e6b68601c"
11 _type = "master_discovery_fkie/SyncMasterInfo"
12 _has_header = False
13 _full_text = """string masteruri
14 string[] nodes
15 master_discovery_fkie/SyncTopicInfo[] publisher
16 master_discovery_fkie/SyncTopicInfo[] subscriber
17 string[] services
18 ================================================================================
19 MSG: master_discovery_fkie/SyncTopicInfo
20 string topic
21 string node
22 string nodeuri
23 """
24 __slots__ = ['masteruri','nodes','publisher','subscriber','services']
25 _slot_types = ['string','string[]','master_discovery_fkie/SyncTopicInfo[]','master_discovery_fkie/SyncTopicInfo[]','string[]']
26
28 """
29 Constructor. Any message fields that are implicitly/explicitly
30 set to None will be assigned a default value. The recommend
31 use is keyword arguments as this is more robust to future message
32 changes. You cannot mix in-order arguments and keyword arguments.
33
34 The available fields are:
35 masteruri,nodes,publisher,subscriber,services
36
37 :param args: complete set of field values, in .msg order
38 :param kwds: use keyword arguments corresponding to message field names
39 to set specific fields.
40 """
41 if args or kwds:
42 super(SyncMasterInfo, self).__init__(*args, **kwds)
43
44 if self.masteruri is None:
45 self.masteruri = ''
46 if self.nodes is None:
47 self.nodes = []
48 if self.publisher is None:
49 self.publisher = []
50 if self.subscriber is None:
51 self.subscriber = []
52 if self.services is None:
53 self.services = []
54 else:
55 self.masteruri = ''
56 self.nodes = []
57 self.publisher = []
58 self.subscriber = []
59 self.services = []
60
62 """
63 internal API method
64 """
65 return self._slot_types
66
68 """
69 serialize message into buffer
70 :param buff: buffer, ``StringIO``
71 """
72 try:
73 _x = self.masteruri
74 length = len(_x)
75 if python3 or type(_x) == unicode:
76 _x = _x.encode('utf-8')
77 length = len(_x)
78 buff.write(struct.pack('<I%ss'%length, length, _x))
79 length = len(self.nodes)
80 buff.write(_struct_I.pack(length))
81 for val1 in self.nodes:
82 length = len(val1)
83 if python3 or type(val1) == unicode:
84 val1 = val1.encode('utf-8')
85 length = len(val1)
86 buff.write(struct.pack('<I%ss'%length, length, val1))
87 length = len(self.publisher)
88 buff.write(_struct_I.pack(length))
89 for val1 in self.publisher:
90 _x = val1.topic
91 length = len(_x)
92 if python3 or type(_x) == unicode:
93 _x = _x.encode('utf-8')
94 length = len(_x)
95 buff.write(struct.pack('<I%ss'%length, length, _x))
96 _x = val1.node
97 length = len(_x)
98 if python3 or type(_x) == unicode:
99 _x = _x.encode('utf-8')
100 length = len(_x)
101 buff.write(struct.pack('<I%ss'%length, length, _x))
102 _x = val1.nodeuri
103 length = len(_x)
104 if python3 or type(_x) == unicode:
105 _x = _x.encode('utf-8')
106 length = len(_x)
107 buff.write(struct.pack('<I%ss'%length, length, _x))
108 length = len(self.subscriber)
109 buff.write(_struct_I.pack(length))
110 for val1 in self.subscriber:
111 _x = val1.topic
112 length = len(_x)
113 if python3 or type(_x) == unicode:
114 _x = _x.encode('utf-8')
115 length = len(_x)
116 buff.write(struct.pack('<I%ss'%length, length, _x))
117 _x = val1.node
118 length = len(_x)
119 if python3 or type(_x) == unicode:
120 _x = _x.encode('utf-8')
121 length = len(_x)
122 buff.write(struct.pack('<I%ss'%length, length, _x))
123 _x = val1.nodeuri
124 length = len(_x)
125 if python3 or type(_x) == unicode:
126 _x = _x.encode('utf-8')
127 length = len(_x)
128 buff.write(struct.pack('<I%ss'%length, length, _x))
129 length = len(self.services)
130 buff.write(_struct_I.pack(length))
131 for val1 in self.services:
132 length = len(val1)
133 if python3 or type(val1) == unicode:
134 val1 = val1.encode('utf-8')
135 length = len(val1)
136 buff.write(struct.pack('<I%ss'%length, length, val1))
137 except struct.error as se: self._check_types(se)
138 except TypeError as te: self._check_types(te)
139
141 """
142 unpack serialized message in str into this message instance
143 :param str: byte array of serialized message, ``str``
144 """
145 try:
146 if self.publisher is None:
147 self.publisher = None
148 if self.subscriber is None:
149 self.subscriber = None
150 end = 0
151 start = end
152 end += 4
153 (length,) = _struct_I.unpack(str[start:end])
154 start = end
155 end += length
156 if python3:
157 self.masteruri = str[start:end].decode('utf-8')
158 else:
159 self.masteruri = str[start:end]
160 start = end
161 end += 4
162 (length,) = _struct_I.unpack(str[start:end])
163 self.nodes = []
164 for i in range(0, length):
165 start = end
166 end += 4
167 (length,) = _struct_I.unpack(str[start:end])
168 start = end
169 end += length
170 if python3:
171 val1 = str[start:end].decode('utf-8')
172 else:
173 val1 = str[start:end]
174 self.nodes.append(val1)
175 start = end
176 end += 4
177 (length,) = _struct_I.unpack(str[start:end])
178 self.publisher = []
179 for i in range(0, length):
180 val1 = master_discovery_fkie.msg.SyncTopicInfo()
181 start = end
182 end += 4
183 (length,) = _struct_I.unpack(str[start:end])
184 start = end
185 end += length
186 if python3:
187 val1.topic = str[start:end].decode('utf-8')
188 else:
189 val1.topic = str[start:end]
190 start = end
191 end += 4
192 (length,) = _struct_I.unpack(str[start:end])
193 start = end
194 end += length
195 if python3:
196 val1.node = str[start:end].decode('utf-8')
197 else:
198 val1.node = str[start:end]
199 start = end
200 end += 4
201 (length,) = _struct_I.unpack(str[start:end])
202 start = end
203 end += length
204 if python3:
205 val1.nodeuri = str[start:end].decode('utf-8')
206 else:
207 val1.nodeuri = str[start:end]
208 self.publisher.append(val1)
209 start = end
210 end += 4
211 (length,) = _struct_I.unpack(str[start:end])
212 self.subscriber = []
213 for i in range(0, length):
214 val1 = master_discovery_fkie.msg.SyncTopicInfo()
215 start = end
216 end += 4
217 (length,) = _struct_I.unpack(str[start:end])
218 start = end
219 end += length
220 if python3:
221 val1.topic = str[start:end].decode('utf-8')
222 else:
223 val1.topic = str[start:end]
224 start = end
225 end += 4
226 (length,) = _struct_I.unpack(str[start:end])
227 start = end
228 end += length
229 if python3:
230 val1.node = str[start:end].decode('utf-8')
231 else:
232 val1.node = str[start:end]
233 start = end
234 end += 4
235 (length,) = _struct_I.unpack(str[start:end])
236 start = end
237 end += length
238 if python3:
239 val1.nodeuri = str[start:end].decode('utf-8')
240 else:
241 val1.nodeuri = str[start:end]
242 self.subscriber.append(val1)
243 start = end
244 end += 4
245 (length,) = _struct_I.unpack(str[start:end])
246 self.services = []
247 for i in range(0, length):
248 start = end
249 end += 4
250 (length,) = _struct_I.unpack(str[start:end])
251 start = end
252 end += length
253 if python3:
254 val1 = str[start:end].decode('utf-8')
255 else:
256 val1 = str[start:end]
257 self.services.append(val1)
258 return self
259 except struct.error as e:
260 raise genpy.DeserializationError(e)
261
262
264 """
265 serialize message with numpy array types into buffer
266 :param buff: buffer, ``StringIO``
267 :param numpy: numpy python module
268 """
269 try:
270 _x = self.masteruri
271 length = len(_x)
272 if python3 or type(_x) == unicode:
273 _x = _x.encode('utf-8')
274 length = len(_x)
275 buff.write(struct.pack('<I%ss'%length, length, _x))
276 length = len(self.nodes)
277 buff.write(_struct_I.pack(length))
278 for val1 in self.nodes:
279 length = len(val1)
280 if python3 or type(val1) == unicode:
281 val1 = val1.encode('utf-8')
282 length = len(val1)
283 buff.write(struct.pack('<I%ss'%length, length, val1))
284 length = len(self.publisher)
285 buff.write(_struct_I.pack(length))
286 for val1 in self.publisher:
287 _x = val1.topic
288 length = len(_x)
289 if python3 or type(_x) == unicode:
290 _x = _x.encode('utf-8')
291 length = len(_x)
292 buff.write(struct.pack('<I%ss'%length, length, _x))
293 _x = val1.node
294 length = len(_x)
295 if python3 or type(_x) == unicode:
296 _x = _x.encode('utf-8')
297 length = len(_x)
298 buff.write(struct.pack('<I%ss'%length, length, _x))
299 _x = val1.nodeuri
300 length = len(_x)
301 if python3 or type(_x) == unicode:
302 _x = _x.encode('utf-8')
303 length = len(_x)
304 buff.write(struct.pack('<I%ss'%length, length, _x))
305 length = len(self.subscriber)
306 buff.write(_struct_I.pack(length))
307 for val1 in self.subscriber:
308 _x = val1.topic
309 length = len(_x)
310 if python3 or type(_x) == unicode:
311 _x = _x.encode('utf-8')
312 length = len(_x)
313 buff.write(struct.pack('<I%ss'%length, length, _x))
314 _x = val1.node
315 length = len(_x)
316 if python3 or type(_x) == unicode:
317 _x = _x.encode('utf-8')
318 length = len(_x)
319 buff.write(struct.pack('<I%ss'%length, length, _x))
320 _x = val1.nodeuri
321 length = len(_x)
322 if python3 or type(_x) == unicode:
323 _x = _x.encode('utf-8')
324 length = len(_x)
325 buff.write(struct.pack('<I%ss'%length, length, _x))
326 length = len(self.services)
327 buff.write(_struct_I.pack(length))
328 for val1 in self.services:
329 length = len(val1)
330 if python3 or type(val1) == unicode:
331 val1 = val1.encode('utf-8')
332 length = len(val1)
333 buff.write(struct.pack('<I%ss'%length, length, val1))
334 except struct.error as se: self._check_types(se)
335 except TypeError as te: self._check_types(te)
336
338 """
339 unpack serialized message in str into this message instance using numpy for array types
340 :param str: byte array of serialized message, ``str``
341 :param numpy: numpy python module
342 """
343 try:
344 if self.publisher is None:
345 self.publisher = None
346 if self.subscriber is None:
347 self.subscriber = None
348 end = 0
349 start = end
350 end += 4
351 (length,) = _struct_I.unpack(str[start:end])
352 start = end
353 end += length
354 if python3:
355 self.masteruri = str[start:end].decode('utf-8')
356 else:
357 self.masteruri = str[start:end]
358 start = end
359 end += 4
360 (length,) = _struct_I.unpack(str[start:end])
361 self.nodes = []
362 for i in range(0, length):
363 start = end
364 end += 4
365 (length,) = _struct_I.unpack(str[start:end])
366 start = end
367 end += length
368 if python3:
369 val1 = str[start:end].decode('utf-8')
370 else:
371 val1 = str[start:end]
372 self.nodes.append(val1)
373 start = end
374 end += 4
375 (length,) = _struct_I.unpack(str[start:end])
376 self.publisher = []
377 for i in range(0, length):
378 val1 = master_discovery_fkie.msg.SyncTopicInfo()
379 start = end
380 end += 4
381 (length,) = _struct_I.unpack(str[start:end])
382 start = end
383 end += length
384 if python3:
385 val1.topic = str[start:end].decode('utf-8')
386 else:
387 val1.topic = str[start:end]
388 start = end
389 end += 4
390 (length,) = _struct_I.unpack(str[start:end])
391 start = end
392 end += length
393 if python3:
394 val1.node = str[start:end].decode('utf-8')
395 else:
396 val1.node = str[start:end]
397 start = end
398 end += 4
399 (length,) = _struct_I.unpack(str[start:end])
400 start = end
401 end += length
402 if python3:
403 val1.nodeuri = str[start:end].decode('utf-8')
404 else:
405 val1.nodeuri = str[start:end]
406 self.publisher.append(val1)
407 start = end
408 end += 4
409 (length,) = _struct_I.unpack(str[start:end])
410 self.subscriber = []
411 for i in range(0, length):
412 val1 = master_discovery_fkie.msg.SyncTopicInfo()
413 start = end
414 end += 4
415 (length,) = _struct_I.unpack(str[start:end])
416 start = end
417 end += length
418 if python3:
419 val1.topic = str[start:end].decode('utf-8')
420 else:
421 val1.topic = str[start:end]
422 start = end
423 end += 4
424 (length,) = _struct_I.unpack(str[start:end])
425 start = end
426 end += length
427 if python3:
428 val1.node = str[start:end].decode('utf-8')
429 else:
430 val1.node = str[start:end]
431 start = end
432 end += 4
433 (length,) = _struct_I.unpack(str[start:end])
434 start = end
435 end += length
436 if python3:
437 val1.nodeuri = str[start:end].decode('utf-8')
438 else:
439 val1.nodeuri = str[start:end]
440 self.subscriber.append(val1)
441 start = end
442 end += 4
443 (length,) = _struct_I.unpack(str[start:end])
444 self.services = []
445 for i in range(0, length):
446 start = end
447 end += 4
448 (length,) = _struct_I.unpack(str[start:end])
449 start = end
450 end += length
451 if python3:
452 val1 = str[start:end].decode('utf-8')
453 else:
454 val1 = str[start:end]
455 self.services.append(val1)
456 return self
457 except struct.error as e:
458 raise genpy.DeserializationError(e)
459
460 _struct_I = genpy.struct_I
461