Panda3D

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
DCPackerInterface Class Referenceabstract

This defines the internal interface for packing values into a DCField. More...

`#include "dcPackerInterface.h"`

Inheritance diagram for DCPackerInterface:

## Public Member Functions
| DCPackerInterface (const DCPackerInterface &copy)
| DCPackerInterface (const std::string &name=std::string())
virtual DCClassParameter * | as_class_parameter ()
virtual const DCClassParameter * | as_class_parameter () const
virtual DCField * | as_field ()
virtual const DCField * | as_field () const
virtual DCSwitchParameter * | as_switch_parameter ()
virtual const DCSwitchParameter * | as_switch_parameter () const
virtual int | calc_num_nested_fields (size_t length_bytes) const
| This flavor of get_num_nested_fields is used during unpacking.
bool | check_match (const DCPackerInterface *other) const
| Returns true if the other interface is bitwise the same as this one–that is, a uint32 only matches a uint32, etc.
bool | check_match (const std::string &description, DCFile *dcfile=nullptr) const
| Returns true if this interface is bitwise the same as the interface described with the indicated formatted string, e.g.
virtual bool | do_check_match_array_parameter (const DCArrayParameter *other) const
| Returns true if this field matches the indicated array parameter, false otherwise.
virtual bool | do_check_match_atomic_field (const DCAtomicField *other) const
| Returns true if this field matches the indicated atomic field, false otherwise.
virtual bool | do_check_match_class_parameter (const DCClassParameter *other) const
| Returns true if this field matches the indicated class parameter, false otherwise.
virtual bool | do_check_match_molecular_field (const DCMolecularField *other) const
| Returns true if this field matches the indicated molecular field, false otherwise.
virtual bool | do_check_match_simple_parameter (const DCSimpleParameter *other) const
| Returns true if this field matches the indicated simple parameter, false otherwise.
virtual bool | do_check_match_switch_parameter (const DCSwitchParameter *other) const
| Returns true if this field matches the indicated switch parameter, false otherwise.
int | find_seek_index (const std::string &name) const
| Returns the index number to be passed to a future call to DCPacker::seek() to seek directly to the named field without having to look up the field name in a table later, or -1 if the named field cannot be found.
const DCPackerCatalog * | get_catalog () const
| Returns the DCPackerCatalog associated with this field, listing all of the nested fields by name.
size_t | get_fixed_byte_size () const
| If has_fixed_byte_size() returns true, this returns the number of bytes this field type will use.
const std::string & | get_name () const
| Returns the name of this field, or empty string if the field is unnamed.
virtual DCPackerInterface * | get_nested_field (int n) const
| Returns the DCPackerInterface object that represents the nth nested field.
size_t | get_num_length_bytes () const
| Returns the number of bytes that should be written into the stream on a push() to record the number of bytes in the record up until the next pop().
int | get_num_nested_fields () const
| Returns the number of nested fields required by this field type.
DCPackType | get_pack_type () const
| Returns the type of value expected by this field.
bool | has_fixed_byte_size () const
| Returns true if this field type always packs to the same number of bytes, false if it is variable.
bool | has_fixed_structure () const
| Returns true if this field type always has the same structure regardless of the data in the stream, or false if its structure may vary.
bool | has_nested_fields () const
| Returns true if this field type has any nested fields (and thus expects a push() .
bool | has_range_limits () const
| Returns true if this field, or any sub-field of this field, has a limit imposed in the DC file on its legal values.
virtual void | pack_blob (DCPackData &pack_data, const std::vector< unsigned char > &value, bool &pack_error, bool &range_error) const
| Packs the indicated numeric or string value into the stream.
virtual bool | pack_default_value (DCPackData &pack_data, bool &pack_error) const
| Packs the field's specified default value (or a sensible default if no value is specified) into the stream.
virtual void | pack_double (DCPackData &pack_data, double value, bool &pack_error, bool &range_error) const
| Packs the indicated numeric or string value into the stream.
virtual void | pack_int (DCPackData &pack_data, int value, bool &pack_error, bool &range_error) const
| Packs the indicated numeric or string value into the stream.
virtual void | pack_int64 (DCPackData &pack_data, int64_t value, bool &pack_error, bool &range_error) const
| Packs the indicated numeric or string value into the stream.
virtual void | pack_string (DCPackData &pack_data, const std::string &value, bool &pack_error, bool &range_error) const
| Packs the indicated numeric or string value into the stream.
virtual void | pack_uint (DCPackData &pack_data, unsigned int value, bool &pack_error, bool &range_error) const
| Packs the indicated numeric or string value into the stream.
virtual void | pack_uint64 (DCPackData &pack_data, uint64_t value, bool &pack_error, bool &range_error) const
| Packs the indicated numeric or string value into the stream.
virtual void | set_name (const std::string &name)
| Sets the name of this field.
virtual void | unpack_blob (const char *data, size_t length, size_t &p, std::vector< unsigned char > &value, bool &pack_error, bool &range_error) const
| Unpacks the current numeric or string value from the stream.
virtual void | unpack_double (const char *data, size_t length, size_t &p, double &value, bool &pack_error, bool &range_error) const
| Unpacks the current numeric or string value from the stream.
virtual void | unpack_int (const char *data, size_t length, size_t &p, int &value, bool &pack_error, bool &range_error) const
| Unpacks the current numeric or string value from the stream.
virtual void | unpack_int64 (const char *data, size_t length, size_t &p, int64_t &value, bool &pack_error, bool &range_error) const
| Unpacks the current numeric or string value from the stream.
virtual bool | unpack_skip (const char *data, size_t length, size_t &p, bool &pack_error) const
| Increments p to the end of the current field without actually unpacking any data or performing any range validation.
virtual void | unpack_string (const char *data, size_t length, size_t &p, std::string &value, bool &pack_error, bool &range_error) const
| Unpacks the current numeric or string value from the stream.
virtual void | unpack_uint (const char *data, size_t length, size_t &p, unsigned int &value, bool &pack_error, bool &range_error) const
| Unpacks the current numeric or string value from the stream.
virtual void | unpack_uint64 (const char *data, size_t length, size_t &p, uint64_t &value, bool &pack_error, bool &range_error) const
| Unpacks the current numeric or string value from the stream.
virtual bool | unpack_validate (const char *data, size_t length, size_t &p, bool &pack_error, bool &range_error) const
| Internally unpacks the current numeric or string value and validates it against the type range limits, but does not return the value.
virtual bool | validate_num_nested_fields (int num_nested_fields) const
| After a number of fields have been packed via push() .

## Static Public Member Functions
static void | do_pack_float64 (char *buffer, double value)
static void | do_pack_int16 (char *buffer, int value)
static void | do_pack_int32 (char *buffer, int value)
static void | do_pack_int64 (char *buffer, int64_t value)
static void | do_pack_int8 (char *buffer, int value)
static void | do_pack_uint16 (char *buffer, unsigned int value)
static void | do_pack_uint32 (char *buffer, unsigned int value)
static void | do_pack_uint64 (char *buffer, uint64_t value)
static void | do_pack_uint8 (char *buffer, unsigned int value)
static double | do_unpack_float64 (const char *buffer)
static int | do_unpack_int16 (const char *buffer)
static int | do_unpack_int32 (const char *buffer)
static int64_t | do_unpack_int64 (const char *buffer)
static int | do_unpack_int8 (const char *buffer)
static unsigned int | do_unpack_uint16 (const char *buffer)
static unsigned int | do_unpack_uint32 (const char *buffer)
static uint64_t | do_unpack_uint64 (const char *buffer)
static unsigned int | do_unpack_uint8 (const char *buffer)
static void | validate_int64_limits (int64_t value, int num_bits, bool &range_error)
| Confirms that the signed value fits within num_bits bits.
static void | validate_int_limits (int value, int num_bits, bool &range_error)
| Confirms that the signed value fits within num_bits bits.
static void | validate_uint64_limits (uint64_t value, int num_bits, bool &range_error)
| Confirms that the unsigned value fits within num_bits bits.
static void | validate_uint_limits (unsigned int value, int num_bits, bool &range_error)
| Confirms that the unsigned value fits within num_bits bits.

## Detailed Description

This defines the internal interface for packing values into a DCField.

The various different DC objects inherit from this.

Normally these methods are called only by the DCPacker object; the user wouldn't normally call these directly.

Definition at line 67 of file dcPackerInterface.h.

## Constructor & Destructor Documentation

## ◆ DCPackerInterface() [1/2]

DCPackerInterface::DCPackerInterface | ( | const std::string & | name = std::string() | ) |

Definition at line 25 of file dcPackerInterface.cxx.

## ◆ DCPackerInterface() [2/2]

DCPackerInterface::DCPackerInterface | ( | const DCPackerInterface & | copy | ) |

Definition at line 43 of file dcPackerInterface.cxx.

## ◆ ~DCPackerInterface()

DCPackerInterface::~DCPackerInterface | ( |  | ) |
| virtual

Definition at line 61 of file dcPackerInterface.cxx.

## Member Function Documentation

## ◆ as_class_parameter() [1/2]

DCClassParameter * DCPackerInterface::as_class_parameter | ( |  | ) |
| virtual

Definition at line 118 of file dcPackerInterface.cxx.

## ◆ as_class_parameter() [2/2]

const DCClassParameter * DCPackerInterface::as_class_parameter | ( |  | ) | const
| virtual

Definition at line 126 of file dcPackerInterface.cxx.

## ◆ as_field() [1/2]

DCField * DCPackerInterface::as_field | ( |  | ) |
| virtual

Definition at line 86 of file dcPackerInterface.cxx.

## ◆ as_field() [2/2]

const DCField * DCPackerInterface::as_field | ( |  | ) | const
| virtual

Definition at line 94 of file dcPackerInterface.cxx.

## ◆ as_switch_parameter() [1/2]

DCSwitchParameter * DCPackerInterface::as_switch_parameter | ( |  | ) |
| virtual

Definition at line 102 of file dcPackerInterface.cxx.

## ◆ as_switch_parameter() [2/2]

const DCSwitchParameter * DCPackerInterface::as_switch_parameter | ( |  | ) | const
| virtual

Definition at line 110 of file dcPackerInterface.cxx.

## ◆ calc_num_nested_fields()

int DCPackerInterface::calc_num_nested_fields | ( | size_t | length_bytes | ) | const
| virtual

This flavor of get_num_nested_fields is used during unpacking.

It returns the number of nested fields to expect, given a certain length in bytes (as read from the _num_length_bytes stored in the stream on the push). This will only be called if _num_length_bytes is nonzero.

Reimplemented in DCArrayParameter, and DCSimpleParameter.

Definition at line 177 of file dcPackerInterface.cxx.

## ◆ check_match() [1/2]

bool DCPackerInterface::check_match | ( | const DCPackerInterface * | other | ) | const
| inline

Returns true if the other interface is bitwise the same as this one–that is, a uint32 only matches a uint32, etc.

Names of components, and range limits, are not compared.

Definition at line 27 of file dcPackerInterface.I.

Referenced by check_match(), and DCSwitch::SwitchFields::do_check_match_switch_case().

## ◆ check_match() [2/2]

bool DCPackerInterface::check_match | ( | const std::string & | description,
|  | DCFile * | dcfile = nullptr ) const

Returns true if this interface is bitwise the same as the interface described with the indicated formatted string, e.g.

"(uint8, uint8, int16)", or false otherwise.

If DCFile is not NULL, it specifies the DCFile that was previously loaded, from which some predefined structs and typedefs may be referenced in the description string.

Definition at line 140 of file dcPackerInterface.cxx.

References check_match().

## ◆ do_check_match_array_parameter()

bool DCPackerInterface::do_check_match_array_parameter | ( | const DCArrayParameter * | other | ) | const
| virtual

Returns true if this field matches the indicated array parameter, false otherwise.

Definition at line 425 of file dcPackerInterface.cxx.

## ◆ do_check_match_atomic_field()

bool DCPackerInterface::do_check_match_atomic_field | ( | const DCAtomicField * | other | ) | const
| virtual

Returns true if this field matches the indicated atomic field, false otherwise.

Definition at line 434 of file dcPackerInterface.cxx.

## ◆ do_check_match_class_parameter()

bool DCPackerInterface::do_check_match_class_parameter | ( | const DCClassParameter * | other | ) | const
| virtual

Returns true if this field matches the indicated class parameter, false otherwise.

Definition at line 407 of file dcPackerInterface.cxx.

## ◆ do_check_match_molecular_field()

bool DCPackerInterface::do_check_match_molecular_field | ( | const DCMolecularField * | other | ) | const
| virtual

Returns true if this field matches the indicated molecular field, false otherwise.

Definition at line 443 of file dcPackerInterface.cxx.

## ◆ do_check_match_simple_parameter()

bool DCPackerInterface::do_check_match_simple_parameter | ( | const DCSimpleParameter * | other | ) | const
| virtual

Returns true if this field matches the indicated simple parameter, false otherwise.

Definition at line 398 of file dcPackerInterface.cxx.

## ◆ do_check_match_switch_parameter()

bool DCPackerInterface::do_check_match_switch_parameter | ( | const DCSwitchParameter * | other | ) | const
| virtual

Returns true if this field matches the indicated switch parameter, false otherwise.

Definition at line 416 of file dcPackerInterface.cxx.

## ◆ do_pack_float64()

void DCPackerInterface::do_pack_float64 | ( | char * | buffer,
|  | double | value )
| inline static

Definition at line 202 of file dcPackerInterface.I.

## ◆ do_pack_int16()

void DCPackerInterface::do_pack_int16 | ( | char * | buffer,
|  | int | value )
| inline static

Definition at line 124 of file dcPackerInterface.I.

## ◆ do_pack_int32()

void DCPackerInterface::do_pack_int32 | ( | char * | buffer,
|  | int | value )
| inline static

Definition at line 133 of file dcPackerInterface.I.

## ◆ do_pack_int64()

void DCPackerInterface::do_pack_int64 | ( | char * | buffer,
|  | int64_t | value )
| inline static

Definition at line 144 of file dcPackerInterface.I.

## ◆ do_pack_int8()

void DCPackerInterface::do_pack_int8 | ( | char * | buffer,
|  | int | value )
| inline static

Definition at line 116 of file dcPackerInterface.I.

## ◆ do_pack_uint16()

void DCPackerInterface::do_pack_uint16 | ( | char * | buffer,
|  | unsigned int | value )
| inline static

Definition at line 167 of file dcPackerInterface.I.

## ◆ do_pack_uint32()

void DCPackerInterface::do_pack_uint32 | ( | char * | buffer,
|  | unsigned int | value )
| inline static

Definition at line 176 of file dcPackerInterface.I.

## ◆ do_pack_uint64()

void DCPackerInterface::do_pack_uint64 | ( | char * | buffer,
|  | uint64_t | value )
| inline static

Definition at line 187 of file dcPackerInterface.I.

## ◆ do_pack_uint8()

void DCPackerInterface::do_pack_uint8 | ( | char * | buffer,
|  | unsigned int | value )
| inline static

Definition at line 159 of file dcPackerInterface.I.

## ◆ do_unpack_float64()

double DCPackerInterface::do_unpack_float64 | ( | const char * | buffer | ) |
| inline static

Definition at line 305 of file dcPackerInterface.I.

## ◆ do_unpack_int16()

int DCPackerInterface::do_unpack_int16 | ( | const char * | buffer | ) |
| inline static

Definition at line 227 of file dcPackerInterface.I.

## ◆ do_unpack_int32()

int DCPackerInterface::do_unpack_int32 | ( | const char * | buffer | ) |
| inline static

Definition at line 236 of file dcPackerInterface.I.

## ◆ do_unpack_int64()

int64_t DCPackerInterface::do_unpack_int64 | ( | const char * | buffer | ) |
| inline static

Definition at line 247 of file dcPackerInterface.I.

## ◆ do_unpack_int8()

int DCPackerInterface::do_unpack_int8 | ( | const char * | buffer | ) |
| inline static

Definition at line 219 of file dcPackerInterface.I.

## ◆ do_unpack_uint16()

unsigned int DCPackerInterface::do_unpack_uint16 | ( | const char * | buffer | ) |
| inline static

Definition at line 270 of file dcPackerInterface.I.

## ◆ do_unpack_uint32()

unsigned int DCPackerInterface::do_unpack_uint32 | ( | const char * | buffer | ) |
| inline static

Definition at line 279 of file dcPackerInterface.I.

## ◆ do_unpack_uint64()

uint64_t DCPackerInterface::do_unpack_uint64 | ( | const char * | buffer | ) |
| inline static

Definition at line 290 of file dcPackerInterface.I.

## ◆ do_unpack_uint8()

unsigned int DCPackerInterface::do_unpack_uint8 | ( | const char * | buffer | ) |
| inline static

Definition at line 262 of file dcPackerInterface.I.

## ◆ find_seek_index()

int DCPackerInterface::find_seek_index | ( | const std::string & | name | ) | const

Returns the index number to be passed to a future call to DCPacker::seek() to seek directly to the named field without having to look up the field name in a table later, or -1 if the named field cannot be found.

If the named field is nested within a switch or some similar dynamic structure that reveals different fields based on the contents of the data, this mechanism cannot be used to pre-fetch the field index number–you must seek for the field by name.

Definition at line 78 of file dcPackerInterface.cxx.

References DCPackerCatalog::find_entry_by_name(), and get_catalog().

## ◆ get_catalog()

const DCPackerCatalog * DCPackerInterface::get_catalog | ( |  | ) | const

Returns the DCPackerCatalog associated with this field, listing all of the nested fields by name.

Definition at line 386 of file dcPackerInterface.cxx.

Referenced by DCPacker::begin_repack(), and find_seek_index().

## ◆ get_fixed_byte_size()

size_t DCPackerInterface::get_fixed_byte_size | ( |  | ) | const
| inline

If has_fixed_byte_size() returns true, this returns the number of bytes this field type will use.

Definition at line 45 of file dcPackerInterface.I.

Referenced by DCMolecularField::add_atomic(), DCAtomicField::add_element(), and DCSwitch::SwitchFields::add_field().

## ◆ get_name()

const std::string & DCPackerInterface::get_name | ( |  | ) | const
| inline

Returns the name of this field, or empty string if the field is unnamed.

Definition at line 17 of file dcPackerInterface.I.

Referenced by DCClass::add_field(), DCSwitch::SwitchFields::add_field(), DCClass::rebuild_inherited_fields(), and DCPacker::unpack_and_format().

## ◆ get_nested_field()

DCPackerInterface * DCPackerInterface::get_nested_field | ( | int | n | ) | const
| virtual

Returns the DCPackerInterface object that represents the nth nested field.

This may return NULL if there is no such field (but it shouldn't do this if n is in the range 0 <= n < get_num_nested_fields()).

Reimplemented in DCArrayParameter, DCAtomicField, DCClassParameter, DCMolecularField, DCSimpleParameter, DCSwitch::SwitchFields, and DCSwitchParameter.

Definition at line 187 of file dcPackerInterface.cxx.

## ◆ get_num_length_bytes()

size_t DCPackerInterface::get_num_length_bytes | ( |  | ) | const
| inline

Returns the number of bytes that should be written into the stream on a push() to record the number of bytes in the record up until the next pop().

This is only meaningful if _has_nested_fields is true.

Definition at line 78 of file dcPackerInterface.I.

## ◆ get_num_nested_fields()

int DCPackerInterface::get_num_nested_fields | ( |  | ) | const
| inline

Returns the number of nested fields required by this field type.

These may be array elements or structure elements. The return value may be -1 to indicate the number of nested fields is variable.

Definition at line 100 of file dcPackerInterface.I.

Referenced by DCMolecularField::add_atomic().

## ◆ get_pack_type()

DCPackType DCPackerInterface::get_pack_type | ( |  | ) | const
| inline

Returns the type of value expected by this field.

Definition at line 108 of file dcPackerInterface.I.

## ◆ has_fixed_byte_size()

bool DCPackerInterface::has_fixed_byte_size | ( |  | ) | const
| inline

Returns true if this field type always packs to the same number of bytes, false if it is variable.

Definition at line 36 of file dcPackerInterface.I.

Referenced by DCMolecularField::add_atomic(), DCAtomicField::add_element(), and DCSwitch::SwitchFields::add_field().

## ◆ has_fixed_structure()

bool DCPackerInterface::has_fixed_structure | ( |  | ) | const
| inline

Returns true if this field type always has the same structure regardless of the data in the stream, or false if its structure may vary.

This is almost, but not quite, the same thing as has_fixed_byte_size. The difference is that a DCSwitch may have multiple cases all with the same byte size, but they will still (presumably) have different structures, in the sense that the actual list of fields varies according to the live data.

Definition at line 58 of file dcPackerInterface.I.

Referenced by DCMolecularField::add_atomic(), DCAtomicField::add_element(), and DCSwitch::SwitchFields::add_field().

## ◆ has_nested_fields()

bool DCPackerInterface::has_nested_fields | ( |  | ) | const
| inline

Returns true if this field type has any nested fields (and thus expects a push() .

. pop() interface to the DCPacker), or false otherwise. If this returns true, get_num_nested_fields() may be called to determine how many nested fields are expected.

Definition at line 90 of file dcPackerInterface.I.

## ◆ has_range_limits()

bool DCPackerInterface::has_range_limits | ( |  | ) | const
| inline

Returns true if this field, or any sub-field of this field, has a limit imposed in the DC file on its legal values.

If this is false, then unpack_validate() is trivial.

Definition at line 68 of file dcPackerInterface.I.

Referenced by DCMolecularField::add_atomic(), DCAtomicField::add_element(), and DCSwitch::SwitchFields::add_field().

## ◆ pack_blob()

void DCPackerInterface::pack_blob | ( | DCPackData & | pack_data,
|  | const std::vector< unsigned char > & | value,
|  | bool & | pack_error,
|  | bool & | range_error ) const
| virtual

Packs the indicated numeric or string value into the stream.

Reimplemented in DCArrayParameter, and DCSimpleParameter.

Definition at line 254 of file dcPackerInterface.cxx.

## ◆ pack_default_value()

bool DCPackerInterface::pack_default_value | ( | DCPackData & | pack_data,
|  | bool & | pack_error ) const
| virtual

Packs the field's specified default value (or a sensible default if no value is specified) into the stream.

Returns true if the default value is packed, false if the field doesn't know how to pack its default value.

Reimplemented in DCArrayParameter, DCField, DCSimpleParameter, and DCSwitchParameter.

Definition at line 264 of file dcPackerInterface.cxx.

## ◆ pack_double()

void DCPackerInterface::pack_double | ( | DCPackData & | pack_data,
|  | double | value,
|  | bool & | pack_error,
|  | bool & | range_error ) const
| virtual

Packs the indicated numeric or string value into the stream.

Reimplemented in DCSimpleParameter.

Definition at line 206 of file dcPackerInterface.cxx.

## ◆ pack_int()

void DCPackerInterface::pack_int | ( | DCPackData & | pack_data,
|  | int | value,
|  | bool & | pack_error,
|  | bool & | range_error ) const
| virtual

Packs the indicated numeric or string value into the stream.

Reimplemented in DCSimpleParameter.

Definition at line 214 of file dcPackerInterface.cxx.

## ◆ pack_int64()

void DCPackerInterface::pack_int64 | ( | DCPackData & | pack_data,
|  | int64_t | value,
|  | bool & | pack_error,
|  | bool & | range_error ) const
| virtual

Packs the indicated numeric or string value into the stream.

Reimplemented in DCSimpleParameter.

Definition at line 230 of file dcPackerInterface.cxx.

## ◆ pack_string()

void DCPackerInterface::pack_string | ( | DCPackData & | pack_data,
|  | const std::string & | value,
|  | bool & | pack_error,
|  | bool & | range_error ) const
| virtual

Packs the indicated numeric or string value into the stream.

Reimplemented in DCArrayParameter, and DCSimpleParameter.

Definition at line 246 of file dcPackerInterface.cxx.

## ◆ pack_uint()

void DCPackerInterface::pack_uint | ( | DCPackData & | pack_data,
|  | unsigned int | value,
|  | bool & | pack_error,
|  | bool & | range_error ) const
| virtual

Packs the indicated numeric or string value into the stream.

Reimplemented in DCSimpleParameter.

Definition at line 222 of file dcPackerInterface.cxx.

## ◆ pack_uint64()

void DCPackerInterface::pack_uint64 | ( | DCPackData & | pack_data,
|  | uint64_t | value,
|  | bool & | pack_error,
|  | bool & | range_error ) const
| virtual

Packs the indicated numeric or string value into the stream.

Reimplemented in DCSimpleParameter.

Definition at line 238 of file dcPackerInterface.cxx.

## ◆ set_name()

void DCPackerInterface::set_name | ( | const std::string & | name | ) |
| virtual

Sets the name of this field.

Reimplemented in DCField.

Definition at line 166 of file dcPackerInterface.cxx.

Referenced by DCField::set_name().

## ◆ unpack_blob()

void DCPackerInterface::unpack_blob | ( | const char * | data,
|  | size_t | length,
|  | size_t & | p,
|  | std::vector< unsigned char > & | value,
|  | bool & | pack_error,
|  | bool & | range_error ) const
| virtual

Unpacks the current numeric or string value from the stream.

Reimplemented in DCArrayParameter, and DCSimpleParameter.

Definition at line 320 of file dcPackerInterface.cxx.

## ◆ unpack_double()

void DCPackerInterface::unpack_double | ( | const char * | data,
|  | size_t | length,
|  | size_t & | p,
|  | double & | value,
|  | bool & | pack_error,
|  | bool & | range_error ) const
| virtual

Unpacks the current numeric or string value from the stream.

Reimplemented in DCSimpleParameter.

Definition at line 272 of file dcPackerInterface.cxx.

## ◆ unpack_int()

void DCPackerInterface::unpack_int | ( | const char * | data,
|  | size_t | length,
|  | size_t & | p,
|  | int & | value,
|  | bool & | pack_error,
|  | bool & | range_error ) const
| virtual

Unpacks the current numeric or string value from the stream.

Reimplemented in DCSimpleParameter.

Definition at line 280 of file dcPackerInterface.cxx.

## ◆ unpack_int64()

void DCPackerInterface::unpack_int64 | ( | const char * | data,
|  | size_t | length,
|  | size_t & | p,
|  | int64_t & | value,
|  | bool & | pack_error,
|  | bool & | range_error ) const
| virtual

Unpacks the current numeric or string value from the stream.

Reimplemented in DCSimpleParameter.

Definition at line 296 of file dcPackerInterface.cxx.

## ◆ unpack_skip()

bool DCPackerInterface::unpack_skip | ( | const char * | data,
|  | size_t | length,
|  | size_t & | p,
|  | bool & | pack_error ) const
| virtual

Increments p to the end of the current field without actually unpacking any data or performing any range validation.

Returns true on success, false on failure (e.g. we don't know how to skip this field).

Reimplemented in DCSimpleParameter.

Definition at line 345 of file dcPackerInterface.cxx.

Referenced by unpack_validate().

## ◆ unpack_string()

void DCPackerInterface::unpack_string | ( | const char * | data,
|  | size_t | length,
|  | size_t & | p,
|  | std::string & | value,
|  | bool & | pack_error,
|  | bool & | range_error ) const
| virtual

Unpacks the current numeric or string value from the stream.

Reimplemented in DCArrayParameter, and DCSimpleParameter.

Definition at line 312 of file dcPackerInterface.cxx.

## ◆ unpack_uint()

void DCPackerInterface::unpack_uint | ( | const char * | data,
|  | size_t | length,
|  | size_t & | p,
|  | unsigned int & | value,
|  | bool & | pack_error,
|  | bool & | range_error ) const
| virtual

Unpacks the current numeric or string value from the stream.

Reimplemented in DCSimpleParameter.

Definition at line 288 of file dcPackerInterface.cxx.

## ◆ unpack_uint64()

void DCPackerInterface::unpack_uint64 | ( | const char * | data,
|  | size_t | length,
|  | size_t & | p,
|  | uint64_t & | value,
|  | bool & | pack_error,
|  | bool & | range_error ) const
| virtual

Unpacks the current numeric or string value from the stream.

Reimplemented in DCSimpleParameter.

Definition at line 304 of file dcPackerInterface.cxx.

## ◆ unpack_validate()

bool DCPackerInterface::unpack_validate | ( | const char * | data,
|  | size_t | length,
|  | size_t & | p,
|  | bool & | pack_error,
|  | bool & | range_error ) const
| virtual

Internally unpacks the current numeric or string value and validates it against the type range limits, but does not return the value.

Returns true on success, false on failure (e.g. we don't know how to validate this field).

Reimplemented in DCSimpleParameter.

Definition at line 331 of file dcPackerInterface.cxx.

References unpack_skip().

## ◆ validate_int64_limits()

void DCPackerInterface::validate_int64_limits | ( | int64_t | value,
|  | int | num_bits,
|  | bool & | range_error )
| inline static

Confirms that the signed value fits within num_bits bits.

Sets range_error true if it does not.

Definition at line 344 of file dcPackerInterface.I.

Referenced by DCSimpleParameter::pack_int64(), DCSimpleParameter::pack_uint64(), and DCSimpleParameter::set_range().

## ◆ validate_int_limits()

void DCPackerInterface::validate_int_limits | ( | int | value,
|  | int | num_bits,
|  | bool & | range_error )
| inline static

Confirms that the signed value fits within num_bits bits.

Sets range_error true if it does not.

Definition at line 324 of file dcPackerInterface.I.

Referenced by DCSimpleParameter::pack_double(), DCSimpleParameter::pack_int(), and DCSimpleParameter::pack_uint().

## ◆ validate_num_nested_fields()

bool DCPackerInterface::validate_num_nested_fields | ( | int | num_nested_fields | ) | const
| virtual

After a number of fields have been packed via push() .

. pack_*() .. pop(), this is called to confirm that the number of nested fields that were added is valid for this type. This is primarily useful for array types with dynamic ranges that can't validate the number of fields any other way.

Reimplemented in DCArrayParameter.

Definition at line 198 of file dcPackerInterface.cxx.

## ◆ validate_uint64_limits()

void DCPackerInterface::validate_uint64_limits | ( | uint64_t | value,
|  | int | num_bits,
|  | bool & | range_error )
| inline static

Confirms that the unsigned value fits within num_bits bits.

Sets range_error true if it does not.

Definition at line 375 of file dcPackerInterface.I.

Referenced by DCSimpleParameter::pack_int64(), DCSimpleParameter::pack_uint64(), DCSimpleParameter::set_modulus(), and DCSimpleParameter::set_range().

## ◆ validate_uint_limits()

void DCPackerInterface::validate_uint_limits | ( | unsigned int | value,
|  | int | num_bits,
|  | bool & | range_error )
| inline static

Confirms that the unsigned value fits within num_bits bits.

Sets range_error true if it does not.

Definition at line 358 of file dcPackerInterface.I.

Referenced by DCSimpleParameter::pack_blob(), DCSimpleParameter::pack_double(), DCSimpleParameter::pack_int(), DCSimpleParameter::pack_string(), DCSimpleParameter::pack_uint(), and DCPacker::pop().

The documentation for this class was generated from the following files:

- direct/src/dcparser/dcPackerInterface.h
- direct/src/dcparser/dcPackerInterface.cxx
- direct/src/dcparser/dcPackerInterface.I