# DCClass

from pandac.PandaModules import DCClass

Class : DCClass
Description : Defines a particular DistributedClass as read from an input .dc file.

## Inheritance:

DCClass: DCDeclaration
DCDeclaration:

## Methods of DCClass:

aiDatabaseGenerateContext
aiDatabaseGenerateContextOld
aiFormatGenerate
aiFormatUpdate
clientFormatGenerate
clientFormatUpdate
directUpdate
getClassDef
getConstructor
getDcFile
getField
getFieldByIndex
getFieldByName
getInheritedField
getName
getNumber
getNumFields
getNumInheritedFields
getNumParents
getOwnerClassDef
getParent
hasClassDef
hasConstructor
hasOwnerClassDef
isBogusClass
isStruct
packRequiredField
receiveUpdate
receiveUpdateAllRequired
receiveUpdateBroadcastRequired
receiveUpdateBroadcastRequiredOwner
receiveUpdateOther
setClassDef
setOwnerClassDef
startGenerate
stopGenerate

## Methods of DCDeclaration:

asClass
asSwitch
output
write

aiDatabaseGenerateContext Datagram DCClass::ai_database_generate_context(unsigned int context_id, unsigned int parent_id, unsigned int zone_id, unsigned __int64 owner_channel, unsigned __int64 database_server_id, unsigned __int64 from_channel_id) const; Description: Generates a datagram containing the message necessary to create a new database distributed object from the AI. First Pass is to only incldue required values (with Defaults).

aiDatabaseGenerateContextOld Datagram DCClass::ai_database_generate_context_old(unsigned int context_id, unsigned int parent_id, unsigned int zone_id, unsigned __int64 database_server_id, unsigned __int64 from_channel_id) const; TODO: remove this once Skyler has things working with the new server Description: Generates a datagram containing the message necessary to create a new database distributed object from the AI. First Pass is to only incldue required values (with Defaults).

aiFormatGenerate Datagram DCClass::ai_format_generate(PyObject *distobj, int do_id, int parent_id, int zone_id, unsigned __int64 district_channel_id, unsigned __int64 from_channel_id, PyObject *optional_fields) const; Description: Generates a datagram containing the message necessary to generate a new distributed object from the AI. This requires querying the object for the initial value of its required fields. optional_fields is a list of fieldNames to generate in addition to the normal required fields.

aiFormatUpdate Datagram DCClass::ai_format_update(string const &field_name, int do_id, unsigned __int64 to_id, unsigned __int64 from_id, PyObject *args) const; Description: Generates a datagram containing the message necessary to send an update for the indicated distributed object from the AI.

clientFormatGenerate Datagram DCClass::client_format_generate(PyObject *distobj, int do_id, int zone_id, PyObject *optional_fields) const; Description: Generates a datagram containing the message necessary to generate a new distributed object from the client. This requires querying the object for the initial value of its required fields. optional_fields is a list of fieldNames to generate in addition to the normal required fields.

clientFormatUpdate Datagram DCClass::client_format_update(string const &field_name, int do_id, PyObject *args) const; Description: Generates a datagram containing the message necessary to send an update for the indicated distributed object from the client.

directUpdate void DCClass::direct_update(PyObject *distobj, string const &field_name, string const &value_blob); Description: Processes an update for a named field from a packed value blob. Description: Processes an update for a named field from a packed datagram.

getClassDef PyObject *DCClass::get_class_def(void) const; Description: Returns the class object that was previously associated with this DistributedClass. This will return a new reference to the object.

getConstructor DCField *DCClass::get_constructor(void) const; Description: Returns the constructor method for this class if it is defined, or NULL if the class uses the default constructor.

getDcFile DCFile *DCClass::get_dc_file(void) const; Filename: dcClass.I Created by: drose (15Sep04) PANDA 3D SOFTWARE Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved All use of this software is subject to the terms of the Panda 3d Software license. You should have received a copy of this license along with this source code; you will also find a current copy of the license at http://etc.cmu.edu/panda3d/docs/license/ . To contact the maintainers of this program write to panda3d-general@lists.sourceforge.net . Description: Returns the DCFile object that contains the class.

getField DCField *DCClass::get_field(int n) const; Description: 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.

getFieldByIndex DCField *DCClass::get_field_by_index(int index_number) const; Description: 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.

getFieldByName DCField *DCClass::get_field_by_name(string const &name) const; Description: 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.

