#include <core.h>
Public Member Functions | |
Core () | |
Create the fundamental classes needed for the hierarchy to operate. | |
~Core () | |
void | Construct (const boost::weak_ptr< Core > &self) |
Constructs the core, i.e. | |
void | Desctruct () |
Destructs the core, i.e. | |
boost::shared_ptr< CoreContext > | CreateContext () |
creates a context for this Core | |
boost::shared_ptr< Object > | New (const std::string &className) |
creates an instance of the class 'className' | |
bool | ExistsClass (const std::string &className) |
returns true iff the given class exists | |
bool | RegisterClassObject (const boost::shared_ptr< Class > &classObject, const std::string &subDir) |
registers a class object | |
bool | RegisterClassObject (Class *classObject, const std::string &subDir) |
registers a class object | |
bool | ImportBundle (const std::string &bundleName) |
imports a bundle, i.e. | |
const boost::shared_ptr< FileServer > & | GetFileServer () const |
returns a reference to the FileServer | |
const boost::shared_ptr< LogServer > & | GetLogServer () const |
returns a reference to the LogServer | |
const boost::shared_ptr< ScriptServer > & | GetScriptServer () const |
returns a reference to the ScriptServer | |
boost::shared_ptr< Leaf > | GetRoot () const |
returns a reference to the root node | |
boost::shared_ptr< Leaf > | Get (const std::string &pathStr) |
returns a reference to the object denoted by the path expression 'pathStr'. | |
boost::shared_ptr< Leaf > | Get (const std::string &pathStr, const boost::shared_ptr< Leaf > &base) |
returns a reference to the object denoted by the path expression 'pathStr', relative to the node base. | |
bool | Test (const std::string &pathStr, const boost::shared_ptr< Leaf > &base) |
returns true iff the object denoted by the path expression 'pathStr', relative to the node base exists | |
bool | Test (const std::string &pathStr) |
returns true iff the object denoted by the path expression 'pathStr' exists. | |
boost::shared_ptr< Leaf > | GetChild (const boost::shared_ptr< Leaf > &parent, const std::string &childName) |
returns a reference to a child node of 'parent' with the name 'childName' | |
void | BindClass (const boost::shared_ptr< Class > &newClass) const |
attaches the class 'newClass' to this core | |
void | GarbageCollectBundles () |
releases all unused bundles, i.e. | |
Protected Types | |
typedef std::map< CacheKey, boost::weak_ptr< Leaf > > | TPathCache |
TPathCache defines a mapping from a CacheKey to a weak reference of the corresponding Leaf. | |
Protected Member Functions | |
boost::shared_ptr< Leaf > | GetInternal (const std::string &pathStr, const boost::shared_ptr< Leaf > &base) |
returns a reference to the object denoted by the path expression 'pathStr', relative to the node base. | |
Private Attributes | |
boost::shared_ptr< Leaf > | mRoot |
a reference to the root node | |
boost::shared_ptr< Class > | mNodeClass |
a reference to the class object of the node class | |
boost::shared_ptr< Class > | mClassClass |
a reference to the class object of the 'class' class | |
boost::shared_ptr< FileServer > | mFileServer |
a reference to the file server | |
boost::shared_ptr< LogServer > | mLogServer |
a reference to the logserver | |
boost::shared_ptr< ScriptServer > | mScriptServer |
a reference to the scriptserver | |
boost::shared_ptr< RandomServer > | mRandomServer |
a reference to the randomserver | |
boost::weak_ptr< Core > | mSelf |
a reference to the core, a smart this pointer | |
std::list< boost::shared_ptr< salt::SharedLibrary > > | mBundles |
a list of all registered bundles. | |
TPathCache | mPathCache |
the internal node lookup cache | |
Classes | |
struct | CacheKey |
CacheKey is a struct used as the key for the internal node lookup cache. More... |
it creates the root node, some basic class objects and installs fundamental server classes needed to run zeitgeist system. Further it provides a mechanism to import bundles- plugins containg new classes, that can be registered to the framework at runtime.
Definition at line 55 of file core.h.
|
TPathCache defines a mapping from a CacheKey to a weak reference of the corresponding Leaf.
|
|
Create the fundamental classes needed for the hierarchy to operate.
Definition at line 90 of file core.cpp. References CLASS, and mClassClass. |
|
Definition at line 96 of file core.cpp. References mBundles. |
|
attaches the class 'newClass' to this core
Definition at line 382 of file core.cpp. References mClassClass, and mSelf. Referenced by Construct(), and RegisterClassObject(). |
|
Constructs the core, i.e. sets up the root object, registers some class objects for internal zeitgeist classes and creates servers for the basic services Definition at line 101 of file core.cpp. References BindClass(), CLASS, CreateContext(), zeitgeist::LogServer::eError, zeitgeist::LogServer::eNormal, zeitgeist::LogServer::eWarning, mClassClass, mFileServer, mLogServer, mNodeClass, mRandomServer, mRoot, mScriptServer, mSelf, and RegisterClassObject(). Here is the call graph for this function: ![]() |
|
creates a context for this Core
Definition at line 164 of file core.cpp. References GetRoot(), and mSelf. Referenced by Construct(), New(), and RegisterClassObject(). Here is the call graph for this function: ![]() |
|
Destructs the core, i.e. unlinks the hierarchy below the root object Definition at line 150 of file core.cpp. References mClassClass, mFileServer, mLogServer, mNodeClass, mRandomServer, mRoot, and mScriptServer. |
|
returns true iff the given class exists
Definition at line 193 of file core.cpp. References Test(). Here is the call graph for this function: ![]() |
|
releases all unused bundles, i.e. bundles the core holds the only reference to Definition at line 397 of file core.cpp. References mBundles. |
|
returns a reference to the object denoted by the path expression 'pathStr', relative to the node base.
Definition at line 331 of file core.cpp. References GetInternal(), and mLogServer. Here is the call graph for this function: ![]() |
|
returns a reference to the object denoted by the path expression 'pathStr'.
Definition at line 326 of file core.cpp. References mRoot. |
|
returns a reference to a child node of 'parent' with the name 'childName'
Definition at line 357 of file core.cpp. References mNodeClass. |
|
returns a reference to the FileServer
Definition at line 257 of file core.cpp. References mFileServer. |
|
returns a reference to the object denoted by the path expression 'pathStr', relative to the node base.
Definition at line 272 of file core.cpp. References salt::Path::Front(), salt::Path::IsAbsolute(), salt::Path::IsEmpty(), mPathCache, mRoot, and salt::Path::PopFront(). Referenced by Get(), and Test(). Here is the call graph for this function: ![]() |
|
returns a reference to the LogServer
Definition at line 262 of file core.cpp. References mLogServer. |
|
returns a reference to the root node
Definition at line 141 of file core.h. References mRoot. Referenced by CreateContext(). |
|
returns a reference to the ScriptServer
Definition at line 267 of file core.cpp. References mScriptServer. |
|
imports a bundle, i.e. registers classes contained inside a plugin to the framework.
Definition at line 212 of file core.cpp. References mBundles, mLogServer, and RegisterClassObject(). Here is the call graph for this function: ![]() |
|
creates an instance of the class 'className'
Definition at line 170 of file core.cpp. References CreateContext(), and mLogServer. Here is the call graph for this function: ![]() |
|
registers a class object
Definition at line 207 of file core.cpp. References RegisterClassObject(). Here is the call graph for this function: ![]() |
|
registers a class object
Definition at line 198 of file core.cpp. References BindClass(), and CreateContext(). Referenced by Construct(), ImportBundle(), and RegisterClassObject(). Here is the call graph for this function: ![]() |
|
returns true iff the object denoted by the path expression 'pathStr' exists.
Definition at line 345 of file core.cpp. Here is the call graph for this function: ![]() |
|
returns true iff the object denoted by the path expression 'pathStr', relative to the node base exists
Definition at line 350 of file core.cpp. References GetInternal(). Referenced by ExistsClass(), and Test(). Here is the call graph for this function: ![]() |
|
a list of all registered bundles. Whenever we load a bundle, we add it to this list. This is necessary, because we have to keep the connection to each bundle open, until all the class objects belonging to it are completely destructed. This workaround is very ugly ... it cost me about 3-4 hours of debugging to get this to work. Somehow, when I destroyed a class belonging to a bundle, it prevented the rest of the hierarchy deletion from working ... ouch. I have no idea, why this happened. Now, when I keep the bundles (DLLs,SOs) open for a while longer, then everything is nice and dandy. NOTE: I had this first as a member of Core, but I can't control the order in which the members are released and I would have to guarantee that gBundles gets deleted AFTER mRoot. Switching the order the variables are defined would probably take care of that, but sounds quite unportable, so I went with this option (making it global). I have added a 'GarbageCollectBundles' function, which erases 'unique' references. WARNING: Just making this global is (apparently) not enough. Definition at line 238 of file core.h. Referenced by GarbageCollectBundles(), ImportBundle(), and ~Core(). |
|
a reference to the class object of the 'class' class
Definition at line 195 of file core.h. Referenced by BindClass(), Construct(), Core(), and Desctruct(). |
|
a reference to the file server
Definition at line 198 of file core.h. Referenced by Construct(), Desctruct(), and GetFileServer(). |
|
a reference to the logserver
Definition at line 201 of file core.h. Referenced by Construct(), Desctruct(), Get(), GetLogServer(), ImportBundle(), and New(). |
|
a reference to the class object of the node class
Definition at line 192 of file core.h. Referenced by Construct(), Desctruct(), and GetChild(). |
|
the internal node lookup cache
Definition at line 241 of file core.h. Referenced by GetInternal(). |
|
a reference to the randomserver
Definition at line 207 of file core.h. Referenced by Construct(), and Desctruct(). |
|
a reference to the root node
Definition at line 189 of file core.h. Referenced by Construct(), Desctruct(), Get(), GetInternal(), GetRoot(), and Test(). |
|
a reference to the scriptserver
Definition at line 204 of file core.h. Referenced by Construct(), Desctruct(), and GetScriptServer(). |
|
a reference to the core, a smart this pointer
Definition at line 210 of file core.h. Referenced by BindClass(), Construct(), and CreateContext(). |