#include <class.h>
Public Member Functions | |
Class (const string &name, KernelServer *ks, bool(*init_func)(Class *, KernelServer *), Object *(*new_func)(const char *name)) | |
~Class () | |
Object * | NewObject (const char *name) |
void | BeginCmds () |
void | AddCmd (CmdProto *cmd_proto) |
void | AddCmd (const char *proto_def, fourcc_t id, void(*)(void *, Cmd *)) |
void | EndCmds () |
void | BeginScriptCmds (int cmds_count) |
void | AddScriptCmd (CmdProto *) |
void | EndScriptCmds () |
CmdProto * | FindCmdByName (const string &name) |
CmdProtoNative * | FindNativeCmdByName (const string &name) |
CmdProto * | FindScriptCmdByName (const string &name) |
CmdProto * | FindCmdById (fourcc_t id) |
HashList * | GetCmdList () const |
Class * | GetSuperClass () const |
void | AddSubClass (Class *cl) |
void | RemSubClass (Class *cl) |
int | AddRef () |
int | RemRef () |
int | GetRefCount () const |
void | SetInstanceSize (int size) |
int | GetInstanceSize () const |
bool | IsA (const string &className) const |
Private Attributes | |
KernelServer * | kernel_server |
Class * | super_class |
HashList * | cmd_list |
KeyArray< CmdProto * > * | cmd_table |
HashList * | script_cmd_list |
The hashed script commandlist of this class. | |
int | ref_count |
int | instance_size |
bool(* | s_init_ptr )(Class *, KernelServer *) |
Pointer to class init function. | |
Object *(* | s_new_ptr )(const char *name) |
Pointer to object construction function. |
Class::Class | ( | const string & | name, | |
KernelServer * | kserv, | |||
bool(*)(Class *, KernelServer *) | init_func, | |||
Object *(*)(const char *name) | new_func | |||
) |
Constructor.
name | Name of the class. | |
kserv | Pointer to kernel server. | |
init_func | Pointer to s_init function in class package. | |
new_func | Pointer to s_create function in class package. |
Class::~Class | ( | void | ) |
Destructor.
Object * Class::NewObject | ( | const char * | name | ) |
Creates a new instance of the class.
void Class::BeginCmds | ( | void | ) |
Start defining commands.
void Class::AddCmd | ( | CmdProto * | cmd_proto | ) |
Adds a command to the class.
proto_def | the command's prototype definition | |
id | the command's unique fourcc code | |
cmd_proc | the command's stub function |
void Class::EndCmds | ( | void | ) |
Finishes defining commands. Builds sorted array of attached cmds for a bsearch() by ID.
void Class::BeginScriptCmds | ( | int | cmds_count | ) |
Starts defining script-side commands.
cmds_count | The number of script cmds that will be defined. |
void Class::AddScriptCmd | ( | CmdProto * | cmd_proto | ) |
Adds a script-side command for this class. Can only be called between Begin/EndScriptCmds().
cmd_proto | A cmd proto created by a script server. |
void Class::EndScriptCmds | ( | ) |
Finishes defining script-side commands.
CmdProto * Class::FindCmdByName | ( | const string & | name | ) |
Finds command by name (searches both native & script-side).
name | name of command to be found |
CmdProtoNative * Class::FindNativeCmdByName | ( | const string & | name | ) |
Finds a native command by name.
name | The name of the command to be found |
CmdProto * Class::FindScriptCmdByName | ( | const string & | name | ) |
Finds a script-side command by name.
name | The name of the command to be found |
Find a native command by fourcc code.
id | the fourcc code of the command to be found |
HashList * Class::GetCmdList | ( | ) | const [inline] |
Gets pointer to command list.
Class * Class::GetSuperClass | ( | ) | const [inline] |
Gets super class of this class.
void Class::AddSubClass | ( | Class * | cl | ) | [inline] |
Adds a sub class to this class.
void Class::RemSubClass | ( | Class * | cl | ) | [inline] |
Removes a subclass from this class.
int Class::AddRef | ( | ) | [inline] |
Increments ref count of class object.
int Class::RemRef | ( | ) | [inline] |
Decrements ref count of class object.
int Class::GetRefCount | ( | ) | const [inline] |
Gets current refcount of class object.
void Class::SetInstanceSize | ( | int | size | ) | [inline] |
Sets instance size.
int Class::GetInstanceSize | ( | ) | const [inline] |
Gets instance size.
bool Class::IsA | ( | const string & | className | ) | const |
Checks if the given class is an ancestor of this class.
className | Name (all lowercase) of a class. |
KernelServer* Class::kernel_server [private] |
Class* Class::super_class [private] |
HashList* Class::cmd_list [private] |
KeyArray<CmdProto*>* Class::cmd_table [private] |
HashList* Class::script_cmd_list [private] |
The hashed script commandlist of this class.
int Class::ref_count [private] |
int Class::instance_size [private] |
bool(* Class::s_init_ptr)(Class *, KernelServer *) [private] |
Pointer to class init function.
Object*(* Class::s_new_ptr)(const char *name) [private] |
Pointer to object construction function.