15 #include "dcClassParameter.h" 17 #include "dcArrayParameter.h" 18 #include "hashGenerator.h" 26 DCClassParameter(
const DCClass *dclass) :
33 _has_nested_fields =
true;
34 _pack_type = PT_class;
38 _nested_fields.push_back(field);
42 for (i = 0 ; i < num_fields; i++) {
45 _nested_fields.push_back(field);
49 _num_nested_fields = _nested_fields.size();
54 _has_fixed_byte_size =
true;
56 _has_fixed_structure =
true;
57 for (i = 0; i < _num_nested_fields; i++) {
75 _nested_fields(copy._nested_fields),
86 as_class_parameter() {
96 as_class_parameter()
const {
142 nassertr(n >= 0 && n < (
int)_nested_fields.size(), NULL);
143 return _nested_fields[n];
154 const string &name,
const string &postname)
const {
183 bool DCClassParameter::
194 bool DCClassParameter::
196 if (_nested_fields.size() != other->_nested_fields.size()) {
199 for (
size_t i = 0; i < _nested_fields.size(); i++) {
200 if (!_nested_fields[i]->
check_match(other->_nested_fields[i])) {
214 bool DCClassParameter::
223 for (
size_t i = 0; i < _nested_fields.size(); i++) {
224 if (!_nested_fields[i]->
check_match(element_type)) {
virtual void generate_hash(HashGenerator &hashgen) const
Accumulates the properties of this type into the hash.
This represents a single typedef declaration in the dc file.
void output_typedef_name(ostream &out, bool brief, const string &prename, const string &name, const string &postname) const
Formats the instance like output_instance, but uses the typedef name instead.
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.
virtual void output_instance(ostream &out, bool brief, const string &prename, const string &name, const string &postname) const
Formats the parameter in the C++-like dc syntax as a typename and identifier.
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 DCClass * get_class() const
Returns the class object this parameter represents.
virtual DCMolecularField * as_molecular_field()
Returns the same field pointer converted to a molecular field pointer, if this is in fact a molecular...
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(ostream &out, bool brief, const string &prename, const string &name, const 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...
DCField * get_inherited_field(int n) const
Returns the nth field field in the class and all of its ancestors.
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...
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.
DCField * get_constructor() const
Returns the constructor method for this class if it is defined, or NULL if the class uses the default...
int get_num_inherited_fields() const
Returns the total number of field fields defined in this class and all ancestor classes.
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 ...
virtual void set_name(const string &name)
Sets the name of this field.
bool has_constructor() const
Returns true if this class has a constructor method, false if it just uses the default constructor...
DCParameter * get_element_type() const
Returns the type of the individual elements of this array.
const string & get_name() const
Returns the name of this class.
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.