# PyDatagram

from direct.distributed.PyDatagram import PyDatagram

## Inheritance:

PyDatagram: Datagram
Datagram: TypedObject
TypedObject:

## Methods of PyDatagram:

addOldServerHeader
addServerHeader
putArg

## Methods of Datagram:

addBeFloat32
addBeFloat64
addBeInt16
addBeInt32
addBeInt64
addBeUint16
addBeUint32
addBeUint64
addBool
addFixedString
addFloat32
addFloat64
addInt16
addInt32
addInt64
addInt8
addString
addString32
addUint16
addUint32
addUint64
addUint8
addWstring
addZString
appendData
clear
copyArray
dumpHex
getArray
getClassType
getData
getLength
getMessage
modifyArray
operator !=
operator <
operator =
operator ==
output
padBytes
setArray
write

## Methods of TypedObject:

getClassType
getType
getTypeIndex
isExactType
isOfType

addOldServerHeader def addOldServerHeader(self, channel, sender, code) Undocumented function.

addServerHeader def addServerHeader(self, channel, sender, code) Undocumented function.

putArg def putArg(self, arg, subatomicType, divisor=1) Undocumented function.

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(__int64 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 __int64 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(__int64 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 __int64 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.

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) 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.

getClassType static TypeHandle Datagram::get_class_type(void); Undocumented function.

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 &copy); 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>.

getClassType static TypeHandle TypedObject::get_class_type(void); Undocumented function.

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.