Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

zeitgeist::Class Class Reference

This class is quite essential for the Zeitgeist Core. More...

#include <class.h>

Inheritance diagram for zeitgeist::Class:

Inheritance graph
[legend]
Collaboration diagram for zeitgeist::Class:

Collaboration graph
[legend]
List of all members.

Public Types

typedef GCValue(* TCmdProc )(Object *, const zeitgeist::ParameterList &in)
 defines a signature for a function used as the c++ implementation of a member function exported to a script language.
typedef std::list< std::string > TStringList

Public Member Functions

 Class (const std::string &name)
 constructs a class object for the class 'name'
virtual ~Class ()
boost::shared_ptr< ObjectCreate ()
 creates a new instance of the represented class
boost::shared_ptr< CoreGetCore () const
 returns a pointer to the core this class is attached to
void SetBundle (const boost::shared_ptr< salt::SharedLibrary > &bundle)
 sets the bundle, this class was loaded from
TCmdProc GetCmdProc (const std::string &functionName) const
 the command procedure for a function
const TStringListGetBaseClasses () const
 returns a list of base class names
bool SupportsClass (const std::string &name) const
 returns true iff the class supports a given 'interface', i.e.
bool SupportsCommand (const std::string &name) const
 returns true iff the class supports a given command, i.e.

Protected Member Functions

void AttachInstance (const boost::weak_ptr< Object > &instance)
 adds an instance to the local list of instances
void DetachInstance (const boost::weak_ptr< Object > &instance)
 removes an instance from the local list of instances

Protected Attributes

TCommandMap mFunctions
TStringList mBaseClasses

Private Types

typedef std::list< boost::weak_ptr<
Object > > 
TObjectList
 defines a list of pointers to object instances
typedef std::map< std::string,
TCmdProc
TCommandMap
 defines a mapping from member names to command procedures

Private Member Functions

 Class (const Class &obj)
Classoperator= (const Class &obj)
virtual ObjectCreateInstance () const
 pure virtual function which creates instances
virtual void DefineClass ()=0
 pure virtual function which initializes the script callbacks and links to parent classes
void AttachTo (const boost::weak_ptr< Core > &core)
 set the core, which this class belongs to

Private Attributes

boost::weak_ptr< CoremCore
boost::shared_ptr< salt::SharedLibrarymBundle
 a shared pointer to the bundle, this class object came from.
TObjectList mInstances
 a list of instances, which were created by this class object

Friends

class Object
class Core

Detailed Description

This class is quite essential for the Zeitgeist Core.

Every class which wants to be managed by Zeitgeist will have to derive a class object from this class and override the factory method. Only decendants from Object are able to use Class properly and the factory method returns a Object pointer.

A Class object is characterized by several parameters:

A version is stored as an unsigned 32-bit integer, with each byte representing a version number. So ABCD would be A.B.C.D. That way a simple integer comparison can be used for newer version queries.

Class objects also are the key to providing Zeitgeist with a plugin interface. The Core is responsible for managing all Class objects it knows. It is possible to export Class objects from a shared library through a unified interface, therefore enabling Class objects to be added at runtime to the Core.

Definition at line 135 of file class.h.


Member Typedef Documentation

typedef GCValue(* zeitgeist::Class::TCmdProc)(Object *, const zeitgeist::ParameterList &in)
 

defines a signature for a function used as the c++ implementation of a member function exported to a script language.

It receives a pointer to an instance of the class from which it is a member function along with a list of paramters.

Definition at line 151 of file class.h.

typedef std::map<std::string, TCmdProc> zeitgeist::Class::TCommandMap [private]
 

defines a mapping from member names to command procedures

Definition at line 162 of file class.h.

typedef std::list< boost::weak_ptr<Object> > zeitgeist::Class::TObjectList [private]
 

defines a list of pointers to object instances

Definition at line 156 of file class.h.

typedef std::list<std::string> zeitgeist::Class::TStringList
 

Definition at line 152 of file class.h.


Constructor & Destructor Documentation

Class::Class const std::string &  name  ) 
 

constructs a class object for the class 'name'

Definition at line 31 of file class.cpp.

Class::~Class  )  [virtual]
 

Definition at line 35 of file class.cpp.

References mInstances.

zeitgeist::Class::Class const Class obj  )  [private]
 


Member Function Documentation

void Class::AttachInstance const boost::weak_ptr< Object > &  instance  )  [protected]
 

