Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

DatagramIterator Class Reference

A class to retrieve the individual data elements previously stored in a Datagram. More...

#include <datagramIterator.h>

List of all members.

Public Member Functions

 DatagramIterator ()
 DatagramIterator (const Datagram &datagram, size_t offset=0)
 DatagramIterator (const DatagramIterator &copy)
void operator= (const DatagramIterator &copy)
 ~DatagramIterator ()
bool get_bool ()
 Extracts a boolean value.

PN_int8 get_int8 ()
 Extracts a signed 8-bit integer.

PN_uint8 get_uint8 ()
 Extracts an unsigned 8-bit integer.

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

float 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_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.

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

string get_string ()
 Extracts a variable-length string.

string get_z_string ()
 Extracts a variable-length string, as a NULL-terminated string.

string get_fixed_string (size_t size)
 Extracts a fixed-length string.

void skip_bytes (size_t size)
 Skips over the indicated number of bytes in the datagram.

string extract_bytes (size_t size)
 Extracts the indicated number of bytes in the datagram and returns them as a string.

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.

const Datagramget_datagram () const
 Return the datagram of this iterator.

size_t get_current_index () const
 Returns the current position within the datagram of the next piece of data to extract.


Private Attributes

const Datagram_datagram
size_t _current_index


Detailed Description

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 43 of file datagramIterator.h.


Constructor & Destructor Documentation

DatagramIterator::DatagramIterator  )  [inline]
 

Definition at line 31 of file datagramIterator.I.

References INLINE, and nassertv.

DatagramIterator::DatagramIterator const Datagram datagram,
size_t  offset = 0
[inline]
 

Definition at line 45 of file datagramIterator.I.

References INLINE.

DatagramIterator::DatagramIterator const DatagramIterator &  copy  )  [inline]
 

Definition at line 60 of file datagramIterator.I.

References _current_index, _datagram, and INLINE.

DatagramIterator::~DatagramIterator  )  [inline]
 

Definition at line 87 of file datagramIterator.I.


Member Function Documentation

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 115 of file datagramIterator.cxx.

Referenced by DownloadDb::Db::parse_header().

float DatagramIterator::get_be_float32  )  [inline]
 

Extracts a 32-bit big-endian single-precision floating-point number.

Since this kind of float is not necessarily portable across different architectures, special care is required.

Definition at line 465 of file datagramIterator.I.

References _datagram, and INLINE.

PN_float64 DatagramIterator::get_be_float64  )  [inline]
 

Extracts a 64-bit big-endian floating-point number.

Definition at line 490 of file datagramIterator.I.

PN_int16 DatagramIterator::get_be_int16  )  [inline]
 

Extracts a signed 16-bit big-endian integer.

Definition at line 333 of file datagramIterator.I.

References _current_index, _datagram, Datagram::get_data(), INLINE, nassertr, NULL, PN_uint16, and ReversedNumericData::store_value().

PN_int32 DatagramIterator::get_be_int32  )  [inline]
 

Extracts a signed 32-bit big-endian integer.

Definition at line 354 of file datagramIterator.I.

References _current_index, _datagram, and PN_uint32.

PN_int64 DatagramIterator::get_be_int64  )  [inline]
 

Extracts a signed 64-bit big-endian integer.

Definition at line 375 of file datagramIterator.I.

References _current_index, _datagram, and PN_uint64.

PN_uint16 DatagramIterator::get_be_uint16  )  [inline]
 

Extracts an unsigned 16-bit big-endian integer.

Definition at line 396 of file datagramIterator.I.

References _current_index, and _datagram.

PN_uint32 DatagramIterator::get_be_uint32  )  [inline]
 

Extracts an unsigned 32-bit big-endian integer.

Definition at line 417 of file datagramIterator.I.

References _current_index, _datagram, and PN_float64.

PN_uint64 DatagramIterator::get_be_uint64  )  [inline]
 

Extracts an unsigned 64-bit big-endian integer.

Definition at line 438 of file datagramIterator.I.

References _current_index, _datagram, Datagram::get_data(), Datagram::get_length(), INLINE, nassertr, and NULL.

bool DatagramIterator::get_bool  )  [inline]
 

Extracts a boolean value.

Definition at line 102 of file datagramIterator.I.

References _current_index.

Referenced by Camera::register_with_read_factory(), Texture::string_wrap_mode(), and BillboardEffect::write_datagram().

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 576 of file datagramIterator.I.

const Datagram & DatagramIterator::get_datagram  )  const [inline]
 

Return the datagram of this iterator.

Definition at line 561 of file datagramIterator.I.

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 91 of file datagramIterator.cxx.

References _current_index, _datagram, Datagram::get_data(), nassertr, and NULL.

float DatagramIterator::get_float32  )  [inline]
 

Extracts a 32-bit single-precision floating-point number.

Since this kind of float is not necessarily portable across different architectures, special care is required.

Definition at line 287 of file datagramIterator.I.

References _current_index.

Referenced by GeomLine::make_GeomLine(), GeomLinestrip::make_GeomLinestrip(), GeomPoint::make_GeomPoint(), LODSwitch::operator!=(), ACScalarSwitchType::output_value(), AlphaTestAttrib::register_with_read_factory(), Material::write(), TimedCycle::write_datagram(), PStatCollectorDef::write_datagram(), Spotlight::CData::write_datagram(), Fog::write_datagram(), BillboardEffect::write_datagram(), and AnimBundle::write_datagram().

PN_float64 DatagramIterator::get_float64  )  [inline]
 

