|
|
|
API Reference: Datagram
Datagram
from pandac.PandaModules import Datagram
Class : Datagram
Description : An ordered list of data elements, formatted in memory for transmission over a socket or writing to a data file.
Data elements should be added one at a time, in order, to the Datagram. The nature and contents of the data elements are totally up to the user. When a Datagram has been transmitted and received, its data elements may be extracted using a DatagramIterator; it is up to the caller to know the correct type of each data element in order.
A Datagram is itself headerless; it is simply a collection of data elements.
Inheritance:
Methods of Datagram:
Methods of TypedObject:
Datagram
Datagram::Datagram(void);
Description: Constructs an empty datagram.
Description: Constructs a datagram from an existing block of data.
Description:
|
addBeFloat32
void Datagram::add_be_float32(float value);
Description: Adds a 32-bit single-precision big-endian floating-point number to the datagram. Since this kind of float is not necessarily portable across different architectures, special care is required.
|
addBeFloat64
void Datagram::add_be_float64(double value);
Description: Adds a 64-bit big-endian floating-point number to the datagram.
|
addBeInt16
void Datagram::add_be_int16(short int value);
These functions pack numbers big-endian, in case that's desired.
Description: Adds a signed 16-bit big-endian integer to the datagram.
|
addBeInt32
void Datagram::add_be_int32(int value);
These functions pack numbers big-endian, in case that's desired.
Description: Adds a signed 32-bit big-endian integer to the datagram.
|
addBeInt64
void Datagram::add_be_int64(long int value);
Description: Adds a signed 64-bit big-endian integer to the datagram.
|
addBeUint16
void Datagram::add_be_uint16(unsigned short int value);
Description: Adds an unsigned 16-bit big-endian integer to the datagram.
|
addBeUint32
void Datagram::add_be_uint32(unsigned int value);
Description: Adds an unsigned 32-bit big-endian integer to the datagram.
|
addBeUint64
void Datagram::add_be_uint64(unsigned long int value);
Description: Adds an unsigned 64-bit big-endian integer to the datagram.
|
addBool
void Datagram::add_bool(bool value);
Description: Adds a boolean value to the datagram.
|
addFixedString
void Datagram::add_fixed_string(string const &str, unsigned int size);
Description: Adds a fixed-length string to the datagram. If the string given is less than the requested size, this will pad the string out with zeroes; if it is greater than the requested size, this will silently truncate the string.
|
addFloat32
void Datagram::add_float32(float value);
Description: Adds a 32-bit single-precision floating-point number to the datagram. Since this kind of float is not necessarily portable across different architectures, special care is required.
|
addFloat64
void Datagram::add_float64(double value);
Description: Adds a 64-bit floating-point number to the datagram.
|
addInt16
void Datagram::add_int16(short int value);
The default numeric packing is little-endian.
Description: Adds a signed 16-bit integer to the datagram.
|
addInt32
void Datagram::add_int32(int value);
The default numeric packing is little-endian.
Description: Adds a signed 32-bit integer to the datagram.
|
addInt64
void Datagram::add_int64(long int value);
Description: Adds a signed 64-bit integer to the datagram.
|
addInt8
void Datagram::add_int8(signed char value);
Description: Adds a signed 8-bit integer to the datagram.
|
addString
void Datagram::add_string(string const &str);
Description: Adds a variable-length string to the datagram. This actually adds a count followed by n bytes.
|
addString32
void Datagram::add_string32(string const &str);
Description: Adds a variable-length string to the datagram, using a 32-bit length field to allow very long strings.
|
addUint16
void Datagram::add_uint16(unsigned short int value);
Description: Adds an unsigned 16-bit integer to the datagram.
|
addUint32
void Datagram::add_uint32(unsigned int value);
Description: Adds an unsigned 32-bit integer to the datagram.
|
addUint64
void Datagram::add_uint64(unsigned long int value);
Description: Adds an unsigned 64-bit integer to the datagram.
|
addUint8
void Datagram::add_uint8(unsigned char value);
Description: Adds an unsigned 8-bit integer to the datagram.
|
addWstring
void Datagram::add_wstring(basic_string< wchar_t > const &str);
Description: Adds a variable-length wstring to the datagram.
|
addZString
void Datagram::add_z_string(string str);
Description: Adds a variable-length string to the datagram, as a NULL-terminated string.
|
appendData
void Datagram::append_data(void const *data, unsigned int size);
Description: Appends some more raw data to the end of the datagram.
|
assign
void Datagram::assign(void const *data, unsigned int size);
Undocumented function.
|
clear
virtual void Datagram::clear(void);
Description: Resets the datagram to empty, in preparation for building up a new datagram.
|
copyArray
void Datagram::copy_array(ConstPointerToArray< unsigned char > data);
Description: Replaces the data in the Datagram with a copy of the data in the indicated CPTA_uchar. Unlike set_array(), a complete copy is made of the data; subsequent changes to the Datagram will *not* change the source CPTA_uchar.
|
dumpHex
void Datagram::dump_hex(ostream &out, unsigned int indent = (0)) const;
Description: Writes a representation of the entire datagram contents, as a sequence of hex (and ASCII) values.
|
getArray
ConstPointerToArray< unsigned char > Datagram::get_array(void) const;
Description: Returns a const pointer to the actual data in the Datagram.
|
getData
void const *Datagram::get_data(void) const;
Description: Returns a pointer to the beginning of the datagram's data.
|
getLength
unsigned int Datagram::get_length(void) const;
Description: Returns the number of bytes in the datagram.
|
getMessage
string Datagram::get_message(void) const;
Description: Returns the datagram's data as a string.
|
modifyArray
PointerToArray< unsigned char > Datagram::modify_array(void);
Description: Returns a modifiable pointer to the actual data in the Datagram.
|
operator !=
bool Datagram::operator !=(Datagram const &other) const;
Description:
|
operator <
bool Datagram::operator <(Datagram const &other) const;
Description:
|
operator =
void Datagram::operator =(Datagram const ©);
Description:
|
operator ==
bool Datagram::operator ==(Datagram const &other) const;
Description:
|
output
void Datagram::output(ostream &out) const;
Description : Write a string representation of this instance to <out>.
|
padBytes
void Datagram::pad_bytes(unsigned int size);
Description: Adds the indicated number of zero bytes to the datagram.
|
setArray
void Datagram::set_array(PointerToArray< unsigned char > data);
Description: Replaces the data in the Datagram with the data in the indicated PTA_uchar. This is assignment by reference: subsequent changes to the Datagram will also change the source PTA_uchar.
|
write
void Datagram::write(ostream &out, unsigned int indent = (0)) const;
Description : Write a string representation of this instance to <out>.
|
getType
virtual TypeHandle TypedObject::get_type(void) const = 0;
Derived classes should override this function to return get_class_type().
|
getTypeIndex
int TypedObject::get_type_index(void) const;
Description: Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index().
|
isExactType
bool TypedObject::is_exact_type(TypeHandle handle) const;
Description: Returns true if the current object is the indicated type exactly.
|
isOfType
bool TypedObject::is_of_type(TypeHandle handle) const;
Description: Returns true if the current object is or derives from the indicated type.
|
| | |