Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

mortic::IRoot Class Reference

The root class, which manages all objects. More...

List of all members.

Public Member Functions

 IRoot ()
 Constructor.
virtual ~IRoot ()
 Destructor.
virtual void addObject (IObject *o)=0
 Adds an object to the root.
virtual void removeObject (IObject *o)=0
 Remove an object from the root.
virtual void removeObject (unsigned int id)=0
 Remove an object from the root.
virtual IObjectgetObject (unsigned int id)=0
 Get an object by id.
virtual IObjectgetObject (enum EManagerType id)=0
 Get an object by enumeration.
virtual std::vector< IObject * > getObjects (std::string name)=0
 Get a group of objects.
template<class T>
T * getObjectCast (unsigned int id)
 Get a recast object.
template<class T>
T * getObjectCast (enum EManagerType id)
 Get a recast object.
virtual unsigned int newID ()=0
 Register and reserve a new ID.
virtual void returnID (unsigned int id)=0
 Return a reserved ID to the pool.
virtual void shutdown ()=0
 Shutdown the engine.
virtual bool run ()=0
 Runs the engine and checks if it wants to continue.
virtual bool isRunning ()=0
 Checks if the engine is running.
virtual std::string getVersion ()=0
 Returns the Mortic Version Number.
IConfigManagergetConfigManager ()
 Gets the Configuration Manager.
IFileManagergetFileManager ()
 Gets the File Manager.
ILogManagergetLogManager ()
 Gets the Log Manager.
ISceneManagergetSceneManager ()
 Gets the Scene Manager.
IVideoManagergetVideoManager ()
 Gets the Video Manager.
IEventManagergetEventManager ()
 Gets the Event Manager.
IScriptManagergetScriptManager ()
 Gets the Script Manager.


Detailed Description

The root class, which manages all objects.

This is what keeps track of all of the mortic objects that are instanced. With this class, you can get any one of those objects by ID, or a group of them by name. The root class is what you create in the beginning, run in the middle, and destroy in the end. All programs need one. This class also allows easy access to special objects that manage certain aspects of a game, like IVideoManager or IScriptManager.

See also:
IObject

Definition at line 98 of file IRoot.h.


Constructor & Destructor Documentation

mortic::IRoot::IRoot  )  [inline]
 

Constructor.

Definition at line 102 of file IRoot.h.

virtual mortic::IRoot::~IRoot  )  [inline, virtual]
 

Destructor.

Definition at line 105 of file IRoot.h.


Member Function Documentation

virtual void mortic::IRoot::addObject IObject o  )  [pure virtual]
 

Adds an object to the root.

This function is only used internally. Every object is automatically added to the root.

  • o - a pointer to the object to add

IConfigManager* mortic::IRoot::getConfigManager  )  [inline]
 

Gets the Configuration Manager.

This is a convenience function, it just calls getObject() with an appropriate value.

Returns:
the configuration manager
See also:
getObject() IConfigManager

Definition at line 263 of file IRoot.h.

References mortic::EMT_CONFIGMANAGER.

IEventManager* mortic::IRoot::getEventManager  )  [inline]
 

Gets the Event Manager.

This is a convenience function, it just calls getObject() with an appropriate value.

Returns:
the event manager
See also:
getObject() IEventManager

Definition at line 318 of file IRoot.h.

References mortic::EMT_EVENTMANAGER.

IFileManager* mortic::IRoot::getFileManager  )  [inline]
 

Gets the File Manager.

This is a convenience function, it just calls getObject() with an appropriate value.

Returns:
the file manager
See also:
getObject() IFileManager

Definition at line 274 of file IRoot.h.

References mortic::EMT_FILEMANAGER.

ILogManager* mortic::IRoot::getLogManager  )  [inline]
 

Gets the Log Manager.

This is a convenience function, it just calls getObject() with an appropriate value.

Returns:
the log manager
See also:
getObject() ILogManager

Definition at line 285 of file IRoot.h.

References mortic::EMT_LOGMANAGER.

virtual IObject* mortic::IRoot::getObject enum EManagerType  id  )  [pure virtual]
 

Get an object by enumeration.

This function gets an object based on an EManagerType value. This is preferred for any object that is listed in this enumeration, because it is more portable.

  • id - the enumeration value of the object to get
    Returns:
    the object with the id asked for
    See also:
    EManagerType

virtual IObject* mortic::IRoot::getObject unsigned int  id  )  [pure virtual]
 

Get an object by id.

This function retreives an object by id. If the id is not assigned returns NULL.

  • id - the id of the object to get
    Returns:
    the object with the given id, or NULL if no object is found

Referenced by getObjectCast().

template<class T>
T* mortic::IRoot::getObjectCast enum EManagerType  id  )  [inline]
 

Get a recast object.

This function is exactly the same as getObject, except it casts the object for you based on the template using static_cast.

