Panda3D
|
A single molecular field of a Distributed Class, as read from a .dc file. More...
#include "dcMolecularField.h"
Public Member Functions | |
DCMolecularField (const string &name, DCClass *dclass) | |
void | add_atomic (DCAtomicField *atomic) |
Adds the indicated atomic field to the end of the list of atomic fields that make up the molecular field. | |
virtual DCMolecularField * | as_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 DCMolecularField * | as_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. | |
virtual void | generate_hash (HashGenerator &hashgen) const |
Accumulates the properties of this field into the hash. | |
DCAtomicField * | get_atomic (int n) const |
Returns the nth atomic field that makes up this molecular field. | |
virtual DCPackerInterface * | get_nested_field (int n) const |
Returns the DCPackerInterface object that represents the nth nested field. | |
int | get_num_atomics () const |
Returns the number of atomic fields that make up this molecular field. | |
virtual void | output (ostream &out, bool brief) const |
virtual void | write (ostream &out, bool brief, int indent_level) const |
Generates a parseable description of the object to the indicated output stream. | |
Protected Member Functions | |
virtual bool | do_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. | |
virtual bool | do_check_match_molecular_field (const DCMolecularField *other) const |
Returns true if this field matches the indicated molecular field, false otherwise. |
A single molecular field of a Distributed Class, as read from a .dc file.
This represents a combination of two or more related atomic fields, that will often be treated as a unit.
Definition at line 31 of file dcMolecularField.h.
void DCMolecularField::add_atomic | ( | DCAtomicField * | atomic | ) |
Adds the indicated atomic field to the end of the list of atomic fields that make up the molecular field.
This is normally called only during parsing of the dc file. The atomic field should be fully defined by this point; you should not modify the atomic field (e.g. by adding more elements) after adding it to a molecular field.
Definition at line 93 of file dcMolecularField.cxx.
References DCKeywordList::copy_keywords(), DCPackerInterface::get_fixed_byte_size(), DCAtomicField::get_nested_field(), DCPackerInterface::get_num_nested_fields(), DCField::has_default_value(), DCPackerInterface::has_fixed_byte_size(), DCPackerInterface::has_fixed_structure(), DCPackerInterface::has_range_limits(), and DCField::is_bogus_field().
DCMolecularField * DCMolecularField::as_molecular_field | ( | ) | [virtual] |
Returns the same field pointer converted to a molecular field pointer, if this is in fact a molecular field; otherwise, returns NULL.
Reimplemented from DCField.
Definition at line 40 of file dcMolecularField.cxx.
const DCMolecularField * DCMolecularField::as_molecular_field | ( | ) | const [virtual] |
Returns the same field pointer converted to a molecular field pointer, if this is in fact a molecular field; otherwise, returns NULL.
Reimplemented from DCField.
Definition at line 52 of file dcMolecularField.cxx.
bool DCMolecularField::do_check_match | ( | const DCPackerInterface * | other | ) | const [protected, virtual] |
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.
Implements DCPackerInterface.
Definition at line 206 of file dcMolecularField.cxx.
References DCPackerInterface::do_check_match_molecular_field().
bool DCMolecularField::do_check_match_molecular_field | ( | const DCMolecularField * | other | ) | const [protected, virtual] |
Returns true if this field matches the indicated molecular field, false otherwise.
Reimplemented from DCPackerInterface.
Definition at line 217 of file dcMolecularField.cxx.
References DCPackerInterface::check_match().
void DCMolecularField::generate_hash | ( | HashGenerator & | hashgen | ) | const [virtual] |
Accumulates the properties of this field into the hash.
Reimplemented from DCField.
Definition at line 173 of file dcMolecularField.cxx.
References HashGenerator::add_int().
DCAtomicField * DCMolecularField::get_atomic | ( | int | n | ) | const |
Returns the nth atomic field that makes up this molecular field.
This may or may not be a field of this particular class; it might be defined in a parent class.
Definition at line 76 of file dcMolecularField.cxx.
DCPackerInterface * DCMolecularField::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 192 of file dcMolecularField.cxx.
int DCMolecularField::get_num_atomics | ( | ) | const |
Returns the number of atomic fields that make up this molecular field.
Definition at line 63 of file dcMolecularField.cxx.
void DCMolecularField::write | ( | ostream & | out, |
bool | brief, | ||
int | indent_level | ||
) | const [virtual] |
Generates a parseable description of the object to the indicated output stream.
Implements DCField.
Definition at line 156 of file dcMolecularField.cxx.