adds an instance to the local list of instances

Definition at line 91 of file class.cpp.

References mInstances.

Referenced by Create().

void Class::AttachTo const boost::weak_ptr< Core > &  core  )  [private]
 

set the core, which this class belongs to

Definition at line 124 of file class.cpp.

References mCore.

boost::shared_ptr< Object > Class::Create  ) 
 

creates a new instance of the represented class

Definition at line 58 of file class.cpp.

References AttachInstance(), CreateInstance(), and zeitgeist::Object::GetSelf().

Here is the call graph for this function:

Object * Class::CreateInstance  )  const [private, virtual]
 

pure virtual function which creates instances

Reimplemented in zeitgeist::Class_Leaf, zeitgeist::Class_LogServer, zeitgeist::Class_Node, and zeitgeist::Class_Object.

Definition at line 119 of file class.cpp.

Referenced by Create().

virtual void zeitgeist::Class::DefineClass  )  [private, pure virtual]
 

pure virtual function which initializes the script callbacks and links to parent classes

Implemented in zeitgeist::Class_Class, zeitgeist::Class_Leaf, zeitgeist::Class_LogServer, zeitgeist::Class_Node, and zeitgeist::Class_Object.

void Class::DetachInstance const boost::weak_ptr< Object > &  instance  )  [protected]
 

removes an instance from the local list of instances

Definition at line 96 of file class.cpp.

References mInstances.

const Class::TStringList & Class::GetBaseClasses  )  const
 

returns a list of base class names

Definition at line 176 of file class.cpp.

References mBaseClasses.

Class::TCmdProc Class::GetCmdProc const std::string &  functionName  )  const
 

the command procedure for a function

Definition at line 134 of file class.cpp.

References GetCore(), mBaseClasses, and mFunctions.

Referenced by SupportsCommand().

Here is the call graph for this function:

boost::shared_ptr< Core > Class::GetCore  )  const
 

returns a pointer to the core this class is attached to

Reimplemented from zeitgeist::Object.

Definition at line 79 of file class.cpp.

References zeitgeist::Leaf::GetName(), and mCore.

Referenced by GetCmdProc(), and SupportsClass().

Here is the call graph for this function:

Class& zeitgeist::Class::operator= const Class obj  )  [private]
 

void Class::SetBundle const boost::shared_ptr< salt::SharedLibrary > &  bundle  ) 
 

sets the bundle, this class was loaded from

Definition at line 129 of file class.cpp.

References mBundle.

bool Class::SupportsClass const std::string &  name  )  const
 

returns true iff the class supports a given 'interface', i.e.

the base class hierarchy contains the class 'name'

Definition at line 186 of file class.cpp.

References GetCore(), zeitgeist::Leaf::GetName(), and mBaseClasses.

Here is the call graph for this function:

bool Class::SupportsCommand const std::string &  name  )  const
 

returns true iff the class supports a given command, i.e.

to this class or to one of its base classes the given command procedure is registered

Definition at line 181 of file class.cpp.

References GetCmdProc().

Here is the call graph for this function:


Friends And Related Function Documentation

friend class Core [friend]
 

Definition at line 139 of file class.h.

friend class Object [friend]
 

Definition at line 138 of file class.h.


Member Data Documentation

TStringList zeitgeist::Class::mBaseClasses [protected]
 

Definition at line 224 of file class.h.

Referenced by GetBaseClasses(), GetCmdProc(), and SupportsClass().

boost::shared_ptr<salt::SharedLibrary> zeitgeist::Class::mBundle [private]
 

a shared pointer to the bundle, this class object came from.

So, if all references to the class object are deleted, the shared library will be freed.

Definition at line 232 of file class.h.

Referenced by SetBundle().

boost::weak_ptr<Core> zeitgeist::Class::mCore [private]
 

Definition at line 226 of file class.h.

Referenced by AttachTo(), and GetCore().

TCommandMap zeitgeist::Class::mFunctions [protected]
 

Definition at line 223 of file class.h.

Referenced by GetCmdProc().

TObjectList zeitgeist::Class::mInstances [private]
 

a list of instances, which were created by this class object

Definition at line 235 of file class.h.

Referenced by AttachInstance(), DetachInstance(), and ~Class().


The documentation for this class was generated from the following files:
Generated on Thu Apr 6 15:49:50 2006 for rcssserver3d by  doxygen 1.4.4