Extracts a 64-bit floating-point number.

Definition at line 312 of file datagramIterator.I.

References _current_index, _datagram, Datagram::get_data(), INLINE, nassertr, NULL, PN_int64, and ReversedNumericData::store_value().

Referenced by PiecewiseCurve::find_curve().

PN_int16 DatagramIterator::get_int16  )  [inline]
 

Extracts a signed 16-bit integer.

Definition at line 155 of file datagramIterator.I.

References _current_index.

Referenced by Texture::string_wrap_mode(), and PStatCollectorDef::write_datagram().

PN_int32 DatagramIterator::get_int32  )  [inline]
 

Extracts a signed 32-bit integer.

Definition at line 176 of file datagramIterator.I.

Referenced by DownloadDb::insert_new_version(), DownloadDb::Db::parse_header(), CullBinAttrib::register_with_read_factory(), and Material::write().

PN_int64 DatagramIterator::get_int64  )  [inline]
 

Extracts a signed 64-bit integer.

Definition at line 197 of file datagramIterator.I.

References _current_index, _datagram, Datagram::get_data(), INLINE, nassertr, NULL, PN_uint32, and NativeNumericData::store_value().

PN_int8 DatagramIterator::get_int8  )  [inline]
 

Extracts a signed 8-bit integer.

Definition at line 115 of file datagramIterator.I.

References _current_index, _datagram, and PN_uint8.

Referenced by ColorAttrib::make_default_impl(), TransparencyAttrib::register_with_read_factory(), TextureApplyAttrib::register_with_read_factory(), DepthWriteAttrib::register_with_read_factory(), DepthTestAttrib::register_with_read_factory(), ColorWriteAttrib::register_with_read_factory(), ColorBlendAttrib::register_with_read_factory(), AlphaTestAttrib::register_with_read_factory(), ClassicNurbsCurve::write(), and Fog::write_datagram().

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 530 of file datagramIterator.I.

int DatagramIterator::get_remaining_size  )  const [inline]
 

Return the bytes left in the datagram.

Definition at line 548 of file datagramIterator.I.

string DatagramIterator::get_string  ) 
 

Extracts a variable-length string.

Definition at line 35 of file datagramIterator.cxx.

Referenced by CullBinAttrib::register_with_read_factory(), PandaNode::reparent(), and PStatCollectorDef::write_datagram().

PN_uint16 DatagramIterator::get_uint16  )  [inline]
 

Extracts an unsigned 16-bit integer.

Definition at line 218 of file datagramIterator.I.

References _current_index, _datagram, Datagram::get_data(), INLINE, nassertr, NULL, PN_uint64, and NativeNumericData::store_value().

Referenced by GeomNode::CData::complete_pointers(), BamReader::read_cdata(), CompassEffect::register_with_read_factory(), TimedCycle::write_datagram(), ComputedVerticesMorphValue4::write_datagram(), ComputedVerticesMorphValue3::write_datagram(), ComputedVerticesMorphValue2::write_datagram(), AnimChannelBase::write_datagram(), AnimBundle::write_datagram(), and FFTCompressor::write_run().

PN_uint32 DatagramIterator::get_uint32  )  [inline]
 

Extracts an unsigned 32-bit integer.

Definition at line 239 of file datagramIterator.I.

References _current_index, _datagram, Datagram::get_data(), INLINE, nassertr, NULL, and NativeNumericData::store_value().

Referenced by DownloadDb::Db::Db(), PiecewiseCurve::find_curve(), Camera::register_with_read_factory(), wrap_hpr(), and ClassicNurbsCurve::write().

PN_uint64 DatagramIterator::get_uint64  )  [inline]
 

Extracts an unsigned 64-bit integer.

Definition at line 260 of file datagramIterator.I.

References _current_index, _datagram, Datagram::get_data(), INLINE, nassertr, NULL, PN_float64, and NativeNumericData::store_value().

PN_uint8 DatagramIterator::get_uint8  )  [inline]
 

Extracts an unsigned 8-bit integer.

Definition at line 135 of file datagramIterator.I.

References _current_index, and _datagram.

Referenced by Texture::string_wrap_mode().

string DatagramIterator::get_z_string  ) 
 

Extracts a variable-length string, as a NULL-terminated string.

Definition at line 61 of file datagramIterator.cxx.

void DatagramIterator::operator= const DatagramIterator &  copy  )  [inline]
 

Definition at line 74 of file datagramIterator.I.

void DatagramIterator::skip_bytes size_t  size  )  [inline]
 

Skips over the indicated number of bytes in the datagram.

Definition at line 513 of file datagramIterator.I.


Member Data Documentation

size_t DatagramIterator::_current_index [private]
 

Definition at line 88 of file datagramIterator.h.

Referenced by DatagramIterator(), get_be_int16(), get_be_int32(), get_be_int64(), get_be_uint16(), get_be_uint32(), get_be_uint64(), get_bool(), get_fixed_string(), get_float32(), get_float64(), get_int16(), get_int64(), get_int8(), get_uint16(), get_uint32(), get_uint64(), and get_uint8().

const Datagram* DatagramIterator::_datagram [private]
 

Definition at line 87 of file datagramIterator.h.

Referenced by DatagramIterator(), get_be_float32(), get_be_int16(), get_be_int32(), get_be_int64(), get_be_uint16(), get_be_uint32(), get_be_uint64(), get_fixed_string(), get_float64(), get_int64(), get_int8(), get_uint16(), get_uint32(), get_uint64(), and get_uint8().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:49:10 2003 for Panda by doxygen1.3