Panda3D
Loading...
Searching...
No Matches
Public Member Functions | List of all members
DCSimpleParameter Class Reference

This is the most fundamental kind of parameter type: a single number or string, one of the DCSubatomicType elements. More...

#include "dcSimpleParameter.h"

Inheritance diagram for DCSimpleParameter:
DCParameter DCField DCPackerInterface DCKeywordList

Public Member Functions

 DCSimpleParameter (const DCSimpleParameter &copy)
 
 DCSimpleParameter (DCSubatomicType type, unsigned int divisor=1)
 
virtual DCSimpleParameteras_simple_parameter ()
 
virtual const DCSimpleParameteras_simple_parameter () const
 
virtual int calc_num_nested_fields (size_t length_bytes) const
 This flavor of get_num_nested_fields is used during unpacking.
 
virtual void generate_hash (HashGenerator &hashgen) const
 Accumulates the properties of this type into the hash.
 
int get_divisor () const
 Returns the divisor associated with this type.
 
double get_modulus () const
 Returns the modulus associated with this type, if any.
 
virtual DCPackerInterfaceget_nested_field (int n) const
 Returns the DCPackerInterface object that represents the nth nested field.
 
DCSubatomicType get_type () const
 Returns the particular subatomic type represented by this instance.
 
bool has_modulus () const
 Returns true if there is a modulus associated, false otherwise.,.
 
bool is_numeric_type () const
 Returns true if the type is a numeric type (and therefore can accept a divisor and/or a modulus), or false if it is some string-based type.
 
