Panda3D
|
A class to retrieve the individual data elements previously stored in a Datagram. More...
#include "datagramIterator.h"
Public Member Functions | |
DatagramIterator (const DatagramIterator ©) | |
DatagramIterator (const Datagram &datagram, size_t offset=0) | |
void | assign (Datagram &datagram, size_t offset=0) |
direct Assignment to a Datagram | |
string | extract_bytes (size_t size) |
Extracts the indicated number of bytes in the datagram and returns them as a string. | |
PN_float32 | get_be_float32 () |
Extracts a 32-bit big-endian single-precision floating-point number. | |
PN_float64 | get_be_float64 () |
Extracts a 64-bit big-endian floating-point number. | |
PN_int16 | get_be_int16 () |
Extracts a signed 16-bit big-endian integer. | |
PN_int32 | get_be_int32 () |
Extracts a signed 32-bit big-endian integer. | |
PN_int64 | get_be_int64 () |
Extracts a signed 64-bit big-endian integer. | |
PN_uint16 | get_be_uint16 () |
Extracts an unsigned 16-bit big-endian integer. | |
PN_uint32 | get_be_uint32 () |
Extracts an unsigned 32-bit big-endian integer. | |
PN_uint64 | get_be_uint64 () |
Extracts an unsigned 64-bit big-endian integer. | |
bool | get_bool () |
Extracts a boolean value. | |
size_t | get_current_index () const |
Returns the current position within the datagram of the next piece of data to extract. | |
const Datagram & | get_datagram () const |
Return the datagram of this iterator. | |
string | get_fixed_string (size_t size) |
Extracts a fixed-length string. | |
PN_float32 | get_float32 () |
Extracts a 32-bit single-precision floating-point number. | |
PN_float64 | get_float64 () |
Extracts a 64-bit floating-point number. | |
PN_int16 | get_int16 () |
Extracts a signed 16-bit integer. | |
PN_int32 | get_int32 () |
Extracts a signed 32-bit integer. | |
PN_int64 | get_int64 () |
Extracts a signed 64-bit integer. | |
PN_int8 | get_int8 () |
Extracts a signed 8-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. | |
int | get_remaining_size () const |
Return the bytes left in the datagram. | |
PN_stdfloat | get_stdfloat () |
Extracts either a 32-bit or a 64-bit floating-point number, according to Datagram::set_stdfloat_double(). | |
string | get_string () |
Extracts a variable-length string. | |
string | get_string32 () |
Extracts a variable-length string with a 32-bit length field. | |
PN_uint16 | get_uint16 () |
Extracts an unsigned 16-bit integer. | |
PN_uint32 | get_uint32 () |
Extracts an unsigned 32-bit integer. | |
PN_uint64 | get_uint64 () |
Extracts an unsigned 64-bit integer. | |
PN_uint8 | get_uint8 () |
Extracts an unsigned 8-bit integer. | |
wstring | get_wstring () |
Extracts a variable-length wstring (with a 32-bit length field). | |
string | get_z_string () |
Extracts a variable-length string, as a NULL-terminated string. | |
void | operator= (const DatagramIterator ©) |
void | output (ostream &out) const |
Write a string representation of this instance to <out>. | |
void | skip_bytes (size_t size) |
Skips over the indicated number of bytes in the datagram. | |
void | write (ostream &out, unsigned int indent=0) const |
Write a string representation of this instance to <out>. |
A class to retrieve the individual data elements previously stored in a Datagram.
Elements may be retrieved one at a time; it is up to the caller to know the correct type and order of each element.
Definition at line 30 of file datagramIterator.h.
void DatagramIterator::assign | ( | Datagram & | datagram, |
size_t | offset = 0 |
||
) | [inline] |
direct Assignment to a Datagram
Definition at line 65 of file datagramIterator.I.
string DatagramIterator::extract_bytes | ( | size_t | size | ) |
Extracts the indicated number of bytes in the datagram and returns them as a string.
Definition at line 139 of file datagramIterator.cxx.
References Datagram::get_data().
PN_float32 DatagramIterator::get_be_float32 | ( | ) | [inline] |
Extracts a 32-bit big-endian single-precision floating-point number.
Definition at line 447 of file datagramIterator.I.
References Datagram::get_data(), and Datagram::get_length().
Referenced by FltMaterial::extract_14_record(), FltVertex::extract_record(), and IffInputFile::get_be_float32().
PN_float64 DatagramIterator::get_be_float64 | ( | ) | [inline] |
Extracts a 64-bit big-endian floating-point number.
Definition at line 468 of file datagramIterator.I.
References Datagram::get_data(), Datagram::get_length(), and ReversedNumericData::store_value().
Referenced by FltVertex::extract_record().
PN_int16 DatagramIterator::get_be_int16 | ( | ) | [inline] |
Extracts a signed 16-bit big-endian integer.
Definition at line 320 of file datagramIterator.I.
References Datagram::get_data(), and Datagram::get_length().
Referenced by FltVertex::extract_record(), FltGeometry::extract_record(), and IffInputFile::get_be_int16().
PN_int32 DatagramIterator::get_be_int32 | ( | ) | [inline] |
Extracts a signed 32-bit big-endian integer.
Definition at line 341 of file datagramIterator.I.
References Datagram::get_data(), and Datagram::get_length().
Referenced by FltVertex::extract_record(), FltLocalVertexPool::extract_record(), FltGeometry::extract_record(), and IffInputFile::get_be_int32().
PN_int64 DatagramIterator::get_be_int64 | ( | ) | [inline] |
Extracts a signed 64-bit big-endian integer.
Definition at line 362 of file datagramIterator.I.
References Datagram::get_data(), and Datagram::get_length().
PN_uint16 DatagramIterator::get_be_uint16 | ( | ) | [inline] |
Extracts an unsigned 16-bit big-endian integer.
Definition at line 383 of file datagramIterator.I.
References Datagram::get_data(), and Datagram::get_length().
Referenced by FltVertex::extract_record(), FltGeometry::extract_record(), and IffInputFile::get_be_uint16().
PN_uint32 DatagramIterator::get_be_uint32 | ( | ) | [inline] |
Extracts an unsigned 32-bit big-endian integer.
Definition at line 404 of file datagramIterator.I.
References Datagram::get_data(), and Datagram::get_length().
Referenced by FltMaterial::extract_14_record(), FltGeometry::extract_record(), and IffInputFile::get_be_uint32().
PN_uint64 DatagramIterator::get_be_uint64 | ( | ) | [inline] |
Extracts an unsigned 64-bit big-endian integer.
Definition at line 425 of file datagramIterator.I.
References Datagram::get_data(), and Datagram::get_length().
bool DatagramIterator::get_bool | ( | ) | [inline] |
Extracts a boolean value.
Definition at line 88 of file datagramIterator.I.
References get_uint8().
Referenced by Texture::do_fillin_body(), TextureReference::fillin(), TextureProperties::fillin(), TexturePlacement::fillin(), TextureImage::fillin(), Palettizer::fillin(), PaletteImage::fillin(), PaletteGroup::fillin(), ImageFile::fillin(), EggFile::fillin(), RecorderFrame::fillin(), LightLensNode::fillin(), TextureAttrib::fillin(), ShowBoundsEffect::fillin(), ScissorEffect::fillin(), RenderModeAttrib::fillin(), LightAttrib::fillin(), CullFaceAttrib::fillin(), ColorScaleAttrib::fillin(), ClipPlaneAttrib::fillin(), Camera::fillin(), BillboardEffect::fillin(), AudioVolumeAttrib::fillin(), CubicCurveseg::fillin(), MovieVideo::fillin(), TextureStage::fillin(), GeomVertexAnimationSpec::fillin(), PartGroup::fillin(), PartBundle::fillin(), AnimChannelScalarTable::fillin(), AnimChannelMatrixXfmTable::fillin(), BamReader::init(), TextureStage::make_TextureStage(), Texture::make_this_from_bam(), MouseRecorder::play_frame(), SparseArray::read_datagram(), and FFTCompressor::read_reals().
size_t DatagramIterator::get_current_index | ( | ) | const [inline] |
Returns the current position within the datagram of the next piece of data to extract.
Definition at line 547 of file datagramIterator.I.
Referenced by RecorderFrame::fillin(), and GeomVertexArrayData::read_raw_data().
const Datagram & DatagramIterator::get_datagram | ( | ) | const [inline] |
Return the datagram of this iterator.
Definition at line 536 of file datagramIterator.I.
Referenced by RecorderFrame::fillin(), FltRecordReader::get_datagram(), GeomVertexArrayData::read_raw_data(), and write().
string DatagramIterator::get_fixed_string | ( | size_t | size | ) |
Extracts a fixed-length string.
However, if a zero byte occurs within the string, it marks the end of the string.
Definition at line 95 of file datagramIterator.cxx.
References Datagram::get_data().
Referenced by FltMaterial::extract_14_record(), FltExternalReference::extract_record(), and FltBeadID::extract_record().
PN_float32 DatagramIterator::get_float32 | ( | ) | [inline] |
Extracts a 32-bit single-precision floating-point number.
Definition at line 261 of file datagramIterator.I.
References Datagram::get_data(), Datagram::get_length(), and NativeNumericData::store_value().
Referenced by get_stdfloat(), PStatFrameData::read_datagram(), and PStatCollectorDef::read_datagram().
PN_float64 DatagramIterator::get_float64 | ( | ) | [inline] |
Extracts a 64-bit floating-point number.
Definition at line 282 of file datagramIterator.I.
References Datagram::get_data(), Datagram::get_length(), and NativeNumericData::store_value().
Referenced by TextureReference::fillin(), TexturePosition::fillin(), TextureImage::fillin(), Palettizer::fillin(), RecorderFrame::fillin(), PiecewiseCurve::fillin(), NurbsCurve::fillin(), get_stdfloat(), and FFTCompressor::read_header().
PN_int16 DatagramIterator::get_int16 | ( | ) | [inline] |
Extracts a signed 16-bit integer.
Definition at line 134 of file datagramIterator.I.
References Datagram::get_data(), and Datagram::get_length().
Referenced by UserDataAudio::append(), Texture::do_fillin_body(), TextureImage::fillin(), PaletteGroup::fillin(), PStatCollectorDef::read_datagram(), and ButtonEvent::read_datagram().
PN_int32 DatagramIterator::get_int32 | ( | ) | [inline] |
Extracts a signed 32-bit integer.
Definition at line 155 of file datagramIterator.I.
References Datagram::get_data(), and Datagram::get_length().
Referenced by NodePath::decode_from_bam_stream(), Texture::do_fillin_body(), TextureReference::fillin(), TextureProperties::fillin(), TexturePosition::fillin(), TexturePlacement::fillin(), Palettizer::fillin(), PaletteGroups::fillin(), PaletteGroup::fillin(), ImageFile::fillin(), RecorderHeader::fillin(), AnimInterface::fillin(), LightLensNode::fillin(), TextureAttrib::fillin(), TexMatrixAttrib::fillin(), StencilAttrib::fillin(), RenderState::fillin(), PlaneNode::fillin(), Light::fillin(), DepthOffsetAttrib::fillin(), CullBinAttrib::fillin(), AuxBitplaneAttrib::fillin(), TextureStage::fillin(), Material::fillin(), AnimPreloadTable::fillin(), DownloadDb::Db::parse_header(), DownloadDb::Db::parse_record_header(), SparseArray::read_datagram(), and FFTCompressor::read_reals().
PN_int64 DatagramIterator::get_int64 | ( | ) | [inline] |
Extracts a signed 64-bit integer.
Definition at line 176 of file datagramIterator.I.
References Datagram::get_data(), and Datagram::get_length().
PN_int8 DatagramIterator::get_int8 | ( | ) | [inline] |
Extracts a signed 8-bit integer.
Definition at line 98 of file datagramIterator.I.
References Datagram::get_data().
Referenced by FltGeometry::extract_record(), TransparencyAttrib::fillin(), ShadeModelAttrib::fillin(), RescaleNormalAttrib::fillin(), RenderModeAttrib::fillin(), LightRampAttrib::fillin(), Fog::fillin(), DepthWriteAttrib::fillin(), DepthTestAttrib::fillin(), CullFaceAttrib::fillin(), ColorAttrib::fillin(), AlphaTestAttrib::fillin(), ParametricCurve::fillin(), NurbsCurve::fillin(), HermiteCurveCV::fillin(), IffInputFile::get_int8(), IffInputFile::get_uint8(), and FFTCompressor::read_header().
string DatagramIterator::get_remaining_bytes | ( | ) | const [inline] |
Returns the remaining bytes in the datagram as a string, but does not extract them from the iterator.
Definition at line 511 of file datagramIterator.I.
References Datagram::get_data(), and Datagram::get_length().
Referenced by FltRecord::extract_ancillary(), and FltBeadID::extract_ancillary().
int DatagramIterator::get_remaining_size | ( | ) | const [inline] |
Return the bytes left in the datagram.
Definition at line 526 of file datagramIterator.I.
References Datagram::get_length().
Referenced by UserDataAudio::append(), FltRecord::check_remaining_size(), PStatClientControlMessage::decode(), FltVertex::extract_record(), RecorderFrame::play_frame(), and PStatFrameData::read_datagram().
PN_stdfloat DatagramIterator::get_stdfloat | ( | ) | [inline] |
Extracts either a 32-bit or a 64-bit floating-point number, according to Datagram::set_stdfloat_double().
Definition at line 305 of file datagramIterator.I.
References get_float32(), get_float64(), and Datagram::get_stdfloat_double().
Referenced by STTransform::fillin(), TimedCycle::fillin(), UvScrollNode::fillin(), RenderModeAttrib::fillin(), PolylightNode::fillin(), LightRampAttrib::fillin(), Fog::fillin(), BillboardEffect::fillin(), AudioVolumeAttrib::fillin(), AlphaTestAttrib::fillin(), TransformBlend::fillin(), Material::fillin(), Lens::CData::fillin(), CollisionTube::fillin(), CollisionSphere::fillin(), CollisionParabola::fillin(), CollisionFloorMesh::fillin(), CollisionBox::fillin(), AnimPreloadTable::fillin(), AnimChannelScalarTable::fillin(), AnimChannelScalarDynamic::fillin(), AnimChannelMatrixXfmTable::fillin(), AnimBundle::fillin(), LODNode::Switch::read_datagram(), and FFTCompressor::read_reals().
string DatagramIterator::get_string | ( | ) |
Extracts a variable-length string.
Definition at line 25 of file datagramIterator.cxx.
References Datagram::get_data(), and get_uint16().
Referenced by PStatServerControlMessage::decode(), PStatClientControlMessage::decode(), TextureReference::fillin(), TextureImage::fillin(), Palettizer::fillin(), PalettePage::fillin(), PaletteImage::fillin(), PaletteGroup::fillin(), ImageFile::fillin(), EggFile::fillin(), SpeedTreeNode::InstanceList::fillin(), RecorderTable::fillin(), BamCacheRecord::fillin(), PandaNode::fillin(), CullBinAttrib::fillin(), HermiteCurveCV::fillin(), MovieVideo::fillin(), TextureStage::fillin(), Material::fillin(), Lens::CData::fillin(), GeomVertexData::fillin(), PartGroup::fillin(), AnimPreloadTable::fillin(), AnimGroup::fillin(), PandaNode::fillin_recorder(), InternalName::make_from_bam(), InternalName::make_texcoord_from_bam(), Texture::make_this_from_bam(), MayaToEggServer::poll(), PStatCollectorDef::read_datagram(), ButtonEvent::read_datagram(), and BamReader::read_handle().
string DatagramIterator::get_string32 | ( | ) |
Extracts a variable-length string with a 32-bit length field.
Definition at line 47 of file datagramIterator.cxx.
References Datagram::get_data(), and get_uint32().
PN_uint16 DatagramIterator::get_uint16 | ( | ) | [inline] |
Extracts an unsigned 16-bit integer.
Definition at line 197 of file datagramIterator.I.
References Datagram::get_data(), and Datagram::get_length().
Referenced by CConnectionRepository::check_datagram(), PStatServerControlMessage::decode(), PStatClientControlMessage::decode(), RecorderTable::fillin(), TimedCycle::fillin(), BamCacheRecord::fillin(), TextureAttrib::fillin(), TexProjectorEffect::fillin(), TexMatrixAttrib::fillin(), TexGenAttrib::fillin(), ScissorEffect::fillin(), RenderState::fillin(), RenderEffects::fillin(), PortalNode::fillin(), OccluderNode::fillin(), OccluderEffect::fillin(), ModelNode::fillin(), LightAttrib::fillin(), CompassEffect::fillin(), ClipPlaneAttrib::fillin(), AntialiasAttrib::fillin(), TransformTable::fillin(), TransformBlendTable::fillin(), TransformBlend::fillin(), SliderTable::fillin(), Lens::CData::fillin(), GeomVertexFormat::fillin(), GeomVertexColumn::fillin(), GeomVertexArrayFormat::fillin(), GeomVertexAnimationSpec::fillin(), ButtonEventList::fillin(), DataNodeTransmit::fillin(), CollisionPolygon::fillin(), CollisionNode::fillin(), CollisionFloorMesh::fillin(), CollisionBox::fillin(), CharacterJoint::fillin(), Character::fillin(), PartGroup::fillin(), PartBundleNode::fillin(), AnimPreloadTable::fillin(), AnimGroup::fillin(), AnimChannelScalarTable::fillin(), AnimChannelMatrixXfmTable::fillin(), AnimChannelBase::fillin(), AnimBundle::fillin(), DatagramUDPHeader::get_datagram_checksum(), DatagramTCPHeader::get_datagram_size(), get_string(), get_wstring(), BamReader::init(), PStatFrameData::read_datagram(), ButtonEvent::read_datagram(), and BamReader::read_handle().
PN_uint32 DatagramIterator::get_uint32 | ( | ) | [inline] |
Extracts an unsigned 32-bit integer.
Definition at line 218 of file datagramIterator.I.
References Datagram::get_data(), and Datagram::get_length().
Referenced by Texture::do_fillin_body(), Texture::do_fillin_rawdata(), TextureImage::fillin(), PalettePage::fillin(), PaletteImage::fillin(), PaletteGroup::fillin(), EggFile::fillin(), SpeedTreeNode::InstanceList::fillin(), SpeedTreeNode::fillin(), RecorderHeader::fillin(), RecorderFrame::fillin(), BamCacheRecord::fillin(), BamCacheIndex::fillin(), TransformState::fillin(), Camera::fillin(), PiecewiseCurve::fillin(), NurbsCurve::fillin(), HermiteCurve::fillin(), CollisionNode::fillin(), CollisionFloorMesh::fillin(), DatagramTCPHeader::get_datagram_size(), get_string32(), get_wstring(), DownloadDb::Db::parse_header(), SparseArray::read_datagram(), BitArray::read_datagram(), and GeomVertexArrayData::read_raw_data().
PN_uint64 DatagramIterator::get_uint64 | ( | ) | [inline] |
Extracts an unsigned 64-bit integer.
Definition at line 239 of file datagramIterator.I.
References Datagram::get_data(), and Datagram::get_length().
Referenced by CConnectionRepository::check_datagram(), and BamCacheRecord::fillin().
PN_uint8 DatagramIterator::get_uint8 | ( | ) | [inline] |
Extracts an unsigned 8-bit integer.
Definition at line 116 of file datagramIterator.I.
References Datagram::get_data().
Referenced by CConnectionRepository::check_datagram(), PStatServerControlMessage::decode(), PStatClientControlMessage::decode(), NodePath::decode_from_bam_stream(), Texture::do_fillin_body(), Texture::do_fillin_rawdata(), FltGeometry::extract_record(), TextureImage::fillin(), Palettizer::fillin(), ImageFile::fillin(), TexGenAttrib::fillin(), PlaneNode::fillin(), ModelNode::fillin(), ColorWriteAttrib::fillin(), ColorBlendAttrib::fillin(), TextureStage::fillin(), Lens::CData::fillin(), GeomVertexColumn::fillin(), GeomVertexArrayFormat::fillin(), GeomVertexAnimationSpec::fillin(), CollisionSolid::fillin(), AnimChannelScalarTable::fillin(), get_bool(), BamReader::init(), Texture::make_this_from_bam(), MayaToEggServer::poll(), BitArray::read_datagram(), ButtonEvent::read_datagram(), and BamReader::read_handle().
wstring DatagramIterator::get_wstring | ( | ) |
Extracts a variable-length wstring (with a 32-bit length field).
Definition at line 115 of file datagramIterator.cxx.
References Datagram::get_length(), get_uint16(), and get_uint32().
string DatagramIterator::get_z_string | ( | ) |
Extracts a variable-length string, as a NULL-terminated string.
Definition at line 69 of file datagramIterator.cxx.
References Datagram::get_data(), and Datagram::get_length().
void DatagramIterator::output | ( | ostream & | out | ) | const |
Write a string representation of this instance to <out>.
Definition at line 159 of file datagramIterator.cxx.
void DatagramIterator::skip_bytes | ( | size_t | size | ) | [inline] |
Skips over the indicated number of bytes in the datagram.
Definition at line 490 of file datagramIterator.I.
References Datagram::dump_hex(), and Datagram::get_length().
Referenced by FltMaterial::extract_14_record(), FltVertex::extract_record(), FltTransformTranslate::extract_record(), FltTransformScale::extract_record(), FltTransformRotateScale::extract_record(), FltTransformRotateAboutPoint::extract_record(), FltTransformRotateAboutEdge::extract_record(), FltTransformPut::extract_record(), FltMesh::extract_record(), FltLOD::extract_record(), FltInstanceRef::extract_record(), FltInstanceDefinition::extract_record(), FltGeometry::extract_record(), FltCurve::extract_record(), and GeomVertexArrayData::read_raw_data().
void DatagramIterator::write | ( | ostream & | out, |
unsigned int | indent = 0 |
||
) | const |
Write a string representation of this instance to <out>.
Definition at line 172 of file datagramIterator.cxx.
References get_datagram(), Datagram::get_length(), and Datagram::write().