Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

DCClass Class Reference

Defines a particular DistributedClass as read from an input .dc file. More...

#include <dcClass.h>

List of all members.

Public Types

typedef pvector< DCClass * > Parents
typedef pvector< DCField * > Fields
typedef pmap< string, DCField * > FieldsByName

Public Member Functions

int get_number () const
 Returns a unique index number associated with this class.

string get_name () const
 Returns the name of this class.

bool has_parent () const
 Returns true if this class inherits from some other class, false if it does not.

DCClass * get_parent () const
 Returns the parent class this class inherits from, if any.

int get_num_fields ()
 Returns the number of fields defined directly in this class, ignoring inheritance.

DCFieldget_field (int n)
 Returns the nth field in the class.

DCFieldget_field_by_name (const string &name)
 Returns a pointer to the DCField that shares the indicated name.

int get_num_inherited_fields ()
 Returns the total number of field fields defined in this class and all ancestor classes.

DCFieldget_inherited_field (int n)
 Returns the nth field field in the class and all of its ancestors.

 DCClass ()
 ~DCClass ()
void write (ostream &out, int indent_level=0) const
 Generates a parseable description of the object to the indicated output stream.

void generate_hash (HashGenerator &hash) const
 Accumulates the properties of this class into the hash.

bool add_field (DCField *field)
 Adds the newly-allocated field to the class.


Public Attributes

int _number
string _name
Parents _parents
Fields _fields
FieldsByName _fields_by_name


Detailed Description

Defines a particular DistributedClass as read from an input .dc file.

Definition at line 39 of file dcClass.h.


Member Typedef Documentation

typedef pvector<DCField *> DCClass::Fields
 

Definition at line 72 of file dcClass.h.

typedef pmap<string, DCField *> DCClass::FieldsByName
 

Definition at line 78 of file dcClass.h.

typedef pvector<DCClass *> DCClass::Parents
 

Definition at line 69 of file dcClass.h.


Constructor & Destructor Documentation

DCClass::DCClass  ) 
 

Definition at line 220 of file dcClass.cxx.

References _name, _parents, HashGenerator::add_int(), and HashGenerator::add_string().

DCClass::~DCClass  ) 
 

Definition at line 231 of file dcClass.cxx.

References _fields.


Member Function Documentation

bool DCClass::add_field DCField field  ) 
 

Adds the newly-allocated field to the class.

The class becomes the owner of the pointer and will delete it when it destructs. Returns true if the field is successfully added, or false if there was a name conflict.

Definition at line 316 of file dcClass.cxx.

void DCClass::generate_hash HashGenerator hash  )  const
 

Accumulates the properties of this class into the hash.

Definition at line 283 of file dcClass.cxx.

DCField * DCClass::get_field int  n  ) 
 

Returns the nth field in the class.

This is not necessarily the field with index n; this is the nth field defined in the class directly, ignoring inheritance.

Definition at line 119 of file dcClass.cxx.

Referenced by get_field_by_name().

DCField * DCClass::get_field_by_name const string &  name  ) 
 

Returns a pointer to the DCField that shares the indicated name.

If the named field is not found in the current class, the parent classes will be searched, so the value returned may not actually be a field within this class. Returns NULL if there is no such field defined.

Definition at line 143 of file dcClass.cxx.

References _parents, and get_field().

DCField * DCClass::get_inherited_field int  n  ) 
 

Returns the nth field field in the class and all of its ancestors.

This *is* the field corresponding to the given index number, since the fields are ordered consecutively beginning at the earliest inherited fields.

Definition at line 199 of file dcClass.cxx.

References _parents.

string DCClass::get_name  )  const
 

Returns the name of this class.

Definition at line 52 of file dcClass.cxx.

References _parents.

int DCClass::get_num_fields  ) 
 

Returns the number of fields defined directly in this class, ignoring inheritance.

Definition at line 100 of file dcClass.cxx.

References _fields_by_name, _parents, and NULL.

int DCClass::get_num_inherited_fields  ) 
 

Returns the total number of field fields defined in this class and all ancestor classes.

Definition at line 174 of file dcClass.cxx.

References _fields.

int DCClass::get_number  )  const
 

Returns a unique index number associated with this class.

This is defined implicitly when the .dc file(s) are read.

Definition at line 39 of file dcClass.cxx.

References _name.

DCClass * DCClass::get_parent  )  const
 

Returns the parent class this class inherits from, if any.

It is an error to call this unless has_parent() returned true.

Definition at line 84 of file dcClass.cxx.

References _fields, nassertr, and NULL.

bool DCClass::has_parent  )  const
 

Returns true if this class inherits from some other class, false if it does not.

Definition at line 67 of file dcClass.cxx.

void DCClass::write ostream &  out,
int  indent_level = 0
const
 

Generates a parseable description of the object to the indicated output stream.

Definition at line 249 of file dcClass.cxx.

References _fields_by_name.


Member Data Documentation

Fields DCClass::_fields
 

Definition at line 73 of file dcClass.h.

Referenced by get_num_inherited_fields(), get_parent(), and ~DCClass().

FieldsByName DCClass::_fields_by_name
 

Definition at line 79 of file dcClass.h.

Referenced by get_num_fields(), and write().

string DCClass::_name
 

Definition at line 67 of file dcClass.h.

Referenced by DCClass(), DCFile::get_class(), and get_number().

int DCClass::_number
 

Definition at line 66 of file dcClass.h.

Parents DCClass::_parents
 

Definition at line 70 of file dcClass.h.

Referenced by DCClass(), get_field_by_name(), get_inherited_field(), get_name(), and get_num_fields().


The documentation for this class was generated from the following files:
Generated on Fri May 2 01:41:00 2003 for Direct by doxygen1.3