virtual bool is_valid () const
 Returns false if the type is an invalid type (e.g.
 
virtual DCParametermake_copy () const
 
virtual void output_instance (std::ostream &out, bool brief, const std::string &prename, const std::string &name, const std::string &postname) const
 Formats the parameter in the C++-like dc syntax as a typename and identifier.
 
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 simpleParameter'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.
 
bool set_divisor (unsigned int divisor)
 Assigns the indicated divisor to the simple type.
 
bool set_modulus (double modulus)
 Assigns the indicated modulus to the simple type.
 
bool set_range (const DCDoubleRange &range)
 Sets the parameter with the indicated range.
 
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.
 
- Public Member Functions inherited from DCParameter
virtual DCParameterappend_array_specification (const DCUnsignedIntRange &size)
 Returns the type represented by this_type[size].
 
virtual DCArrayParameteras_array_parameter ()
 
virtual const DCArrayParameteras_array_parameter () const
 
virtual DCClassParameteras_class_parameter ()
 
virtual const DCClassParameteras_class_parameter () const
 
virtual DCParameteras_parameter ()
 
virtual const DCParameteras_parameter () const
 
virtual DCSwitchParameteras_switch_parameter ()
 
virtual const DCSwitchParameteras_switch_parameter () const
 
const DCTypedefget_typedef () const
 If this type has been referenced from a typedef, returns the DCTypedef instance, or NULL if the type was declared on-the-fly.
 
virtual void output (std::ostream &out, bool brief) const
 
void output_typedef_name (std::ostream &out, bool brief, const std::string &prename, const std::string &name, const std::string &postname) const
 Formats the instance like output_instance, but uses the typedef name instead.
 
void set_typedef (const DCTypedef *dtypedef)
 Records the DCTypedef object that generated this parameter.
 
virtual void write (std::ostream &out, bool brief, int indent_level) const
 
virtual void write_instance (std::ostream &out, bool brief, int indent_level, const std::string &prename, const std::string &name, const std::string &postname) const
 Formats the parameter in the C++-like dc syntax as a typename and identifier.
 
void write_typedef_name (std::ostream &out, bool brief, int indent_level, const std::string &prename, const std::string &name, const std::string &postname) const
 Formats the instance like write_instance, but uses the typedef name instead.
 
- Public Member Functions inherited from DCField
 DCField (const std::string &name, DCClass *dclass)
 
virtual DCAtomicFieldas_atomic_field ()
 Returns the same field pointer converted to an atomic field pointer, if this is in fact an atomic field; otherwise, returns NULL.
 
virtual const DCAtomicFieldas_atomic_field () const
 Returns the same field pointer converted to an atomic field pointer, if this is in fact an atomic field; otherwise, returns NULL.
 
virtual DCFieldas_field ()
 
virtual const DCFieldas_field () const
 
virtual DCMolecularFieldas_molecular_field ()
 Returns the same field pointer converted to a molecular field pointer, if this is in fact a molecular field; otherwise, returns NULL.
 
virtual const DCMolecularFieldas_molecular_field () const
 Returns the same field pointer converted to a molecular field pointer, if this is in fact a molecular field; otherwise, returns NULL.
 
std::string format_data (const std::vector< unsigned char > &packed_data, bool show_field_names=true)
 Given a blob that represents the packed data for this field, returns a string formatting it for human consumption.
 
DCClassget_class () const
 Returns the DCClass pointer for the class that contains this field.
 
const std::vector< unsigned char > & get_default_value () const
 Returns the default value for this field.
 
int get_number () const
 Returns a unique index number associated with this field.
 
bool has_default_value () const
 Returns true if a default value has been explicitly established for this field, false otherwise.
 
bool is_airecv () const
 Returns true if the "airecv" flag is set for this field, false otherwise.
 
bool is_bogus_field () const
 Returns true if the field has been flagged as a bogus field.
 
bool is_broadcast () const
 Returns true if the "broadcast" flag is set for this field, false otherwise.
 
bool is_clrecv () const
 Returns true if the "clrecv" flag is set for this field, false otherwise.
 
bool is_clsend () const
 Returns true if the "clsend" flag is set for this field, false otherwise.
 
bool is_db () const
 Returns true if the "db" flag is set for this field, false otherwise.
 
bool is_ownrecv () const
 Returns true if the "ownrecv" flag is set for this field, false otherwise.
 
bool is_ownsend () const
 Returns true if the "ownsend" flag is set for this field, false otherwise.
 
bool is_ram () const
 Returns true if the "ram" flag is set for this field, false otherwise.
 
bool is_required () const
 Returns true if the "required" flag is set for this field, false otherwise.
 
void output (std::ostream &out) const
 Write a string representation of this instance to <out>.
 
std::vector< unsigned char > parse_string (const std::string &formatted_string)
 Given a human-formatted string (for instance, as returned by format_data(), above) that represents the value of this field, parse the string and return the corresponding packed data.
 
void set_class (DCClass *dclass)
 Assigns the class pointer to this field.
 
void set_default_value (std::vector< unsigned char > default_value)
 Establishes a default value for this field.
 
virtual void set_name (const std::string &name)
 Sets the name of this field.
 
void set_number (int number)
 Assigns the unique number to this field.
 
bool validate_ranges (const std::vector< unsigned char > &packed_data) const
 Verifies that all of the packed values in the field data are within the specified ranges and that there are no extra bytes on the end of the record.
 
void write (std::ostream &out, int indent_level) const
 Write a string representation of this instance to <out>.
 
- Public Member Functions inherited from DCPackerInterface
 DCPackerInterface (const DCPackerInterface &copy)
 
 DCPackerInterface (const std::string &name=std::string())
 
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_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_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 DCPackerCatalogget_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.
 
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 bool validate_num_nested_fields (int num_nested_fields) const
 After a number of fields have been packed via push() .
 
- Public Member Functions inherited from DCKeywordList
 DCKeywordList (const DCKeywordList &copy)
 
bool add_keyword (const DCKeyword *keyword)
 Adds the indicated keyword to the list.
 
void clear_keywords ()
 Removes all keywords from the field.
 
bool compare_keywords (const DCKeywordList &other) const
 Returns true if this list has the same keywords as the other list, false if some keywords differ.
 
void copy_keywords (const DCKeywordList &other)
 Replaces this keyword list with those from the other list.
 
void generate_hash (HashGenerator &hashgen) const
 Accumulates the properties of these keywords into the hash.
 
const DCKeywordget_keyword (int n) const
 Returns the nth keyword in the list.
 
const DCKeywordget_keyword_by_name (const std::string &name) const
 Returns the keyword in the list with the indicated name, or NULL if there is no keyword in the list with that name.
 
int get_num_keywords () const
 Returns the number of keywords in the list.
 
bool has_keyword (const DCKeyword *keyword) const
 Returns true if this list includes the indicated keyword, false otherwise.
 
bool has_keyword (const std::string &name) const
 Returns true if this list includes the indicated keyword, false otherwise.
 
void operator= (const DCKeywordList &copy)
 
void output_keywords (std::ostream &out) const
 

Additional Inherited Members

- Static Public Member Functions inherited from DCPackerInterface
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 is the most fundamental kind of parameter type: a single number or string, one of the DCSubatomicType elements.

It may also optionally have a divisor, which is meaningful only for the numeric type elements (and represents a fixed-point numeric convention).

Definition at line 28 of file dcSimpleParameter.h.

Constructor & Destructor Documentation

◆ DCSimpleParameter() [1/2]

DCSimpleParameter::DCSimpleParameter ( DCSubatomicType type,
unsigned int divisor = 1 )

Definition at line 31 of file dcSimpleParameter.cxx.

◆ DCSimpleParameter() [2/2]

DCSimpleParameter::DCSimpleParameter ( const DCSimpleParameter & copy)

Definition at line 198 of file dcSimpleParameter.cxx.

Member Function Documentation

◆ as_simple_parameter() [1/2]

DCSimpleParameter * DCSimpleParameter::as_simple_parameter ( )
virtual

Reimplemented from DCParameter.

Definition at line 222 of file dcSimpleParameter.cxx.

◆ as_simple_parameter() [2/2]

const DCSimpleParameter * DCSimpleParameter::as_simple_parameter ( ) const
virtual

Reimplemented from DCParameter.

Definition at line 230 of file dcSimpleParameter.cxx.

◆ calc_num_nested_fields()

int DCSimpleParameter::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 from DCPackerInterface.

Definition at line 574 of file dcSimpleParameter.cxx.

◆ generate_hash()

void DCSimpleParameter::generate_hash ( HashGenerator & hashgen) const
virtual

Accumulates the properties of this type into the hash.

Reimplemented from DCParameter.

Definition at line 2384 of file dcSimpleParameter.cxx.

References HashGenerator::add_int(), and DCParameter::generate_hash().

◆ get_divisor()

int DCSimpleParameter::get_divisor ( ) const

Returns the divisor associated with this type.

This is 1 by default, but if this is other than one it represents the scale to apply when packing and unpacking numeric values (to store fixed-point values in an integer field). It is only meaningful for numeric-type fields.

Definition at line 286 of file dcSimpleParameter.cxx.

Referenced by DCAtomicField::get_element_divisor().

◆ get_modulus()

double DCSimpleParameter::get_modulus ( ) const

Returns the modulus associated with this type, if any.

It is an error to call this if has_modulus() returned false.

If present, this is the modulus that is used to constrain the numeric value of the field before it is packed (and range-checked).

Definition at line 275 of file dcSimpleParameter.cxx.

◆ get_nested_field()

DCPackerInterface * DCSimpleParameter::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 from DCPackerInterface.

Definition at line 587 of file dcSimpleParameter.cxx.

◆ get_type()

DCSubatomicType DCSimpleParameter::get_type ( ) const

Returns the particular subatomic type represented by this instance.

Definition at line 255 of file dcSimpleParameter.cxx.

Referenced by DCAtomicField::get_element_type(), DCArrayParameter::pack_blob(), DCArrayParameter::pack_string(), DCArrayParameter::unpack_blob(), and DCArrayParameter::unpack_string().

◆ has_modulus()

bool DCSimpleParameter::has_modulus ( ) const

Returns true if there is a modulus associated, false otherwise.,.

Definition at line 263 of file dcSimpleParameter.cxx.

◆ is_numeric_type()

bool DCSimpleParameter::is_numeric_type ( ) const

Returns true if the type is a numeric type (and therefore can accept a divisor and/or a modulus), or false if it is some string-based type.

Definition at line 295 of file dcSimpleParameter.cxx.

◆ is_valid()

bool DCSimpleParameter::is_valid ( ) const
virtual

Returns false if the type is an invalid type (e.g.

declared from an undefined typedef), true if it is valid.

Implements DCParameter.

Definition at line 247 of file dcSimpleParameter.cxx.

◆ make_copy()

DCParameter * DCSimpleParameter::make_copy ( ) const
virtual

Implements DCParameter.

Definition at line 238 of file dcSimpleParameter.cxx.

◆ output_instance()

void DCSimpleParameter::output_instance ( std::ostream & out,
bool brief,
const std::string & prename,
const std::string & name,
const std::string & postname ) const
virtual

Formats the parameter in the C++-like dc syntax as a typename and identifier.

Implements DCParameter.

Definition at line 2294 of file dcSimpleParameter.cxx.

References DCParameter::get_typedef(), DCNumericRange< NUM >::is_empty(), DCNumericRange< NUM >::output_char(), and DCParameter::output_typedef_name().

◆ pack_blob()

void DCSimpleParameter::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 from DCPackerInterface.

Definition at line 1075 of file dcSimpleParameter.cxx.

References DCPackData::append_data(), DCPackData::get_write_pointer(), DCNumericRange< NUM >::validate(), and DCPackerInterface::validate_uint_limits().

◆ pack_default_value()

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

Packs the simpleParameter'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 simpleParameter doesn't know how to pack its default value.

Reimplemented from DCField.

Definition at line 1124 of file dcSimpleParameter.cxx.

References DCPackData::append_data(), DCPacker::begin_pack(), DCPacker::end_pack(), DCPacker::get_data(), DCPacker::get_length(), DCNumericRange< NUM >::get_min(), DCField::has_default_value(), DCNumericRange< NUM >::is_empty(), DCNumericRange< NUM >::is_in_range(), DCPacker::pack_default_value(), DCField::pack_default_value(), pack_double(), pack_int(), pack_int64(), pack_uint(), pack_uint64(), DCPacker::pop(), and DCPacker::push().

◆ pack_double()

void DCSimpleParameter::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 from DCPackerInterface.

Definition at line 595 of file dcSimpleParameter.cxx.

References DCPackData::get_write_pointer(), DCNumericRange< NUM >::validate(), DCPackerInterface::validate_int_limits(), and DCPackerInterface::validate_uint_limits().

Referenced by pack_default_value().

◆ pack_int()

void DCSimpleParameter::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 from DCPackerInterface.

Definition at line 693 of file dcSimpleParameter.cxx.

References DCPackData::get_write_pointer(), pack_int64(), DCNumericRange< NUM >::validate(), DCPackerInterface::validate_int_limits(), and DCPackerInterface::validate_uint_limits().

Referenced by pack_default_value().

◆ pack_int64()

void DCSimpleParameter::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 from DCPackerInterface.

Definition at line 863 of file dcSimpleParameter.cxx.

References DCPackData::get_write_pointer(), DCNumericRange< NUM >::validate(), DCPackerInterface::validate_int64_limits(), and DCPackerInterface::validate_uint64_limits().

Referenced by pack_default_value(), and pack_int().

◆ pack_string()

void DCSimpleParameter::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 from DCPackerInterface.

Definition at line 1029 of file dcSimpleParameter.cxx.

References DCPackData::append_data(), DCPackData::get_write_pointer(), DCNumericRange< NUM >::validate(), and DCPackerInterface::validate_uint_limits().

◆ pack_uint()

void DCSimpleParameter::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 from DCPackerInterface.

Definition at line 784 of file dcSimpleParameter.cxx.

References DCPackData::get_write_pointer(), DCNumericRange< NUM >::validate(), DCPackerInterface::validate_int_limits(), and DCPackerInterface::validate_uint_limits().

Referenced by pack_default_value().

◆ pack_uint64()

void DCSimpleParameter::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 from DCPackerInterface.

Definition at line 948 of file dcSimpleParameter.cxx.

References DCPackData::get_write_pointer(), DCNumericRange< NUM >::validate(), DCPackerInterface::validate_int64_limits(), and DCPackerInterface::validate_uint64_limits().

Referenced by pack_default_value().

◆ set_divisor()

bool DCSimpleParameter::set_divisor ( unsigned int divisor)

Assigns the indicated divisor to the simple type.

Returns true if assigned, false if this type cannot accept a divisor or if the divisor is invalid.

Definition at line 375 of file dcSimpleParameter.cxx.

References set_modulus(), and set_range().

◆ set_modulus()

bool DCSimpleParameter::set_modulus ( double modulus)

Assigns the indicated modulus to the simple type.

Any packed value will be constrained to be within [0, modulus).

Returns true if assigned, false if this type cannot accept a modulus or if the modulus is invalid.

Definition at line 307 of file dcSimpleParameter.cxx.

References DCPackerInterface::validate_uint64_limits().

Referenced by set_divisor().

◆ set_range()

bool DCSimpleParameter::set_range ( const DCDoubleRange & range)

Sets the parameter with the indicated range.

A DCDoubleRange is used for specification, since this is the most generic type; but it is converted to the appropriate type internally. The return value is true if successful, or false if the range is inappropriate for the type.

Definition at line 404 of file dcSimpleParameter.cxx.

References DCNumericRange< NUM >::add_range(), DCNumericRange< NUM >::get_max(), DCNumericRange< NUM >::get_min(), DCNumericRange< NUM >::get_num_ranges(), DCNumericRange< NUM >::get_one_value(), DCNumericRange< NUM >::has_one_value(), DCPackerInterface::validate_int64_limits(), and DCPackerInterface::validate_uint64_limits().

Referenced by set_divisor().

◆ unpack_blob()

void DCSimpleParameter::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 from DCPackerInterface.

Definition at line 1989 of file dcSimpleParameter.cxx.

References DCNumericRange< NUM >::validate().

◆ unpack_double()

void DCSimpleParameter::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 from DCPackerInterface.

Definition at line 1215 of file dcSimpleParameter.cxx.

References DCNumericRange< NUM >::validate().

◆ unpack_int()

void DCSimpleParameter::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 from DCPackerInterface.

Definition at line 1351 of file dcSimpleParameter.cxx.

References DCNumericRange< NUM >::validate().

◆ unpack_int64()

void DCSimpleParameter::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 from DCPackerInterface.

Definition at line 1635 of file dcSimpleParameter.cxx.

References DCNumericRange< NUM >::validate().

◆ unpack_skip()

bool DCSimpleParameter::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 from DCPackerInterface.

Definition at line 2224 of file dcSimpleParameter.cxx.

Referenced by unpack_validate().

◆ unpack_string()

void DCSimpleParameter::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 from DCPackerInterface.

Definition at line 1918 of file dcSimpleParameter.cxx.

References DCNumericRange< NUM >::validate().

◆ unpack_uint()

void DCSimpleParameter::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 from DCPackerInterface.

Definition at line 1489 of file dcSimpleParameter.cxx.

References DCNumericRange< NUM >::validate().

◆ unpack_uint64()

void DCSimpleParameter::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 from DCPackerInterface.

Definition at line 1772 of file dcSimpleParameter.cxx.

References DCNumericRange< NUM >::validate().

◆ unpack_validate()

bool DCSimpleParameter::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 from DCPackerInterface.

Definition at line 2065 of file dcSimpleParameter.cxx.

References unpack_skip(), and DCNumericRange< NUM >::validate().


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