getInheritedField DCField *DCClass::get_inherited_field(int n) const; Description: 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.

getName string const &DCClass::get_name(void) const; Description: Returns the name of this class.

getNumber int DCClass::get_number(void) const; Description: Returns a unique index number associated with this class. This is defined implicitly when the .dc file(s) are read.

getNumFields int DCClass::get_num_fields(void) const; Description: Returns the number of fields defined directly in this class, ignoring inheritance.

getNumInheritedFields int DCClass::get_num_inherited_fields(void) const; Description: Returns the total number of field fields defined in this class and all ancestor classes.

getNumParents int DCClass::get_num_parents(void) const; Description: Returns the number of base classes this class inherits from.

getOwnerClassDef PyObject *DCClass::get_owner_class_def(void) const; Description: Returns the owner class object that was previously associated with this DistributedClass. This will return a new reference to the object.

getParent DCClass *DCClass::get_parent(int n) const; Description: Returns the nth parent class this class inherits from.

hasClassDef bool DCClass::has_class_def(void) const; Description: Returns true if the DCClass object has an associated Python class definition, false otherwise.

hasConstructor bool DCClass::has_constructor(void) const; Description: Returns true if this class has a constructor method, false if it just uses the default constructor.

hasOwnerClassDef bool DCClass::has_owner_class_def(void) const; Description: Returns true if the DCClass object has an associated Python owner class definition, false otherwise.

isBogusClass bool DCClass::is_bogus_class(void) const; Description: 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.

isStruct bool DCClass::is_struct(void) const; Description: Returns true if the class has been identified with the "struct" keyword in the dc file, false if it was declared with "dclass".

packRequiredField bool DCClass::pack_required_field(Datagram &datagram, PyObject *distobj, DCField const *field) const; Description: Looks up the current value of the indicated field by calling the appropriate get*() function, then packs that value into the datagram. This field is presumably either a required field or a specified optional field, and we are building up a datagram for the generate-with-required message. Returns true on success, false on failure. Description: Looks up the current value of the indicated field by calling the appropriate get*() function, then packs that value into the packer. This field is presumably either a required field or a specified optional field, and we are building up a datagram for the generate-with-required message.

receiveUpdate void DCClass::receive_update(PyObject *distobj, DatagramIterator &di) const; Description: Extracts the update message out of the packer and applies it to the indicated object by calling the appropriate method.

receiveUpdateAllRequired void DCClass::receive_update_all_required(PyObject *distobj, DatagramIterator &di) const; Description: Processes a big datagram that includes all of the "required" fields that are sent when an avatar is created. This is all of the atomic fields that are marked "required", whether they are broadcast or not.

receiveUpdateBroadcastRequired void DCClass::receive_update_broadcast_required(PyObject *distobj, DatagramIterator &di) const; Description: Processes a big datagram that includes all of the "required" fields that are sent along with a normal "generate with required" message. This is all of the atomic fields that are marked "broadcast required".

receiveUpdateBroadcastRequiredOwner void DCClass::receive_update_broadcast_required_owner(PyObject *distobj, DatagramIterator &di) const; Description: Processes a big datagram that includes all of the "required" fields that are sent along with a normal "generate with required" message. This is all of the atomic fields that are marked "broadcast ownrecv". Should be used for 'owner-view' objects.

receiveUpdateOther void DCClass::receive_update_other(PyObject *distobj, DatagramIterator &di) const; Description: Processes a datagram that lists some additional fields that are broadcast in one chunk.

setClassDef void DCClass::set_class_def(PyObject *class_def); Description: Sets the class object associated with this DistributedClass. This object will be used to construct new instances of the class.

setOwnerClassDef void DCClass::set_owner_class_def(PyObject *owner_class_def); Description: Sets the owner class object associated with this DistributedClass. This object will be used to construct new owner instances of the class.

startGenerate void DCClass::start_generate(void); Description: 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().

stopGenerate void DCClass::stop_generate(void); Description: Stops the PStats timer on the "generate" task. This should balance with a preceding call to start_generate().

asClass virtual DCClass *DCDeclaration::as_class(void); Description:

asSwitch virtual DCSwitch *DCDeclaration::as_switch(void); Description:

output virtual void DCDeclaration::output(ostream &out) const; Description : Write a string representation of this instance to <out>.

write void DCDeclaration::write(ostream &out, int indent_level) const; Description : Write a string representation of this instance to <out>.