DCClass Class Reference

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

Inheritance diagram for DCClass:
DCDeclaration

Public Member Functions

Datagram aiDatabaseGenerateContext (unsigned int context_id, DOIDTYPE parent_id, ZONEIDTYPE zone_id, CHANNELTYPE owner_channel, CHANNELTYPE database_server_id, CHANNELTYPE from_channel_id)
 Generates a datagram containing the message necessary to create a new database distributed object from the AI. More...
 
Datagram aiDatabaseGenerateContextOld (unsigned int context_id, DOIDTYPE parent_id, ZONEIDTYPE zone_id, CHANNELTYPE database_server_id, CHANNELTYPE from_channel_id)
 TODO: remove this once Skyler has things working with the new server Generates a datagram containing the message necessary to create a new database distributed object from the AI. More...
 
Datagram aiFormatGenerate (object distobj, DOIDTYPE do_id, ZONEIDTYPE parent_id, ZONEIDTYPE zone_id, CHANNELTYPE district_channel_id, CHANNELTYPE from_channel_id, object optional_fields)
 
Datagram aiFormatUpdate (str field_name, DOIDTYPE do_id, CHANNELTYPE to_id, CHANNELTYPE from_id, object args)
 Generates a datagram containing the message necessary to send an update for the indicated distributed object from the AI. More...
 
Datagram aiFormatUpdateMsgType (str field_name, DOIDTYPE do_id, CHANNELTYPE to_id, CHANNELTYPE from_id, int msg_type, object args)
 Generates a datagram containing the message necessary to send an update, using the indicated msg type for the indicated distributed object from the AI. More...
 
Datagram clientFormatGenerateCMU (object distobj, DOIDTYPE do_id, ZONEIDTYPE zone_id, object optional_fields)
 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. More...
 
Datagram clientFormatUpdate (str field_name, DOIDTYPE do_id, object args)
 Generates a datagram containing the message necessary to send an update for the indicated distributed object from the client. More...
 
 directUpdate (object distobj, str field_name, const Datagram datagram)
 Processes an update for a named field from a packed datagram. More...
 
 directUpdate (object distobj, str field_name, str value_blob)
 Processes an update for a named field from a packed value blob. More...
 
object getClassDef ()
 Returns the class object that was previously associated with this DistributedClass. This will return a new reference to the object. More...
 
DCField getConstructor ()
 Returns the constructor method for this class if it is defined, or NULL if the class uses the default constructor. More...
 
DCFile getDcFile ()
 Returns the DCFile object that contains the class. More...
 
DCField getField (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. More...
 
DCField getFieldByIndex (int index_number)
 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. More...
 
DCField getFieldByName (str 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. More...
 
DCField getInheritedField (int n)
 Returns the nth field field in the class and all of its ancestors. More...
 
str getName ()
 Returns the name of this class. More...
 
int getNumber ()
 Returns a unique index number associated with this class. This is defined implicitly when the .dc file(s) are read. More...
 
int getNumFields ()
 Returns the number of fields defined directly in this class, ignoring inheritance. More...
 
int getNumInheritedFields ()
 Returns the total number of field fields defined in this class and all ancestor classes. More...
 
int getNumParents ()
 Returns the number of base classes this class inherits from. More...
 
object getOwnerClassDef ()
 Returns the owner class object that was previously associated with this DistributedClass. This will return a new reference to the object. More...
 
DCClass getParent (int n)
 Returns the nth parent class this class inherits from. More...
 
bool hasClassDef ()
 Returns true if the DCClass object has an associated Python class definition, false otherwise. More...
 
bool hasConstructor ()
 Returns true if this class has a constructor method, false if it just uses the default constructor. More...
 
bool hasOwnerClassDef ()
 Returns true if the DCClass object has an associated Python owner class definition, false otherwise. More...
 
bool inheritsFromBogusClass ()
 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. More...
 
bool isBogusClass ()
 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. More...
 
bool isStruct ()
 Returns true if the class has been identified with the "struct" keyword in the dc file, false if it was declared with "dclass". More...
 
 output (Ostream out)
 Write a string representation of this instance to <out>. More...
 
bool packRequiredField (DCPacker packer, object distobj, const DCField field)
 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. More...
 
bool packRequiredField (Datagram datagram, object distobj, const DCField field)
 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. More...
 
 receiveUpdate (object distobj, DatagramIterator di)
 Extracts the update message out of the packer and applies it to the indicated object by calling the appropriate method. More...
 
 receiveUpdateAllRequired (object distobj, DatagramIterator di)
 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. More...
 
 receiveUpdateBroadcastRequired (object distobj, DatagramIterator di)
 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". More...
 
 receiveUpdateBroadcastRequiredOwner (object distobj, DatagramIterator di)
 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. More...
 
 receiveUpdateOther (object distobj, DatagramIterator di)
 Processes a datagram that lists some additional fields that are broadcast in one chunk. More...
 
 setClassDef (object class_def)
 Sets the class object associated with this DistributedClass. This object will be used to construct new instances of the class. More...
 
 setOwnerClassDef (object owner_class_def)
 Sets the owner class object associated with this DistributedClass. This object will be used to construct new owner instances of the class. More...
 
 startGenerate ()
 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. More...
 
 stopGenerate ()
 Stops the PStats timer on the "generate" task. This should balance with a preceding call to start_generate(). More...
 
- Public Member Functions inherited from DCDeclaration
DCClass asClass ()
 
const DCClass asClass ()
 
DCSwitch asSwitch ()
 
const DCSwitch asSwitch ()
 
 output (Ostream out)
 Write a string representation of this instance to <out>. More...
 
 write (Ostream out, int indent_level)
 Write a string representation of this instance to <out>. More...
 

Detailed Description

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

Member Function Documentation

Datagram aiDatabaseGenerateContext ( unsigned int  context_id,
DOIDTYPE  parent_id,
ZONEIDTYPE  zone_id,
CHANNELTYPE  owner_channel,
CHANNELTYPE  database_server_id,
CHANNELTYPE  from_channel_id 
)

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).

Datagram aiDatabaseGenerateContextOld ( unsigned int  context_id,
DOIDTYPE  parent_id,
ZONEIDTYPE  zone_id,
CHANNELTYPE  database_server_id,
CHANNELTYPE  from_channel_id 
)

TODO: remove this once Skyler has things working with the new server 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).

