14#ifndef DATAGRAMITERATOR_H
15#define DATAGRAMITERATOR_H
30class EXPCL_PANDA_EXPRESS DatagramIterator {
35 INLINE DatagramIterator();
36 INLINE DatagramIterator(
const Datagram &datagram,
size_t offset = 0);
80 void output(std::ostream &out)
const;
81 void write(std::ostream &out,
unsigned int indent=0)
const;
85 size_t _current_index;
91 static void init_type() {
A class to retrieve the individual data elements previously stored in a Datagram.
void skip_bytes(size_t size)
Skips over the indicated number of bytes in the datagram.
uint8_t get_uint8()
Extracts an unsigned 8-bit integer.
PN_float32 get_float32()
Extracts a 32-bit single-precision floating-point number.
void assign(Datagram &datagram, size_t offset=0)
direct Assignment to a Datagram
vector_uchar get_blob32()
Extracts a variable-length binary blob with a 32-bit size field.
uint16_t get_be_uint16()
Extracts an unsigned 16-bit big-endian integer.
int16_t get_int16()
Extracts a signed 16-bit integer.
uint32_t get_be_uint32()
Extracts an unsigned 32-bit big-endian integer.
int32_t get_be_int32()
Extracts a signed 32-bit big-endian integer.
std::string get_z_string()
Extracts a variable-length string, as a NULL-terminated string.
uint64_t get_uint64()
Extracts an unsigned 64-bit integer.
PN_stdfloat get_stdfloat()
Extracts either a 32-bit or a 64-bit floating-point number, according to Datagram::set_stdfloat_doubl...
uint16_t get_uint16()
Extracts an unsigned 16-bit integer.
PN_float32 get_be_float32()
Extracts a 32-bit big-endian single-precision floating-point number.
int64_t get_int64()
Extracts a signed 64-bit integer.
std::wstring get_wstring()
Extracts a variable-length wstring (with a 32-bit length field).
vector_uchar extract_bytes(size_t size)
Extracts the indicated number of bytes in the datagram and returns them as a string.
uint32_t get_uint32()
Extracts an unsigned 32-bit integer.
vector_uchar get_remaining_bytes() const
Returns the remaining bytes in the datagram as a string, but does not extract them from the iterator.
void write(std::ostream &out, unsigned int indent=0) const
Write a string representation of this instance to <out>.
int8_t get_int8()
Extracts a signed 8-bit integer.
PN_float64 get_float64()
Extracts a 64-bit floating-point number.
uint64_t get_be_uint64()
Extracts an unsigned 64-bit big-endian integer.
bool get_bool()
Extracts a boolean value.
std::string get_fixed_string(size_t size)
Extracts a fixed-length string.
std::string get_string()
Extracts a variable-length string.
PN_float64 get_be_float64()
Extracts a 64-bit big-endian floating-point number.
int16_t get_be_int16()
Extracts a signed 16-bit big-endian integer.
void output(std::ostream &out) const
Write a string representation of this instance to <out>.
const Datagram & get_datagram() const
Return the datagram of this iterator.
std::string get_string32()
Extracts a variable-length string with a 32-bit length field.
int32_t get_int32()
Extracts a signed 32-bit integer.
vector_uchar get_blob()
Extracts a variable-length binary blob.
size_t get_current_index() const
Returns the current position within the datagram of the next piece of data to extract.
int64_t get_be_int64()
Extracts a signed 64-bit big-endian integer.
size_t get_remaining_size() const
Return the bytes left in the datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...