DCClass

class DCClass

Bases: DCDeclaration

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

Inheritance diagram

Inheritance diagram of DCClass

Datagram ai_format_generate(PyObject *distobj, DOID_TYPE do_id, ZONEID_TYPE parent_id, ZONEID_TYPE zone_id, CHANNEL_TYPE district_channel_id, CHANNEL_TYPE from_channel_id, PyObject *optional_fields) const
Datagram ai_format_update(std::string const &field_name, DOID_TYPE do_id, CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyObject *args) const
Datagram ai_format_update_msg_type(std::string const &field_name, DOID_TYPE do_id, CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, int msg_type, PyObject *args) const
Datagram client_format_generate_CMU(PyObject *distobj, DOID_TYPE do_id, ZONEID_TYPE zone_id, PyObject *optional_fields) const
Datagram client_format_update(std::string const &field_name, DOID_TYPE do_id, PyObject *args) const
void direct_update(PyObject *distobj, std::string const &field_name, vector_uchar const &value_blob)
void direct_update(PyObject *distobj, std::string const &field_name, Datagram const &datagram)
PyObject *get_class_def(void) const
DCField *get_constructor(void) const

Returns the constructor method for this class if it is defined, or NULL if the class uses the default constructor.

DCFile *get_dc_file(void) const

Returns the DCFile object that contains the class.

DCField *get_field(int n) const

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.

DCField *get_field_by_index(int index_number) const

Returns a pointer to the DCField that has the indicated index number. If the numbered 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.

DCField *get_field_by_name(std::string const &name) const

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.

DCField *get_inherited_field(int n) const

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

This used to be the same thing as get_field_by_index(), back when the fields were numbered sequentially within a class’s inheritance hierarchy. Now that fields have a globally unique index number, this is no longer true.

std::string const &get_name(void) const

Returns the name of this class.

int get_num_fields(void) const

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

int get_num_inherited_fields(void) const

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

int get_num_parents(void) const

Returns the number of base classes this class inherits from.

int get_number(void) const

Returns a unique index number associated with this class. This is defined implicitly when the .dc file(s) are read.

PyObject *get_owner_class_def(void) const
DCClass *get_parent(int n) const

Returns the nth parent class this class inherits from.

bool has_class_def(void) const
bool has_constructor(void) const

Returns true if this class has a constructor method, false if it just uses the default constructor.

bool has_owner_class_def(void) const
bool inherits_from_bogus_class(void) const

Returns true if this class, or any class in the inheritance heirarchy for this class, is a “bogus” class–a forward reference to an as-yet-undefined class.

bool is_bogus_class(void) const

Returns true if the class has been flagged as a bogus class. This is set for classes that are generated by the parser as placeholder for missing classes, as when reading a partial file; it should not occur in a normal valid dc file.

bool is_struct(void) const

Returns true if the class has been identified with the “struct” keyword in the dc file, false if it was declared with “dclass”.

virtual void output(std::ostream &out) const

Write a string representation of this instance to <out>.

bool pack_required_field(Datagram &datagram, PyObject *distobj, DCField const *field) const
bool pack_required_field(DCPacker &packer, PyObject *distobj, DCField const *field) const
void receive_update(PyObject *distobj, DatagramIterator &di) const
void receive_update_all_required(PyObject *distobj, DatagramIterator &di) const
void receive_update_broadcast_required(PyObject *distobj, DatagramIterator &di) const
void receive_update_broadcast_required_owner(PyObject *distobj, DatagramIterator &di) const
void receive_update_other(PyObject *distobj, DatagramIterator &di) const
void set_class_def(PyObject *class_def)
void set_owner_class_def(PyObject *owner_class_def)
void start_generate(void)

Starts the PStats timer going on the “generate” task, that is, marks the beginning of the process of generating a new object, for the purposes of timing this process.

This should balance with a corresponding call to stop_generate().

void stop_generate(void)

Stops the PStats timer on the “generate” task. This should balance with a preceding call to start_generate().