Datagram aiFormatGenerate ( object  distobj,
DOIDTYPE  do_id,
ZONEIDTYPE  parent_id,
ZONEIDTYPE  zone_id,
CHANNELTYPE  district_channel_id,
CHANNELTYPE  from_channel_id,
object  optional_fields 
)
Datagram aiFormatUpdate ( str  field_name,
DOIDTYPE  do_id,
CHANNELTYPE  to_id,
CHANNELTYPE  from_id,
object  args 
)

Generates a datagram containing the message necessary to send an update for the indicated distributed object from the AI.

Datagram aiFormatUpdateMsgType ( str  field_name,
DOIDTYPE  do_id,
CHANNELTYPE  to_id,
CHANNELTYPE  from_id,
int  msg_type,
object  args 
)

Generates a datagram containing the message necessary to send an update, using the indicated msg type for the indicated distributed object from the AI.

Datagram clientFormatGenerateCMU ( object  distobj,
DOIDTYPE  do_id,
ZONEIDTYPE  zone_id,
object  optional_fields 
)

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.

This method is only called by the CMU implementation.

Datagram clientFormatUpdate ( str  field_name,
DOIDTYPE  do_id,
object  args 
)

Generates a datagram containing the message necessary to send an update for the indicated distributed object from the client.

directUpdate ( object  distobj,
str  field_name,
const Datagram  datagram 
)

Processes an update for a named field from a packed datagram.

directUpdate ( object  distobj,
str  field_name,
str  value_blob 
)

Processes an update for a named field from a packed value blob.

object getClassDef ( )

Returns the class object that was previously associated with this DistributedClass. This will return a new reference to the object.

DCField getConstructor ( )

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

DCFile getDcFile ( )

Returns the DCFile object that contains the class.

DCField getField ( 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.

DCField getFieldByIndex ( int  index_number)

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 getFieldByName ( str  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.

DCField getInheritedField ( int  n)

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.

str getName ( )

Returns the name of this class.

int getNumber ( )

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

int getNumFields ( )

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

int getNumInheritedFields ( )

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

int getNumParents ( )

Returns the number of base classes this class inherits from.

object getOwnerClassDef ( )

Returns the owner class object that was previously associated with this DistributedClass. This will return a new reference to the object.

DCClass getParent ( int  n)

Returns the nth parent class this class inherits from.

bool hasClassDef ( )

Returns true if the DCClass object has an associated Python class definition, false otherwise.

bool hasConstructor ( )

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

bool hasOwnerClassDef ( )

Returns true if the DCClass object has an associated Python owner class definition, false otherwise.

bool inheritsFromBogusClass ( )

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 isBogusClass ( )

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 isStruct ( )

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

output ( Ostream  out)

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

bool packRequiredField ( DCPacker  packer,
object  distobj,
const DCField  field 
)

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.

Returns true on success, false on failure.

bool packRequiredField ( Datagram  datagram,
object  distobj,
const DCField  field 
)

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.

receiveUpdate ( object  distobj,
DatagramIterator  di 
)

Extracts the update message out of the packer and applies it to the indicated object by calling the appropriate method.

receiveUpdateAllRequired ( object  distobj,
DatagramIterator  di 
)

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 ( object  distobj,
DatagramIterator  di 
)

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 ( object  distobj,
DatagramIterator  di 
)

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 ( object  distobj,
DatagramIterator  di 
)

Processes a datagram that lists some additional fields that are broadcast in one chunk.

setClassDef ( object  class_def)

Sets the class object associated with this DistributedClass. This object will be used to construct new instances of the class.

setOwnerClassDef ( object  owner_class_def)

Sets the owner class object associated with this DistributedClass. This object will be used to construct new owner instances of the class.

startGenerate ( )

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 ( )

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