Panda3D
datagramIterator.I
1 // Filename: datagramIterator.I
2 // Created by: drose (08May01)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: DatagramIterator::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE DatagramIterator::
22 DatagramIterator() :
23  _datagram((Datagram *)NULL),
24  _current_index(0) {
25 }
26 
27 ////////////////////////////////////////////////////////////////////
28 // Function: DatagramIterator::Constructor
29 // Access: Public
30 // Description:
31 ////////////////////////////////////////////////////////////////////
32 INLINE DatagramIterator::
33 DatagramIterator(const Datagram &datagram, size_t offset) :
34  _datagram(&datagram),
35  _current_index(offset) {
36  nassertv(_current_index <= _datagram->get_length());
37 }
38 
39 ////////////////////////////////////////////////////////////////////
40 // Function: DatagramIterator::Copy Constructor
41 // Access: Public
42 // Description:
43 ////////////////////////////////////////////////////////////////////
44 INLINE DatagramIterator::
45 DatagramIterator(const DatagramIterator &copy) :
46  _datagram(copy._datagram),
47  _current_index(copy._current_index) {
48 }
49 
50 ////////////////////////////////////////////////////////////////////
51 // Function: DatagramIterator::Copy Assignment Operator
52 // Access: Public
53 // Description:
54 ////////////////////////////////////////////////////////////////////
55 INLINE void DatagramIterator::
56 operator = (const DatagramIterator &copy) {
57  _datagram = copy._datagram;
58  _current_index = copy._current_index;
59 }
60 ////////////////////////////////////////////////////////////////////
61 // Function: DatagramIterator::assign
62 // Access: Public
63 // Description: direct Assignment to a Datagram
64 ////////////////////////////////////////////////////////////////////
65 INLINE void DatagramIterator::assign(Datagram &datagram, size_t offset)
66 {
67  _datagram =&datagram;
68  _current_index = offset;
69 }
70 ////////////////////////////////////////////////////////////////////
71 // Function: DatagramIterator::Destructor
72 // Access: Public
73 // Description:
74 ////////////////////////////////////////////////////////////////////
75 INLINE DatagramIterator::
76 ~DatagramIterator() {
77 }
78 
79 // Various ways to get data and increment the iterator...
80 // Cut-and-paste-orama
81 
82 ////////////////////////////////////////////////////////////////////
83 // Function: DatagramIterator::get_bool
84 // Access: Public
85 // Description: Extracts a boolean value.
86 ////////////////////////////////////////////////////////////////////
87 INLINE bool DatagramIterator::
89  return get_uint8() != 0;
90 }
91 
92 ////////////////////////////////////////////////////////////////////
93 // Function: DatagramIterator::get_int8
94 // Access: Public
95 // Description: Extracts a signed 8-bit integer.
96 ////////////////////////////////////////////////////////////////////
97 INLINE PN_int8 DatagramIterator::
99  nassertr(_datagram != (const Datagram *)NULL, 0);
100  // Avoid reading junk data off the end of the datagram:
101  nassertr(_current_index < _datagram->get_length(), 0);
102  // Get the Data:
103  const char *ptr = (const char *)_datagram->get_data();
104  PN_int8 tempvar = (PN_int8)ptr[_current_index];
105  ++_current_index;
106 
107  return tempvar;
108 }
109 
110 ////////////////////////////////////////////////////////////////////
111 // Function: DatagramIterator::get_uint8
112 // Access: Public
113 // Description: Extracts an unsigned 8-bit integer.
114 ////////////////////////////////////////////////////////////////////
115 INLINE PN_uint8 DatagramIterator::
117  nassertr(_datagram != (const Datagram *)NULL, 0);
118  // Avoid reading junk data off the end of the datagram:
119  nassertr(_current_index < _datagram->get_length(), 0);
120  // Get the Data:
121  const char *ptr = (const char *)_datagram->get_data();
122  PN_uint8 tempvar = (PN_uint8)ptr[_current_index];
123  ++_current_index;
124 
125  return tempvar;
126 }
127 
128 ////////////////////////////////////////////////////////////////////
129 // Function: DatagramIterator::get_int16
130 // Access: Public
131 // Description: Extracts a signed 16-bit integer.
132 ////////////////////////////////////////////////////////////////////
133 INLINE PN_int16 DatagramIterator::
135  nassertr(_datagram != (const Datagram *)NULL, 0);
136  nassertr(_current_index < _datagram->get_length(), 0);
137 
138  PN_int16 tempvar;
139  // Avoid reading junk data off the end of the datagram:
140  nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
141  // Get the Data:
142  LittleEndian s(_datagram->get_data(), _current_index, sizeof(tempvar));
143  s.store_value(&tempvar, sizeof(tempvar));
144  _current_index += sizeof(tempvar);
145 
146  return tempvar;
147 }
148 
149 ////////////////////////////////////////////////////////////////////
150 // Function: DatagramIterator::get_int32
151 // Access: Public
152 // Description: Extracts a signed 32-bit integer.
153 ////////////////////////////////////////////////////////////////////
154 INLINE PN_int32 DatagramIterator::
156  nassertr(_datagram != (const Datagram *)NULL, 0);
157  nassertr(_current_index < _datagram->get_length(), 0);
158 
159  PN_int32 tempvar;
160  // Avoid reading junk data off the end of the datagram:
161  nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
162  // Get the Data:
163  LittleEndian s(_datagram->get_data(), _current_index, sizeof(tempvar));
164  s.store_value(&tempvar, sizeof(tempvar));
165  _current_index += sizeof(tempvar);
166 
167  return tempvar;
168 }
169 
170 ////////////////////////////////////////////////////////////////////
171 // Function: DatagramIterator::get_int64
172 // Access: Public
173 // Description: Extracts a signed 64-bit integer.
174 ////////////////////////////////////////////////////////////////////
175 INLINE PN_int64 DatagramIterator::
177  nassertr(_datagram != (const Datagram *)NULL, 0);
178  nassertr(_current_index < _datagram->get_length(), 0);
179 
180  PN_int64 tempvar;
181  // Avoid reading junk data off the end of the datagram:
182  nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
183  // Get the Data:
184  LittleEndian s(_datagram->get_data(), _current_index, sizeof(tempvar));
185  s.store_value(&tempvar, sizeof(tempvar));
186  _current_index += sizeof(tempvar);
187 
188  return tempvar;
189 }
190 
191 ////////////////////////////////////////////////////////////////////
192 // Function: DatagramIterator::get_uint16
193 // Access: Public
194 // Description: Extracts an unsigned 16-bit integer.
195 ////////////////////////////////////////////////////////////////////
196 INLINE PN_uint16 DatagramIterator::
198  nassertr(_datagram != (const Datagram *)NULL, 0);
199  nassertr(_current_index < _datagram->get_length(), 0);
200 
201  PN_uint16 tempvar;
202  // Avoid reading junk data off the end of the datagram:
203  nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
204  // Get the Data:
205  LittleEndian s(_datagram->get_data(), _current_index, sizeof(tempvar));
206  s.store_value(&tempvar, sizeof(tempvar));
207  _current_index += sizeof(tempvar);
208 
209  return tempvar;
210 }
211 
212 ////////////////////////////////////////////////////////////////////
213 // Function: DatagramIterator::get_uint32
214 // Access: Public
215 // Description: Extracts an unsigned 32-bit integer.
216 ////////////////////////////////////////////////////////////////////
217 INLINE PN_uint32 DatagramIterator::
219  nassertr(_datagram != (const Datagram *)NULL, 0);
220  nassertr(_current_index < _datagram->get_length(), 0);
221 
222  PN_uint32 tempvar;
223  // Avoid reading junk data off the end of the datagram:
224  nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
225  // Get the Data:
226  LittleEndian s(_datagram->get_data(), _current_index, sizeof(tempvar));
227  s.store_value(&tempvar, sizeof(tempvar));
228  _current_index += sizeof(tempvar);
229 
230  return tempvar;
231 }
232 
233 ////////////////////////////////////////////////////////////////////
234 // Function: DatagramIterator::get_uint64
235 // Access: Public
236 // Description: Extracts an unsigned 64-bit integer.
237 ////////////////////////////////////////////////////////////////////
238 INLINE PN_uint64 DatagramIterator::
240  nassertr(_datagram != (const Datagram *)NULL, 0);
241  nassertr(_current_index < _datagram->get_length(), 0);
242 
243  PN_uint64 tempvar;
244  // Avoid reading junk data off the end of the datagram:
245  nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
246  // Get the Data:
247  LittleEndian s(_datagram->get_data(), _current_index, sizeof(tempvar));
248  s.store_value(&tempvar, sizeof(tempvar));
249  _current_index += sizeof(tempvar);
250 
251  return tempvar;
252 }
253 
254 ////////////////////////////////////////////////////////////////////
255 // Function: DatagramIterator::get_float32
256 // Access: Public
257 // Description: Extracts a 32-bit single-precision floating-point
258 // number.
259 ////////////////////////////////////////////////////////////////////
260 INLINE PN_float32 DatagramIterator::
262  nassertr(_datagram != (const Datagram *)NULL, 0.0);
263  nassertr(_current_index < _datagram->get_length(), 0.0);
264 
265  PN_float32 tempvar;
266  // Avoid reading junk data off the end of the datagram:
267  nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0.0);
268  // Get the Data:
269  LittleEndian s(_datagram->get_data(), _current_index, sizeof(tempvar));
270  s.store_value(&tempvar, sizeof(tempvar));
271  _current_index += sizeof(tempvar);
272 
273  return tempvar;
274 }
275 
276 ////////////////////////////////////////////////////////////////////
277 // Function: DatagramIterator::get_float64
278 // Access: Public
279 // Description: Extracts a 64-bit floating-point number.
280 ////////////////////////////////////////////////////////////////////
281 INLINE PN_float64 DatagramIterator::
283  nassertr(_datagram != (const Datagram *)NULL, 0.0);
284  nassertr(_current_index < _datagram->get_length(), 0.0);
285 
286  PN_float64 tempvar;
287  // Avoid reading junk data off the end of the datagram:
288  nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0.0);
289  // Get the Data:
290  LittleEndian s(_datagram->get_data(), _current_index, sizeof(tempvar));
291  s.store_value(&tempvar, sizeof(tempvar));
292  _current_index += sizeof(tempvar);
293 
294  return tempvar;
295 }
296 
297 
298 ////////////////////////////////////////////////////////////////////
299 // Function: DatagramIterator::get_stdfloat
300 // Access: Public
301 // Description: Extracts either a 32-bit or a 64-bit floating-point
302 // number, according to Datagram::set_stdfloat_double().
303 ////////////////////////////////////////////////////////////////////
304 INLINE PN_stdfloat DatagramIterator::
306  nassertr(_datagram != (const Datagram *)NULL, 0.0);
307  if (_datagram->get_stdfloat_double()) {
308  return (PN_stdfloat)get_float64();
309  } else {
310  return (PN_stdfloat)get_float32();
311  }
312 }
313 
314 ////////////////////////////////////////////////////////////////////
315 // Function: DatagramIterator::get_be_int16
316 // Access: Public
317 // Description: Extracts a signed 16-bit big-endian integer.
318 ////////////////////////////////////////////////////////////////////
319 INLINE PN_int16 DatagramIterator::
321  nassertr(_datagram != (const Datagram *)NULL, 0);
322  nassertr(_current_index < _datagram->get_length(), 0);
323 
324  PN_int16 tempvar;
325  // Avoid reading junk data off the end of the datagram:
326  nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
327  // Get the Data:
328  BigEndian s(_datagram->get_data(), _current_index, sizeof(tempvar));
329  s.store_value(&tempvar, sizeof(tempvar));
330  _current_index += sizeof(tempvar);
331 
332  return tempvar;
333 }
334 
335 ////////////////////////////////////////////////////////////////////
336 // Function: DatagramIterator::get_be_int32
337 // Access: Public
338 // Description: Extracts a signed 32-bit big-endian integer.
339 ////////////////////////////////////////////////////////////////////
340 INLINE PN_int32 DatagramIterator::
342  nassertr(_datagram != (const Datagram *)NULL, 0);
343  nassertr(_current_index < _datagram->get_length(), 0);
344 
345  PN_int32 tempvar;
346  // Avoid reading junk data off the end of the datagram:
347  nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
348  // Get the Data:
349  BigEndian s(_datagram->get_data(), _current_index, sizeof(tempvar));
350  s.store_value(&tempvar, sizeof(tempvar));
351  _current_index += sizeof(tempvar);
352 
353  return tempvar;
354 }
355 
356 ////////////////////////////////////////////////////////////////////
357 // Function: DatagramIterator::get_be_int64
358 // Access: Public
359 // Description: Extracts a signed 64-bit big-endian integer.
360 ////////////////////////////////////////////////////////////////////
361 INLINE PN_int64 DatagramIterator::
363  nassertr(_datagram != (const Datagram *)NULL, 0);
364  nassertr(_current_index < _datagram->get_length(), 0);
365 
366  PN_int64 tempvar;
367  // Avoid reading junk data off the end of the datagram:
368  nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
369  // Get the Data:
370  BigEndian s(_datagram->get_data(), _current_index, sizeof(tempvar));
371  s.store_value(&tempvar, sizeof(tempvar));
372  _current_index += sizeof(tempvar);
373 
374  return tempvar;
375 }
376 
377 ////////////////////////////////////////////////////////////////////
378 // Function: DatagramIterator::get_be_uint16
379 // Access: Public
380 // Description: Extracts an unsigned 16-bit big-endian integer.
381 ////////////////////////////////////////////////////////////////////
382 INLINE PN_uint16 DatagramIterator::
384  nassertr(_datagram != (const Datagram *)NULL, 0);
385  nassertr(_current_index < _datagram->get_length(), 0);
386 
387  PN_uint16 tempvar;
388  // Avoid reading junk data off the end of the datagram:
389  nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
390  // Get the Data:
391  BigEndian s(_datagram->get_data(), _current_index, sizeof(tempvar));
392  s.store_value(&tempvar, sizeof(tempvar));
393  _current_index += sizeof(tempvar);
394 
395  return tempvar;
396 }
397 
398 ////////////////////////////////////////////////////////////////////
399 // Function: DatagramIterator::get_be_uint32
400 // Access: Public
401 // Description: Extracts an unsigned 32-bit big-endian integer.
402 ////////////////////////////////////////////////////////////////////
403 INLINE PN_uint32 DatagramIterator::
405  nassertr(_datagram != (const Datagram *)NULL, 0);
406  nassertr(_current_index < _datagram->get_length(), 0);
407 
408  PN_uint32 tempvar;
409  // Avoid reading junk data off the end of the datagram:
410  nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
411  // Get the Data:
412  BigEndian s(_datagram->get_data(), _current_index, sizeof(tempvar));
413  s.store_value(&tempvar, sizeof(tempvar));
414  _current_index += sizeof(tempvar);
415 
416  return tempvar;
417 }
418 
419 ////////////////////////////////////////////////////////////////////
420 // Function: DatagramIterator::get_be_uint64
421 // Access: Public
422 // Description: Extracts an unsigned 64-bit big-endian integer.
423 ////////////////////////////////////////////////////////////////////
424 INLINE PN_uint64 DatagramIterator::
426  nassertr(_datagram != (const Datagram *)NULL, 0);
427  nassertr(_current_index < _datagram->get_length(), 0);
428 
429  PN_uint64 tempvar;
430  // Avoid reading junk data off the end of the datagram:
431  nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
432  // Get the Data:
433  BigEndian s(_datagram->get_data(), _current_index, sizeof(tempvar));
434  s.store_value(&tempvar, sizeof(tempvar));
435  _current_index += sizeof(tempvar);
436 
437  return tempvar;
438 }
439 
440 ////////////////////////////////////////////////////////////////////
441 // Function: DatagramIterator::get_be_float32
442 // Access: Public
443 // Description: Extracts a 32-bit big-endian single-precision
444 // floating-point number.
445 ////////////////////////////////////////////////////////////////////
446 INLINE PN_float32 DatagramIterator::
448  nassertr(_datagram != (const Datagram *)NULL, 0.0);
449  nassertr(_current_index < _datagram->get_length(), 0.0);
450 
451  PN_float32 tempvar;
452  // Avoid reading junk data off the end of the datagram:
453  nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0);
454  // Get the Data:
455  BigEndian s(_datagram->get_data(), _current_index, sizeof(tempvar));
456  s.store_value(&tempvar, sizeof(tempvar));
457  _current_index += sizeof(tempvar);
458 
459  return tempvar;
460 }
461 
462 ////////////////////////////////////////////////////////////////////
463 // Function: DatagramIterator::get_be_float64
464 // Access: Public
465 // Description: Extracts a 64-bit big-endian floating-point number.
466 ////////////////////////////////////////////////////////////////////
467 INLINE PN_float64 DatagramIterator::
469  nassertr(_datagram != (const Datagram *)NULL, 0.0);
470  nassertr(_current_index < _datagram->get_length(), 0.0);
471 
472  PN_float64 tempvar;
473  // Avoid reading junk data off the end of the datagram:
474  nassertr(_current_index + sizeof(tempvar) <= _datagram->get_length(), 0.0);
475  // Get the Data:
476  BigEndian s(_datagram->get_data(), _current_index, sizeof(tempvar));
477  s.store_value(&tempvar, sizeof(tempvar));
478  _current_index += sizeof(tempvar);
479 
480  return tempvar;
481 }
482 
483 ////////////////////////////////////////////////////////////////////
484 // Function: DatagramIterator::skip_bytes
485 // Access: Public
486 // Description: Skips over the indicated number of bytes in the
487 // datagram.
488 ////////////////////////////////////////////////////////////////////
489 INLINE void DatagramIterator::
490 skip_bytes(size_t size) {
491  nassertv(_datagram != (const Datagram *)NULL);
492  nassertv((int)size >= 0);
493 #ifndef NDEBUG
494  if (_current_index + size > _datagram->get_length()) {
495  nout << "datagram overflow: current_index = " << _current_index
496  << " size = " << size << " length = " << _datagram->get_length() << "\n";
497  _datagram->dump_hex(nout);
498  }
499 #endif
500  nassertv(_current_index + size <= _datagram->get_length());
501  _current_index += size;
502 }
503 
504 ////////////////////////////////////////////////////////////////////
505 // Function: DatagramIterator::get_remaining_bytes
506 // Access: Public
507 // Description: Returns the remaining bytes in the datagram as a
508 // string, but does not extract them from the iterator.
509 ////////////////////////////////////////////////////////////////////
510 INLINE string DatagramIterator::
512  nassertr(_datagram != (const Datagram *)NULL, "");
513  nassertr(_current_index <= _datagram->get_length(), "");
514 
515  const char *ptr = (const char *)_datagram->get_data();
516  int remaining_size = _datagram->get_length() - _current_index;
517  return string(ptr + _current_index, remaining_size);
518 }
519 
520 ////////////////////////////////////////////////////////////////////
521 // Function: DatagramIterator::get_remaining_size
522 // Access: Public
523 // Description: Return the bytes left in the datagram.
524 ////////////////////////////////////////////////////////////////////
525 INLINE int DatagramIterator::
527  return _datagram->get_length() - _current_index;
528 }
529 
530 ////////////////////////////////////////////////////////////////////
531 // Function: DatagramIterator::get_datagram
532 // Access: Public
533 // Description: Return the datagram of this iterator.
534 ////////////////////////////////////////////////////////////////////
535 INLINE const Datagram &DatagramIterator::
536 get_datagram() const {
537  return *_datagram;
538 }
539 
540 ////////////////////////////////////////////////////////////////////
541 // Function: DatagramIterator::get_current_index
542 // Access: Public
543 // Description: Returns the current position within the datagram of the
544 // next piece of data to extract.
545 ////////////////////////////////////////////////////////////////////
546 INLINE size_t DatagramIterator::
548  return _current_index;
549 }
550 
551 INLINE void
552 generic_read_datagram(bool &result, DatagramIterator &source) {
553  result = source.get_bool();
554 }
555 
556 INLINE void
557 generic_read_datagram(int &result, DatagramIterator &source) {
558  result = source.get_int32();
559 }
560 
561 INLINE void
562 generic_read_datagram(float &result, DatagramIterator &source) {
563  result = source.get_float32();
564 }
565 
566 INLINE void
567 generic_read_datagram(double &result, DatagramIterator &source) {
568  result = source.get_float64();
569 }
570 
571 INLINE void
572 generic_read_datagram(string &result, DatagramIterator &source) {
573  result = source.get_string();
574 }
575 
576 INLINE void
577 generic_read_datagram(wstring &result, DatagramIterator &source) {
578  result = source.get_wstring();
579 }
580 
581 
void assign(Datagram &datagram, size_t offset=0)
direct Assignment to a Datagram
PN_int8 get_int8()
Extracts a signed 8-bit integer.
PN_int64 get_be_int64()
Extracts a signed 64-bit big-endian integer.
bool get_bool()
Extracts a boolean value.
PN_stdfloat get_stdfloat()
Extracts either a 32-bit or a 64-bit floating-point number, according to Datagram::set_stdfloat_doubl...
PN_float64 get_be_float64()
Extracts a 64-bit big-endian floating-point number.
void dump_hex(ostream &out, unsigned int indent=0) const
Writes a representation of the entire datagram contents, as a sequence of hex (and ASCII) values...
Definition: datagram.cxx:52
const Datagram & get_datagram() const
Return the datagram of this iterator.
bool get_stdfloat_double() const
Returns the stdfloat_double flag.
Definition: datagram.I:534
PN_float32 get_be_float32()
Extracts a 32-bit big-endian single-precision floating-point number.
PN_int64 get_int64()
Extracts a signed 64-bit integer.
PN_int32 get_int32()
Extracts a signed 32-bit integer.
PN_uint8 get_uint8()
Extracts an unsigned 8-bit integer.
PN_uint32 get_uint32()
Extracts an unsigned 32-bit integer.
PN_int16 get_int16()
Extracts a signed 16-bit integer.
string get_string()
Extracts a variable-length string.
PN_uint16 get_uint16()
Extracts an unsigned 16-bit integer.
PN_float32 get_float32()
Extracts a 32-bit single-precision floating-point number.
size_t get_current_index() const
Returns the current position within the datagram of the next piece of data to extract.
int get_remaining_size() const
Return the bytes left in the datagram.
void skip_bytes(size_t size)
Skips over the indicated number of bytes in the datagram.
NativeNumericData and ReversedNumericData work together to provide a sneaky interface for automatical...
PN_uint32 get_be_uint32()
Extracts an unsigned 32-bit big-endian integer.
NativeNumericData and ReversedNumericData work together to provide a sneaky interface for automatical...
PN_int16 get_be_int16()
Extracts a signed 16-bit big-endian integer.
void store_value(void *dest, size_t length) const
Copies the data, with byte reversal if appropriate, into the indicated numeric variable, whose address and sizeof are given.
PN_float64 get_float64()
Extracts a 64-bit floating-point number.
A class to retrieve the individual data elements previously stored in a Datagram. ...
PN_uint64 get_uint64()
Extracts an unsigned 64-bit integer.
string get_remaining_bytes() const
Returns the remaining bytes in the datagram as a string, but does not extract them from the iterator...
PN_uint64 get_be_uint64()
Extracts an unsigned 64-bit big-endian integer.
PN_uint16 get_be_uint16()
Extracts an unsigned 16-bit big-endian integer.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43
void store_value(void *dest, size_t length) const
Copies the data, with byte reversal if appropriate, into the indicated numeric variable, whose address and sizeof are given.
wstring get_wstring()
Extracts a variable-length wstring (with a 32-bit length field).
PN_int32 get_be_int32()
Extracts a signed 32-bit big-endian integer.
size_t get_length() const
Returns the number of bytes in the datagram.
Definition: datagram.I:457
const void * get_data() const
Returns a pointer to the beginning of the datagram&#39;s data.
Definition: datagram.I:447