23DCClassParameter(
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),
86as_class_parameter()
const {
122 nassertr(n >= 0 && n < (
int)_nested_fields.size(),
nullptr);
123 return _nested_fields[n];
131output_instance(std::ostream &out,
bool brief,
const std::string &prename,
132 const std::string &name,
const std::string &postname)
const {
155bool DCClassParameter::
164bool 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])) {
182bool DCClassParameter::
191 for (
size_t i = 0; i < _nested_fields.size(); i++) {
192 if (!_nested_fields[i]->
check_match(element_type)) {
This represents an array of some other kind of object, meaning this parameter type accepts an arbitra...
int get_array_size() const
Returns the fixed number of elements in this array, or -1 if the array may contain a variable number ...
DCParameter * get_element_type() const
Returns the type of the individual elements of this array.
This represents a class (or struct) object used as a parameter itself.
const DCClass * get_class() const
Returns the class object this parameter represents.
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.
virtual DCPackerInterface * get_nested_field(int n) const
Returns the DCPackerInterface object that represents the nth nested field.
virtual void generate_hash(HashGenerator &hashgen) const
Accumulates the properties of this type into the hash.
Defines a particular DistributedClass as read from an input .dc file.
void generate_hash(HashGenerator &hashgen) const
Accumulates the properties of this class into the hash.
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 is_bogus_class() const
Returns true if the class has been flagged as a bogus class.
const std::string & get_name() const
Returns the name of this class.
A single field of a Distributed Class, either atomic or molecular.
bool has_default_value() const
Returns true if a default value has been explicitly established for this field, false otherwise.
virtual DCMolecularField * as_molecular_field()
Returns the same field pointer converted to a molecular field pointer, if this is in fact a molecular...
This defines the internal interface for packing values into a DCField.
bool has_fixed_structure() const
Returns true if this field type always has the same structure regardless of the data in the stream,...
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.
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 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 ...
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...
virtual bool do_check_match_class_parameter(const DCClassParameter *other) const
Returns true if this field matches the indicated class parameter, false otherwise.
Represents the type specification for a single parameter within a field specification.
virtual void generate_hash(HashGenerator &hashgen) const
Accumulates the properties of this type into the hash.
const DCTypedef * get_typedef() const
If this type has been referenced from a typedef, returns the DCTypedef instance, or NULL if the type ...
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.
This class generates an arbitrary hash number from a sequence of ints.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.