See also:
getObject(enum EManagerType id)

Definition at line 170 of file IRoot.h.

References getObject().

template<class T>
T* mortic::IRoot::getObjectCast unsigned int  id  )  [inline]
 

Get a recast object.

This function is exactly the same as getObject, except it casts the object for you based on the template using static_cast.

See also:
getObject(unsigned int id)

Definition at line 160 of file IRoot.h.

References getObject().

virtual std::vector<IObject*> mortic::IRoot::getObjects std::string  name  )  [pure virtual]
 

Get a group of objects.

This function returns a list of all objects with the given name. Names are not unique, so expect multiple results.

  • name - the name to search for
    Returns:
    a list of objects with the given name

ISceneManager* mortic::IRoot::getSceneManager  )  [inline]
 

Gets the Scene Manager.

This is a convenience function, it just calls getObject() with an appropriate value.

Returns:
the scene manager
See also:
getObject() ISceneManager

Definition at line 296 of file IRoot.h.

References mortic::EMT_SCENEMANAGER.

IScriptManager* mortic::IRoot::getScriptManager  )  [inline]
 

Gets the Script Manager.

This is a convenience function, it just calls getObject() with an appropriate value.

Returns:
the script manager
See also:
getObject() IScriptManager

Definition at line 329 of file IRoot.h.

References mortic::EMT_SCRIPTMANAGER.

virtual std::string mortic::IRoot::getVersion  )  [pure virtual]
 

Returns the Mortic Version Number.

The code of this function has a solid explanation of what a MVN is:

             Some info on Mortic Revision Numbers:
            
               Each number contains Mortic, a revision number, and the release name.
               The Revision number is in the form a.b.c, where a is the rewrite
               number, b is the major release number, and c is the bugfix release
               number. The name is specific to the major release number, except in
               the 0.b phase (development). When mortic is branched to be made specific
               to a game, a branch ID is added. So, an example is this:
            
               Mortic 1.2.1 [Necropolis] EXN 1.2
            
               This tells us:
            
 This is mortic
 This is version 1.2.1
 The version name is Necropolis
 This has been branched
 The three-letter branch code is EXN (for Expanses of Naryan)
 The EXN-specific version number is 1.2
            
               Branch-specific versions can be numbered whatever way suits you. After
               a branch, the Mortic version is not to be changed unless you rewrite
               with a newer version. Note: Odd major release numbers are usually
               development.
All MVNs must be unique.
Returns:
the mortic version number

IVideoManager* mortic::IRoot::getVideoManager  )  [inline]
 

Gets the Video Manager.

This is a convenience function, it just calls getObject() with an appropriate value.

Returns:
the video manager
See also:
getObject() IVideoManager

Definition at line 307 of file IRoot.h.

References mortic::EMT_VIDEOMANAGER.

virtual bool mortic::IRoot::isRunning  )  [pure virtual]
 

Checks if the engine is running.

Returns whether or not the engine is running. This is basically a run() that doesn't update anything.

Returns:
true if the engine is running, false if not
See also:
run()

virtual unsigned int mortic::IRoot::newID  )  [pure virtual]
 

Register and reserve a new ID.

This function is only used internally, and should be used otherwise with extreme caution. This function reserves an ID for use. Return it to the pool with returnID().

Returns:
the reserved ID, ready to use
See also:
returnID()

virtual void mortic::IRoot::removeObject unsigned int  id  )  [pure virtual]
 

Remove an object from the root.

This function is only used internally. Every object is automatically removed from the root when it is destroyed.

  • id - the id of the object to remove

virtual void mortic::IRoot::removeObject IObject o  )  [pure virtual]
 

Remove an object from the root.

This function is only used internally. Every object is automatically removed from the root when it is destroyed.

  • o - a pointer to the object to remove

virtual void mortic::IRoot::returnID unsigned int  id  )  [pure virtual]
 

Return a reserved ID to the pool.

This function returns an ID reserved with newID() and lets other objects use it. Once again, internal use only, use with extreme caution.

  • id - the ID to return to the pool
    See also:
    newID()

virtual bool mortic::IRoot::run  )  [pure virtual]
 

Runs the engine and checks if it wants to continue.

This function runs through one frame of the engine. It also returns true while the engine is running. It is meant to be used in a while loop, like so:

            while (root->run());
This loop will stop calling run every cycle as soon as it returns false, which means the engine wants to stop.
Returns:
true if the engine is running, false if it wants to stop
See also:
isRunning()

virtual void mortic::IRoot::shutdown  )  [pure virtual]
 

Shutdown the engine.

This function shuts down the engine. However, do not use this because it does not let scenes clean up properly. Only use if you must exit at this very moment. In most cases use SceneEnd and the Scene Manager.

See also:
ISceneManager EManagerType


Generated on Sat Dec 30 21:21:59 2006 for mortic by  doxygen 1.4.4