Panda3D
|
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a data file. More...
#include "datagram.h"
Public Member Functions | |
Datagram () | |
Constructs an empty datagram. More... | |
Datagram (const void *data, size_t size) | |
Constructs a datagram from an existing block of data. More... | |
Datagram (const string &data) | |
Constructs a datagram from an existing block of data. More... | |
Datagram (const Datagram ©) | |
void | add_be_float32 (PN_float32 value) |
Adds a 32-bit single-precision big-endian floating-point number to the datagram. More... | |
void | add_be_float64 (PN_float64 value) |
Adds a 64-bit big-endian floating-point number to the datagram. More... | |
void | add_be_int16 (PN_int16 value) |
Adds a signed 16-bit big-endian integer to the datagram. More... | |
void | add_be_int32 (PN_int32 value) |
Adds a signed 32-bit big-endian integer to the datagram. More... | |
void | add_be_int64 (PN_int64 value) |
Adds a signed 64-bit big-endian integer to the datagram. More... | |
void | add_be_uint16 (PN_uint16 value) |
Adds an unsigned 16-bit big-endian integer to the datagram. More... | |
void | add_be_uint32 (PN_uint32 value) |
Adds an unsigned 32-bit big-endian integer to the datagram. More... | |
void | add_be_uint64 (PN_uint64 value) |
Adds an unsigned 64-bit big-endian integer to the datagram. More... | |
void | add_bool (bool value) |
Adds a boolean value to the datagram. More... | |
void | add_fixed_string (const string &str, size_t size) |
Adds a fixed-length string to the datagram. More... | |
void | add_float32 (PN_float32 value) |
Adds a 32-bit single-precision floating-point number to the datagram. More... | |
void | add_float64 (PN_float64 value) |
Adds a 64-bit floating-point number to the datagram. More... | |
void | add_int16 (PN_int16 value) |
Adds a signed 16-bit integer to the datagram. More... | |
void | add_int32 (PN_int32 value) |
Adds a signed 32-bit integer to the datagram. More... | |
void | add_int64 (PN_int64 value) |
Adds a signed 64-bit integer to the datagram. More... | |
void | add_int8 (PN_int8 value) |
Adds a signed 8-bit integer to the datagram. More... | |
void | add_stdfloat (PN_stdfloat value) |
Adds either a 32-bit or a 64-bit floating-point number, according to set_stdfloat_double(). More... | |
void | add_string (const string &str) |
Adds a variable-length string to the datagram. More... | |
void | add_string32 (const string &str) |
Adds a variable-length string to the datagram, using a 32-bit length field to allow very long strings. More... | |
void | add_uint16 (PN_uint16 value) |
Adds an unsigned 16-bit integer to the datagram. More... | |
void | add_uint32 (PN_uint32 value) |
Adds an unsigned 32-bit integer to the datagram. More... | |
void | add_uint64 (PN_uint64 value) |
Adds an unsigned 64-bit integer to the datagram. More... | |
void | add_uint8 (PN_uint8 value) |
Adds an unsigned 8-bit integer to the datagram. More... | |
void | add_wstring (const wstring &str) |
Adds a variable-length wstring to the datagram. More... | |
void | add_z_string (string str) |
Adds a variable-length string to the datagram, as a NULL-terminated string. More... | |
void | append_data (const void *data, size_t size) |
Appends some more raw data to the end of the datagram. More... | |
void | append_data (const string &data) |
Appends some more raw data to the end of the datagram. More... | |
void | assign (const void *data, size_t size) |
Replaces the datagram's data with the indicated block. More... | |
virtual void | clear () |
Resets the datagram to empty, in preparation for building up a new datagram. More... | |
void | copy_array (CPTA_uchar data) |
Replaces the data in the Datagram with a copy of the data in the indicated CPTA_uchar. More... | |
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. More... | |
virtual TypeHandle | force_init_type () |
CPTA_uchar | get_array () const |
Returns a const pointer to the actual data in the Datagram. More... | |
const void * | get_data () const |
Returns a pointer to the beginning of the datagram's data. More... | |
size_t | get_length () const |
Returns the number of bytes in the datagram. More... | |
string | get_message () const |
Returns the datagram's data as a string. More... | |
bool | get_stdfloat_double () const |
Returns the stdfloat_double flag. More... | |
virtual TypeHandle | get_type () const |
PTA_uchar | modify_array () |
Returns a modifiable pointer to the actual data in the Datagram. More... | |
bool | operator!= (const Datagram &other) const |
bool | operator< (const Datagram &other) const |
void | operator= (const Datagram ©) |
bool | operator== (const Datagram &other) const |
void | output (ostream &out) const |
Write a string representation of this instance to <out>. More... | |
void | pad_bytes (size_t size) |
Adds the indicated number of zero bytes to the datagram. More... | |
void | set_array (PTA_uchar data) |
Replaces the data in the Datagram with the data in the indicated PTA_uchar. More... | |
void | set_stdfloat_double (bool stdfloat_double) |
Changes the stdfloat_double flag, which defines the operation performed by add_stdfloat() and DatagramIterator::get_stdfloat(). More... | |
void | write (ostream &out, unsigned int indent=0) const |
Write a string representation of this instance to <out>. More... | |
![]() | |
TypedObject (const TypedObject ©) | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
int | get_best_parent_from_Set (const std::set< int > &) const |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More... | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. More... | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. More... | |
void | operator= (const TypedObject ©) |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. More... | |
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.
Definition at line 43 of file datagram.h.
|
inline |
Constructs an empty datagram.
Definition at line 21 of file datagram.I.
Referenced by Datagram(), and NetDatagram::NetDatagram().
|
inline |
Constructs a datagram from an existing block of data.
Definition at line 36 of file datagram.I.
References append_data(), and Datagram().
|
inline |
Constructs a datagram from an existing block of data.
Definition at line 52 of file datagram.I.
References add_bool(), append_data(), and Datagram().
|
inline |
Adds a 32-bit single-precision big-endian floating-point number to the datagram.
Definition at line 327 of file datagram.I.
References add_be_float64(), append_data(), and ReversedNumericData::get_data().
Referenced by add_be_uint64(), FltMaterial::build_14_record(), FltLocalVertexPool::build_record(), FltTransformRotateAboutPoint::get_angle(), FltTransformRotateAboutEdge::get_angle(), FltTransformRotateScale::get_angle(), FltVectorRecord::get_vector(), FltTransformScale::has_center(), FltTransformGeneralMatrix::set_matrix(), FltBead::set_replicate_count(), FltVertex::set_rgb(), and FltTexture::write_attr_data().
|
inline |
Adds a 64-bit big-endian floating-point number to the datagram.
Definition at line 339 of file datagram.I.
References add_string(), append_data(), and ReversedNumericData::get_data().
Referenced by add_be_float32(), FltLocalVertexPool::build_record(), FltTransformRotateAboutEdge::get_angle(), FltTransformRotateAboutPoint::get_angle(), FltTransformRotateScale::get_angle(), FltTransformTranslate::get_from(), FltHeader::get_trackplane(), FltTransformScale::has_center(), FltTransformPut::set(), FltVertex::set_rgb(), and FltTexture::write_attr_data().
|
inline |
Adds a signed 16-bit big-endian integer to the datagram.
Definition at line 255 of file datagram.I.
References add_be_int32(), append_data(), and ReversedNumericData::get_data().
Referenced by add_stdfloat(), FltRecordWriter::advance(), FltGeometry::get_alt_rgb(), FltHeader::get_trackplane(), FltBead::set_replicate_count(), FltVertex::set_rgb(), and FltInstanceRef::write().
|
inline |
Adds a signed 32-bit big-endian integer to the datagram.
Definition at line 267 of file datagram.I.
References add_be_int64(), append_data(), and ReversedNumericData::get_data().
Referenced by add_be_int16(), FltLocalVertexPool::build_record(), FltGeometry::get_alt_rgb(), FltHeader::get_trackplane(), and FltTexture::write_attr_data().
|
inline |
Adds a signed 64-bit big-endian integer to the datagram.
Definition at line 279 of file datagram.I.
References add_be_uint16(), append_data(), and ReversedNumericData::get_data().
Referenced by add_be_int32().
|
inline |
Adds an unsigned 16-bit big-endian integer to the datagram.
Definition at line 291 of file datagram.I.
References add_be_uint32(), append_data(), and ReversedNumericData::get_data().
Referenced by add_be_int64(), FltGeometry::get_alt_rgb(), FltHeader::get_trackplane(), and FltVertex::set_rgb().
|
inline |
Adds an unsigned 32-bit big-endian integer to the datagram.
Definition at line 303 of file datagram.I.
References add_be_uint64(), append_data(), and ReversedNumericData::get_data().
Referenced by add_be_uint16(), FltMaterial::build_14_record(), FltGeometry::get_alt_rgb(), FltHeader::get_trackplane(), FltVertexList::output(), FltExternalReference::set_ref_filename(), and FltVertex::set_rgb().
|
inline |
Adds an unsigned 64-bit big-endian integer to the datagram.
Definition at line 315 of file datagram.I.
References add_be_float32(), append_data(), and ReversedNumericData::get_data().
Referenced by add_be_uint32().
|
inline |
Adds a boolean value to the datagram.
Definition at line 118 of file datagram.I.
References add_int8(), and add_uint8().
Referenced by Datagram(), Texture::finalize(), AnimInterface::get_num_frames(), get_stdfloat_double(), BamWriter::init(), MouseRecorder::record_frame(), CubicCurveseg::register_with_read_factory(), PartBundle::register_with_read_factory(), ShowBoundsEffect::write_datagram(), MovieVideo::write_datagram(), RecorderFrame::write_datagram(), AnimChannelScalarTable::write_datagram(), GeomVertexAnimationSpec::write_datagram(), LightLensNode::write_datagram(), AudioVolumeAttrib::write_datagram(), CullFaceAttrib::write_datagram(), ImageFile::write_datagram(), ScissorAttrib::write_datagram(), AnimChannelMatrixXfmTable::write_datagram(), ColorScaleAttrib::write_datagram(), BillboardEffect::write_datagram(), ScissorEffect::write_datagram(), TextureProperties::write_datagram(), RenderModeAttrib::write_datagram(), EggFile::write_datagram(), TextureReference::write_datagram(), PaletteGroup::write_datagram(), Camera::write_datagram(), PaletteImage::write_datagram(), TexturePlacement::write_datagram(), ClipPlaneAttrib::write_datagram(), LightAttrib::write_datagram(), Palettizer::write_datagram(), SparseArray::write_datagram(), TextureImage::write_datagram(), TextureAttrib::write_datagram(), TextureStage::write_datagram(), Shader::write_datagram(), and FFTCompressor::write_reals().
|
inline |
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.
Definition at line 404 of file datagram.I.
References append_data(), and pad_bytes().
Referenced by add_z_string(), FltMaterial::build_14_record(), FltHeader::get_trackplane(), FltBeadID::output(), FltExternalReference::set_ref_filename(), and FltTexture::write_attr_data().
|
inline |
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.
Definition at line 217 of file datagram.I.
References add_float64(), append_data(), and NativeNumericData::get_data().
Referenced by add_stdfloat(), add_uint64(), get_stdfloat_double(), PStatCollectorDef::write_datagram(), PStatFrameData::write_datagram(), Shader::ShaderPtrData::write_datagram(), LVecBase2f::write_datagram_fixed(), LVecBase3f::write_datagram_fixed(), LVecBase4f::write_datagram_fixed(), LMatrix3f::write_datagram_fixed(), LMatrix4f::write_datagram_fixed(), LVecBase2d::write_datagram_fixed(), LVecBase3d::write_datagram_fixed(), LVecBase4d::write_datagram_fixed(), LVecBase2i::write_datagram_fixed(), LVecBase3i::write_datagram_fixed(), LVecBase4i::write_datagram_fixed(), LMatrix3d::write_datagram_fixed(), and LMatrix4d::write_datagram_fixed().
|
inline |
Adds a 64-bit floating-point number to the datagram.
Definition at line 228 of file datagram.I.
References add_stdfloat(), append_data(), and NativeNumericData::get_data().
Referenced by add_float32(), add_stdfloat(), FFTCompressor::free_storage(), get_stdfloat_double(), PiecewiseCurve::rebuild_curveseg(), NurbsCurve::register_with_read_factory(), TexturePosition::write_datagram(), RecorderFrame::write_datagram(), TextureReference::write_datagram(), Palettizer::write_datagram(), TextureImage::write_datagram(), Shader::ShaderPtrData::write_datagram(), LVecBase2f::write_datagram_fixed(), LVecBase3f::write_datagram_fixed(), LVecBase4f::write_datagram_fixed(), LMatrix3f::write_datagram_fixed(), LMatrix4f::write_datagram_fixed(), LVecBase2d::write_datagram_fixed(), LVecBase3d::write_datagram_fixed(), LVecBase4d::write_datagram_fixed(), LVecBase2i::write_datagram_fixed(), LVecBase3i::write_datagram_fixed(), LVecBase4i::write_datagram_fixed(), LMatrix3d::write_datagram_fixed(), LMatrix4d::write_datagram_fixed(), and FFTCompressor::write_header().
|
inline |
Adds a signed 16-bit integer to the datagram.
Definition at line 148 of file datagram.I.
References add_int32(), append_data(), and NativeNumericData::get_data().
Referenced by add_uint8(), FFTCompressor::free_storage(), MovieAudioCursor::read_samples(), PStatCollectorDef::write_datagram(), ButtonEvent::write_datagram(), PaletteGroup::write_datagram(), SamplerState::write_datagram(), and TextureImage::write_datagram().
|
inline |
Adds a signed 32-bit integer to the datagram.
Definition at line 159 of file datagram.I.
References add_int64(), append_data(), and NativeNumericData::get_data().
Referenced by add_int16(), GeomPrimitive::finalize(), Texture::finalize(), FFTCompressor::free_storage(), AnimInterface::get_num_frames(), get_stdfloat_double(), Light::get_viz(), SwitchNode::safe_to_combine_children(), RecorderHeader::write_datagram(), TexturePosition::write_datagram(), CullBinAttrib::write_datagram(), LightLensNode::write_datagram(), ImageFile::write_datagram(), AnimPreloadTable::write_datagram(), TextureProperties::write_datagram(), DepthOffsetAttrib::write_datagram(), AuxBitplaneAttrib::write_datagram(), Material::write_datagram(), TexMatrixAttrib::write_datagram(), TextureReference::write_datagram(), PlaneNode::write_datagram(), ParamTextureImage::write_datagram(), PaletteGroup::write_datagram(), TexturePlacement::write_datagram(), Palettizer::write_datagram(), SparseArray::write_datagram(), TextureAttrib::write_datagram(), LVecBase2f::write_datagram(), TextureStage::write_datagram(), LVecBase3f::write_datagram(), LVecBase4f::write_datagram(), RenderState::write_datagram(), Shader::ShaderPtrData::write_datagram(), LVecBase2d::write_datagram(), LVecBase3d::write_datagram(), LVecBase4d::write_datagram(), LVecBase2i::write_datagram(), LVecBase3i::write_datagram(), LVecBase4i::write_datagram(), LVecBase2f::write_datagram_fixed(), LVecBase3f::write_datagram_fixed(), LVecBase4f::write_datagram_fixed(), LVecBase2d::write_datagram_fixed(), LVecBase3d::write_datagram_fixed(), LVecBase4d::write_datagram_fixed(), LVecBase2i::write_datagram_fixed(), LVecBase3i::write_datagram_fixed(), LVecBase4i::write_datagram_fixed(), DownloadDb::Db::write_header(), FFTCompressor::write_reals(), and PandaNode::write_recorder().
|
inline |
Adds a signed 64-bit integer to the datagram.
Definition at line 170 of file datagram.I.
References add_uint16(), append_data(), and NativeNumericData::get_data().
Referenced by add_int32().
|
inline |
Adds a signed 8-bit integer to the datagram.
Definition at line 128 of file datagram.I.
References add_uint8(), and append_data().
Referenced by add_bool(), FFTCompressor::free_storage(), FltGeometry::get_alt_rgb(), FltHeader::get_trackplane(), Multifile::read_subfile(), NurbsCurve::register_with_read_factory(), CConnectionRepository::send_message_bundle(), ParametricCurve::unregister_drawer(), FltTexture::write_attr_data(), DepthTestAttrib::write_datagram(), AlphaTestAttrib::write_datagram(), DepthWriteAttrib::write_datagram(), ShadeModelAttrib::write_datagram(), HermiteCurveCV::write_datagram(), CullFaceAttrib::write_datagram(), ColorAttrib::write_datagram(), RescaleNormalAttrib::write_datagram(), TransparencyAttrib::write_datagram(), LightRampAttrib::write_datagram(), RenderModeAttrib::write_datagram(), Fog::write_datagram(), ParamTextureImage::write_datagram(), and FFTCompressor::write_header().
|
inline |
Adds either a 32-bit or a 64-bit floating-point number, according to set_stdfloat_double().
Definition at line 240 of file datagram.I.
References add_be_int16(), add_float32(), and add_float64().
Referenced by add_float64(), AnimInterface::get_num_frames(), LODNode::is_any_shown(), TimedCycle::write_datagram(), STTransform::write_datagram(), AnimChannelScalarTable::write_datagram(), UvScrollNode::write_datagram(), AlphaTestAttrib::write_datagram(), UserVertexSlider::write_datagram(), AnimChannelScalarDynamic::write_datagram(), AudioVolumeAttrib::write_datagram(), AnimPreloadTable::write_datagram(), AnimChannelMatrixXfmTable::write_datagram(), CollisionParabola::write_datagram(), LightRampAttrib::write_datagram(), BillboardEffect::write_datagram(), RenderModeAttrib::write_datagram(), DepthOffsetAttrib::write_datagram(), CollisionSphere::write_datagram(), Fog::write_datagram(), CollisionFloorMesh::write_datagram(), Material::write_datagram(), CollisionTube::write_datagram(), PolylightNode::write_datagram(), TransformBlend::write_datagram(), CollisionBox::write_datagram(), SamplerState::write_datagram(), LVecBase2f::write_datagram(), LVecBase3f::write_datagram(), LVecBase4f::write_datagram(), Lens::write_datagram(), LMatrix3f::write_datagram(), LMatrix4f::write_datagram(), LVecBase2d::write_datagram(), LVecBase3d::write_datagram(), LVecBase4d::write_datagram(), LVecBase2i::write_datagram(), LVecBase3i::write_datagram(), LVecBase4i::write_datagram(), LMatrix3d::write_datagram(), LMatrix4d::write_datagram(), and FFTCompressor::write_reals().
|
inline |
Adds a variable-length string to the datagram.
This actually adds a count followed by n bytes.
Definition at line 351 of file datagram.I.
References add_string32(), add_uint16(), and append_data().
Referenced by add_be_float64(), PStatServerControlMessage::encode(), PStatClientControlMessage::encode(), Texture::finalize(), get_stdfloat_double(), CConnectionRepository::send_message_bundle(), AnimGroup::write(), PStatCollectorDef::write_datagram(), MovieVideo::write_datagram(), CullBinAttrib::write_datagram(), RecorderTable::write_datagram(), HermiteCurveCV::write_datagram(), PalettePage::write_datagram(), AnimPreloadTable::write_datagram(), ImageFile::write_datagram(), SpeedTreeNode::InstanceList::write_datagram(), Material::write_datagram(), EggFile::write_datagram(), ButtonEvent::write_datagram(), BamCacheRecord::write_datagram(), TextureReference::write_datagram(), PaletteGroup::write_datagram(), PaletteImage::write_datagram(), PartGroup::write_datagram(), Palettizer::write_datagram(), TextureImage::write_datagram(), TextureStage::write_datagram(), GeomVertexData::write_datagram(), Lens::write_datagram(), Shader::ShaderFile::write_datagram(), PandaNode::write_datagram(), BamWriter::write_handle(), and PandaNode::write_recorder().
|
inline |
Adds a variable-length string to the datagram, using a 32-bit length field to allow very long strings.
Definition at line 369 of file datagram.I.
References add_uint32(), add_z_string(), and append_data().
Referenced by add_string().
|
inline |
Adds an unsigned 16-bit integer to the datagram.
Definition at line 181 of file datagram.I.
References add_uint32(), append_data(), and NativeNumericData::get_data().
Referenced by add_int64(), add_string(), add_wstring(), DatagramTCPHeader::DatagramTCPHeader(), DatagramUDPHeader::DatagramUDPHeader(), PStatServerControlMessage::encode(), PStatClientControlMessage::encode(), GeomVertexData::CacheEntry::evict_callback(), Geom::CacheEntry::evict_callback(), GeomNode::finalize(), FFTCompressor::free_storage(), BamWriter::init(), Multifile::read_subfile(), CConnectionRepository::send_message_bundle(), AnimGroup::write(), TimedCycle::write_datagram(), GeomPatches::write_datagram(), AnimChannelBase::write_datagram(), DataNodeTransmit::write_datagram(), ButtonEventList::write_datagram(), AnimChannelScalarTable::write_datagram(), PStatFrameData::write_datagram(), RecorderTable::write_datagram(), GeomVertexAnimationSpec::write_datagram(), ComputeNode::Dispatcher::CData::write_datagram(), PartBundleNode::write_datagram(), OccluderEffect::write_datagram(), ModelNode::write_datagram(), AntialiasAttrib::write_datagram(), AnimPreloadTable::write_datagram(), AnimChannelMatrixXfmTable::write_datagram(), OccluderNode::write_datagram(), ScissorEffect::write_datagram(), CharacterJoint::write_datagram(), GeomVertexColumn::write_datagram(), CollisionNode::write_datagram(), TransformTable::write_datagram(), CompassEffect::write_datagram(), CollisionFloorMesh::write_datagram(), TexMatrixAttrib::write_datagram(), SliderTable::write_datagram(), BamCacheRecord::write_datagram(), ButtonEvent::write_datagram(), TexProjectorEffect::write_datagram(), PartGroup::write_datagram(), TransformBlend::write_datagram(), TexGenAttrib::write_datagram(), TransformBlendTable::write_datagram(), ClipPlaneAttrib::write_datagram(), CollisionPolygon::write_datagram(), CollisionBox::write_datagram(), LightAttrib::write_datagram(), Character::write_datagram(), TextureAttrib::write_datagram(), RenderEffects::write_datagram(), LODNode::write_datagram(), RenderState::write_datagram(), Lens::write_datagram(), BamWriter::write_handle(), and PandaNode::write_recorder().
|
inline |
Adds an unsigned 32-bit integer to the datagram.
Definition at line 192 of file datagram.I.
References add_uint64(), append_data(), and NativeNumericData::get_data().
Referenced by add_string32(), add_uint16(), add_wstring(), DatagramTCPHeader::DatagramTCPHeader(), GeomVertexArrayData::finalize(), Texture::finalize(), HashVal::input_dec(), Multifile::read_subfile(), PiecewiseCurve::rebuild_curveseg(), NurbsCurve::register_with_read_factory(), HermiteCurve::register_with_read_factory(), RecorderHeader::write_datagram(), RecorderFrame::write_datagram(), BamCacheIndex::write_datagram(), PalettePage::write_datagram(), PaletteGroups::write_datagram(), SpeedTreeNode::InstanceList::write_datagram(), CollisionNode::write_datagram(), CollisionFloorMesh::write_datagram(), EggFile::write_datagram(), BamCacheRecord::write_datagram(), PaletteGroup::write_datagram(), PaletteImage::write_datagram(), Camera::write_datagram(), BitArray::write_datagram(), SparseArray::write_datagram(), StencilAttrib::write_datagram(), TextureImage::write_datagram(), SpeedTreeNode::write_datagram(), Shader::ShaderPtrData::write_datagram(), BamWriter::write_handle(), DownloadDb::Db::write_header(), and PandaNode::write_recorder().
|
inline |
Adds an unsigned 64-bit integer to the datagram.
Definition at line 203 of file datagram.I.
References add_float32(), append_data(), and NativeNumericData::get_data().
Referenced by add_uint32(), CConnectionRepository::send_message_bundle(), and BamCacheRecord::write_datagram().
|
inline |
Adds an unsigned 8-bit integer to the datagram.
Definition at line 138 of file datagram.I.
References add_int16(), and append_data().
Referenced by add_bool(), add_int8(), add_z_string(), PStatServerControlMessage::encode(), PStatClientControlMessage::encode(), GeomVertexData::CacheEntry::evict_callback(), Geom::CacheEntry::evict_callback(), GeomVertexArrayData::finalize(), GeomPrimitive::finalize(), Texture::finalize(), FFTCompressor::free_storage(), FltGeometry::get_alt_rgb(), AnimInterface::get_num_frames(), BamWriter::init(), PartBundle::register_with_read_factory(), AnimChannelScalarTable::write_datagram(), GeomVertexAnimationSpec::write_datagram(), ColorWriteAttrib::write_datagram(), ModelNode::write_datagram(), ImageFile::write_datagram(), GeomVertexColumn::write_datagram(), ButtonEvent::write_datagram(), PlaneNode::write_datagram(), ParamTextureImage::write_datagram(), ColorBlendAttrib::write_datagram(), TexGenAttrib::write_datagram(), BitArray::write_datagram(), Palettizer::write_datagram(), CollisionSolid::write_datagram(), SamplerState::write_datagram(), TextureImage::write_datagram(), TextureStage::write_datagram(), Shader::ShaderPtrData::write_datagram(), Lens::write_datagram(), Shader::ShaderFile::write_datagram(), Shader::write_datagram(), BamWriter::write_file_data(), BamWriter::write_handle(), BamWriter::write_object(), and PandaNode::write_recorder().
void Datagram::add_wstring | ( | const wstring & | str | ) |
Adds a variable-length wstring to the datagram.
Definition at line 92 of file datagram.cxx.
References add_uint16(), add_uint32(), and pad_bytes().
Referenced by dump_hex(), and get_stdfloat_double().
|
inline |
Adds a variable-length string to the datagram, as a NULL-terminated string.
Definition at line 384 of file datagram.I.
References add_fixed_string(), add_uint8(), and append_data().
Referenced by add_string32().
void Datagram::append_data | ( | const void * | data, |
size_t | size | ||
) |
Appends some more raw data to the end of the datagram.
Definition at line 144 of file datagram.cxx.
References assign().
Referenced by add_be_float32(), add_be_float64(), add_be_int16(), add_be_int32(), add_be_int64(), add_be_uint16(), add_be_uint32(), add_be_uint64(), add_fixed_string(), add_float32(), add_float64(), add_int16(), add_int32(), add_int64(), add_int8(), add_string(), add_string32(), add_uint16(), add_uint32(), add_uint64(), add_uint8(), add_z_string(), append_data(), Datagram(), GeomVertexArrayData::finalize(), Texture::finalize(), DCClass::output(), pad_bytes(), and ConnectionReader::shutdown().
|
inline |
Appends some more raw data to the end of the datagram.
Definition at line 421 of file datagram.I.
References append_data(), and get_message().
void Datagram::assign | ( | const void * | data, |
size_t | size | ||
) |
Replaces the datagram's data with the indicated block.
Definition at line 178 of file datagram.cxx.
References output().
Referenced by append_data().
|
virtual |
Resets the datagram to empty, in preparation for building up a new datagram.
Reimplemented in NetDatagram.
Definition at line 41 of file datagram.cxx.
References dump_hex().
Referenced by FltRecordWriter::advance(), NetDatagram::clear(), PStatServerControlMessage::encode(), PStatClientControlMessage::encode(), and DatagramInputFile::get_datagram().
|
inline |
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.
Definition at line 484 of file datagram.I.
References get_array(), and ConstPointerToArray< Element >::v().
Referenced by set_array().
void Datagram::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 at line 52 of file datagram.cxx.
References add_wstring(), get_data(), and get_length().
Referenced by clear(), CConnectionRepository::shutdown(), DatagramIterator::skip_bytes(), GeomVertexData::transform_vertices(), DCField::validate_ranges(), DatagramUDPHeader::verify_datagram(), DatagramTCPHeader::verify_datagram(), and write().
|
inline |
Returns a const pointer to the actual data in the Datagram.
Definition at line 496 of file datagram.I.
References modify_array().
Referenced by copy_array().
|
inline |
Returns a pointer to the beginning of the datagram's data.
Definition at line 447 of file datagram.I.
References get_length().
Referenced by FltRecordWriter::advance(), dump_hex(), DatagramIterator::extract_bytes(), GeomVertexArrayData::finalize(), DatagramIterator::get_be_float32(), DatagramIterator::get_be_float64(), DatagramIterator::get_be_int16(), DatagramIterator::get_be_int32(), DatagramIterator::get_be_int64(), DatagramIterator::get_be_uint16(), DatagramIterator::get_be_uint32(), DatagramIterator::get_be_uint64(), DatagramIterator::get_fixed_string(), DatagramIterator::get_float32(), DatagramIterator::get_float64(), IffInputFile::get_id(), DatagramIterator::get_int16(), DatagramIterator::get_int32(), DatagramIterator::get_int64(), DatagramIterator::get_int8(), get_message(), DatagramIterator::get_remaining_bytes(), DatagramIterator::get_string(), DatagramIterator::get_string32(), DatagramIterator::get_uint16(), DatagramIterator::get_uint32(), DatagramIterator::get_uint64(), DatagramIterator::get_uint8(), DatagramIterator::get_z_string(), DCClass::output(), DatagramOutputFile::put_datagram(), GeomVertexArrayData::read_raw_data(), Multifile::read_subfile(), EggJointData::score_reparent_to(), and FltTexture::write_attr_data().
|
inline |
Returns the number of bytes in the datagram.
Definition at line 457 of file datagram.I.
References set_array().
Referenced by FltRecordWriter::advance(), DatagramTCPHeader::DatagramTCPHeader(), DatagramUDPHeader::DatagramUDPHeader(), dump_hex(), DatagramIterator::get_be_float32(), DatagramIterator::get_be_float64(), DatagramIterator::get_be_int16(), DatagramIterator::get_be_int32(), DatagramIterator::get_be_int64(), DatagramIterator::get_be_uint16(), DatagramIterator::get_be_uint32(), DatagramIterator::get_be_uint64(), RecentConnectionReader::get_data(), get_data(), DatagramGeneratorNet::get_datagram(), DatagramIterator::get_float32(), DatagramIterator::get_float64(), DatagramIterator::get_int16(), DatagramIterator::get_int32(), DatagramIterator::get_int64(), DatagramIterator::get_remaining_bytes(), DatagramIterator::get_remaining_size(), DatagramIterator::get_uint16(), DatagramIterator::get_uint32(), DatagramIterator::get_uint64(), DatagramIterator::get_wstring(), DatagramIterator::get_z_string(), BamReader::init(), ConnectionWriter::is_valid_for_udp(), DatagramOutputFile::put_datagram(), IffGenericChunk::read_iff(), Multifile::read_subfile(), BamReader::register_pta(), EggJointData::score_reparent_to(), ConnectionWriter::send(), FltVertex::set_rgb(), ConnectionReader::shutdown(), DatagramIterator::skip_bytes(), DatagramIterator::write(), and FltTexture::write_attr_data().
|
inline |
Returns the datagram's data as a string.
Definition at line 431 of file datagram.I.
References get_data().
Referenced by CConnectionRepository::abandon_message_bundles(), append_data(), HashVal::as_bin(), DatagramTCPHeader::DatagramTCPHeader(), DatagramUDPHeader::DatagramUDPHeader(), DatagramUDPHeader::get_header(), DatagramTCPHeader::get_header(), DCClass::output(), CConnectionRepository::shutdown(), DatagramUDPHeader::verify_datagram(), DatagramTCPHeader::verify_datagram(), and DownloadDb::Db::write_header().
|
inline |
Returns the stdfloat_double flag.
Definition at line 534 of file datagram.I.
References add_bool(), add_float32(), add_float64(), add_int32(), add_string(), and add_wstring().
Referenced by DatagramIterator::get_stdfloat(), and set_stdfloat_double().
|
inline |
Returns a modifiable pointer to the actual data in the Datagram.
Definition at line 507 of file datagram.I.
References set_stdfloat_double().
Referenced by get_array().
void Datagram::output | ( | ostream & | out | ) | const |
Write a string representation of this instance to <out>.
Definition at line 193 of file datagram.cxx.
References write().
Referenced by assign().
void Datagram::pad_bytes | ( | size_t | size | ) |
Adds the indicated number of zero bytes to the datagram.
Definition at line 111 of file datagram.cxx.
References append_data().
Referenced by add_fixed_string(), add_wstring(), FltMaterial::build_14_record(), FltGeometry::get_alt_rgb(), FltTransformRotateAboutEdge::get_angle(), FltTransformRotateAboutPoint::get_angle(), FltTransformRotateScale::get_angle(), FltTransformTranslate::get_from(), FltHeader::get_trackplane(), FltTransformScale::has_center(), FltTransformPut::set(), FltExternalReference::set_ref_filename(), FltBead::set_replicate_count(), FltVertex::set_rgb(), FltInstanceRef::write(), and FltTexture::write_attr_data().
|
inline |
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.
Definition at line 470 of file datagram.I.
References copy_array().
Referenced by get_length().
|
inline |
Changes the stdfloat_double flag, which defines the operation performed by add_stdfloat() and DatagramIterator::get_stdfloat().
When this is true, add_stdfloat() adds a 64-bit floating-point number; when it is false, it adds a 32-bit floating-point number. The default is based on the STDFLOAT_DOUBLE compilation flag.
Definition at line 523 of file datagram.I.
References get_stdfloat_double().
Referenced by BamReader::get_factory(), modify_array(), and BamWriter::write_handle().
void Datagram::write | ( | ostream & | out, |
unsigned int | indent = 0 |
||
) | const |
Write a string representation of this instance to <out>.
Definition at line 206 of file datagram.cxx.
References dump_hex().
Referenced by output(), and DatagramIterator::write().