28 DCAtomicField(
const string &name, 
DCClass *dclass,
    32   _bogus_field = bogus_field;
    40   Elements::iterator ei;
    41   for (ei = _elements.begin(); ei != _elements.end(); ++ei) {
    70   return _elements.size();
    78   nassertr(n >= 0 && n < (
int)_elements.size(), 
nullptr);
    95   nassertr(n >= 0 && n < (
int)_elements.size(), vector_uchar());
    96   return _elements[n]->get_default_value();
   107   nassertr(n >= 0 && n < (
int)_elements.size(), 
false);
   108   return _elements[n]->has_default_value();
   120   nassertr(n >= 0 && n < (
int)_elements.size(), string());
   121   return _elements[n]->get_name();
   130   nassertr(n >= 0 && n < (
int)_elements.size(), ST_invalid);
   132   nassertr(simple_parameter != 
nullptr, ST_invalid);
   133   return simple_parameter->get_type();
   146   nassertr(n >= 0 && n < (
int)_elements.size(), 1);
   148   nassertr(simple_parameter != 
nullptr, 1);
   149   return simple_parameter->get_divisor();
   156 output(std::ostream &out, 
bool brief)
 const {
   159   if (!_elements.empty()) {
   160     Elements::const_iterator ei = _elements.begin();
   161     output_element(out, brief, *ei);
   163     while (ei != _elements.end()) {
   165       output_element(out, brief, *ei);
   171   output_keywords(out);
   179 write(std::ostream &out, 
bool brief, 
int indent_level)
 const {
   180   indent(out, indent_level);
   183   if (!brief && _number >= 0) {
   184     out << 
"  // field " << _number;
   196   hashgen.
add_int(_elements.size());
   197   Elements::const_iterator ei;
   198   for (ei = _elements.begin(); ei != _elements.end(); ++ei) {
   199     (*ei)->generate_hash(hashgen);
   212   nassertr(n >= 0 && n < (
int)_elements.size(), 
nullptr);
   223   _elements.push_back(element);
   224   _num_nested_fields = (int)_elements.size();
   227   if (_has_fixed_byte_size) {
   231   if (_has_fixed_structure) {
   234   if (!_has_range_limits) {
   237   if (!_has_default_value) {
   240   _default_value_stale = 
true;
   258 do_check_match_atomic_field(
const DCAtomicField *other)
 const {
   259   if (_elements.size() != other->_elements.size()) {
   262   for (
size_t i = 0; i < _elements.size(); i++) {
   263     if (!_elements[i]->
check_match(other->_elements[i])) {
   275 output_element(std::ostream &out, 
bool brief, 
DCParameter *element)
 const {
   276   element->output(out, brief);
 virtual void generate_hash(HashGenerator &hashgen) const
Accumulates the properties of this field into the hash.
DCSubatomicType
This defines the numeric type of each element of a DCAtomicField; that is, the particular values that...
virtual DCAtomicField * as_atomic_field()
Returns the same field pointer converted to an atomic field pointer, if this is in fact an atomic fie...
bool has_fixed_structure() const
Returns true if this field type always has the same structure regardless of the data in the stream,...
void add_int(int num)
Adds another integer to the hash so far.
A single field of a Distributed Class, either atomic or molecular.
DCParameter * get_element(int n) const
Returns the parameter object describing the nth element.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the most fundamental kind of parameter type: a single number or string, one of the DCSubatomi...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void write(std::ostream &out, bool brief, int indent_level) const
Generates a parseable description of the object to the indicated output stream.
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.
Defines a particular DistributedClass as read from an input .dc file.
const vector_uchar & get_default_value() const
Returns the default value for this field.
vector_uchar get_element_default(int n) const
Returns the pre-formatted default value associated with the nth element of the field.
A single atomic field of a Distributed Class, as read from a .dc file.
virtual void generate_hash(HashGenerator &hashgen) const
Accumulates the properties of this field into the hash.
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.
void add_element(DCParameter *element)
Adds a new element (parameter) to the field.
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...
int get_num_elements() const
Returns the number of elements (parameters) of the atomic field.
Represents the type specification for a single parameter within a field specification.
void set_unpack_data(const vector_uchar &data)
Sets up the unpack_data pointer.
DCSubatomicType get_element_type(int n) const
Returns the numeric type of the nth element of the field.
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 ...
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
bool has_default_value() const
Returns true if a default value has been explicitly established for this field, false otherwise.
This class generates an arbitrary hash number from a sequence of ints.
std::string unpack_and_format(bool show_field_names=true)
Unpacks an object and formats its value into a syntax suitable for parsing in the dc file (e....
virtual bool do_check_match_atomic_field(const DCAtomicField *other) const
Returns true if this field matches the indicated atomic field, false otherwise.
void generate_hash(HashGenerator &hashgen) const
Accumulates the properties of these keywords into the hash.
This class can be used for packing a series of numeric and string data into a binary stream,...
int get_element_divisor(int n) const
Returns the divisor associated with the nth element of the field.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This defines the internal interface for packing values into a DCField.
bool has_element_default(int n) const
Returns true if the nth element of the field has a default value specified, false otherwise.
std::string get_element_name(int n) const
Returns the name of the nth element of the field.
void begin_unpack(const DCPackerInterface *root)
Begins an unpacking session.
bool end_unpack()
Finishes the unpacking session.
virtual DCPackerInterface * get_nested_field(int n) const
Returns the DCPackerInterface object that represents the nth nested field.