23 DCClassParameter(
const DCClass *dclass) :
28 int num_fields = _dclass->get_num_inherited_fields();
30 _has_nested_fields =
true;
31 _pack_type = PT_class;
33 if (_dclass->has_constructor()) {
34 DCField *field = _dclass->get_constructor();
35 _nested_fields.push_back(field);
39 for (i = 0 ; i < num_fields; i++) {
40 DCField *field = _dclass->get_inherited_field(i);
42 _nested_fields.push_back(field);
46 _num_nested_fields = _nested_fields.size();
50 _has_fixed_byte_size =
true;
52 _has_fixed_structure =
true;
53 for (i = 0; i < _num_nested_fields; i++) {
69 _nested_fields(copy._nested_fields),
78 as_class_parameter() {
86 as_class_parameter()
const {
122 nassertr(n >= 0 && n < (
int)_nested_fields.size(),
nullptr);
123 return _nested_fields[n];
132 const std::string &name,
const std::string &postname)
const {
155 bool DCClassParameter::
164 bool DCClassParameter::
166 if (_nested_fields.size() != other->_nested_fields.size()) {
169 for (
size_t i = 0; i < _nested_fields.size(); i++) {
170 if (!_nested_fields[i]->
check_match(other->_nested_fields[i])) {
182 bool DCClassParameter::
191 for (
size_t i = 0; i < _nested_fields.size(); i++) {
192 if (!_nested_fields[i]->
check_match(element_type)) {
virtual void generate_hash(HashGenerator &hashgen) const
Accumulates the properties of this type into the hash.
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 bool is_valid() const
Returns false if the type is an invalid type (e.g.
void generate_hash(HashGenerator &hashgen) const
Accumulates the properties of this class into the hash.
int get_array_size() const
Returns the fixed number of elements in this array, or -1 if the array may contain a variable number ...
bool has_fixed_structure() const
Returns true if this field type always has the same structure regardless of the data in the stream,...
This represents a class (or struct) object used as a parameter itself.
A single field of a Distributed Class, either atomic or molecular.
virtual void generate_hash(HashGenerator &hashgen) const
Accumulates the properties of this type into the hash.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
virtual DCPackerInterface * get_nested_field(int n) const
Returns the DCPackerInterface object that represents the nth nested field.
const DCClass * get_class() const
Returns the class object this parameter represents.
virtual void set_name(const std::string &name)
Sets the name of this field.
virtual DCMolecularField * as_molecular_field()
Returns the same field pointer converted to a molecular field pointer, if this is in fact a molecular...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 output_instance(std::ostream &out, bool brief, const std::string &prename, const std::string &name, const std::string &postname) const
Generates a parseable description of the object to the indicated output stream.
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...
Represents the type specification for a single parameter within a field specification.
This represents an array of some other kind of object, meaning this parameter type accepts an arbitra...
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.
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 ...
virtual DCPackerInterface * get_nested_field(int n) const
Returns the DCPackerInterface object that represents the nth nested field.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual bool do_check_match_class_parameter(const DCClassParameter *other) const
Returns true if this field matches the indicated class parameter, false otherwise.
const DCTypedef * get_typedef() const
If this type has been referenced from a typedef, returns the DCTypedef instance, or NULL if the type ...
const std::string & get_name() const
Returns the name of this class.
DCParameter * get_element_type() const
Returns the type of the individual elements of this array.
bool is_bogus_class() const
Returns true if the class has been flagged as a bogus class.
This defines the internal interface for packing values into a DCField.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.