Class Class Reference
[Kernel Module]

#include <class.h>

Inheritance diagram for Class:

HashNode ListNode< HashNode >

List of all members.


Detailed Description

Nebula metaclass. Root derived objects are not created directly in C++, but by Class objects. Class objects wrap dynamic demand-loading of classes, and do other householding stuff.

Public Member Functions

 Class (const string &name, KernelServer *ks, bool(*init_func)(Class *, KernelServer *), Object *(*new_func)(const char *name))
 ~Class ()
ObjectNewObject (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 ()
CmdProtoFindCmdByName (const string &name)
CmdProtoNativeFindNativeCmdByName (const string &name)
CmdProtoFindScriptCmdByName (const string &name)
CmdProtoFindCmdById (fourcc_t id)
HashListGetCmdList () const
ClassGetSuperClass () 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

KernelServerkernel_server
Classsuper_class
HashListcmd_list
KeyArray< CmdProto * > * cmd_table
HashListscript_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.

Constructor & Destructor Documentation

Class::Class ( const string &  name,
KernelServer kserv,
bool(*)(Class *, KernelServer *)  init_func,
Object *(*)(const char *name)  new_func 
)

Constructor.

Parameters:
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.


Member Function Documentation

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.

Parameters:
cmd_proto pointer to CmdProto object to be added

void Class::AddCmd ( const char *  proto_def,
fourcc_t  id,
void(*)(void *, Cmd *)  cmd_proc 
)

Adds a command to the class.

Parameters:
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.

Parameters:
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().

Note:
Script server cmd protos can't be looked up by their 4cc.
Parameters:
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).

Parameters:
name name of command to be found
Returns:
pointer to CmdProto object, or 0

CmdProtoNative * Class::FindNativeCmdByName ( const string &  name  ) 

Finds a native command by name.

Parameters:
name The name of the command to be found

CmdProto * Class::FindScriptCmdByName ( const string &  name  ) 

Finds a script-side command by name.

Parameters:
name The name of the command to be found

CmdProto * Class::FindCmdById ( fourcc_t  id  ) 

Find a native command by fourcc code.

Parameters:
id the fourcc code of the command to be found
Returns:
pointer to CmdProto object, or 0

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.

Parameters:
className Name (all lowercase) of a class.
Returns:
true if className is an ancestor of this class, or if ancestorName is the name of this class. false otherwise.


Member Data Documentation

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.


The documentation for this class was generated from the following files:
Generated on Sat Oct 20 14:47:31 2007 for Dark Oberon by  doxygen 1.5.3