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

IRoot.h

Go to the documentation of this file.
00001 // mortic - A game engine for the Expanses of Naryan.
00002 // Copyright (C) 2007  Aaron Griffith
00003 // This file is under the LGPL. See mortic.h for more information.
00004 
00006 //  _____             _                                                       //
00007 // |  __ \           | |                                                      //
00008 // | |__) |___   ___ | |_                                                     //
00009 // |  _  // _ \ / _ \| __|                                                    //
00010 // | | \ \ (_) | (_) | |_                                                     //
00011 // |_|  \_\___/ \___/ \__|                                                    //
00012 //                                                                            //
00013 //                                                                            //
00014 // IRoot.h - Interface of Root                                                //
00016 
00017 #ifndef __IRoot_h_INCLUDED__
00018 #define __IRoot_h_INCLUDED__
00019 
00020 #include <string>
00021 #include <vector>
00022 #include "IObject.h"
00023 
00024 namespace mortic
00025 {
00026         class IRoot;
00027         class IConfigManager;
00028         class IConfigSet;
00029         class IFileManager;
00030         class IMountable;
00031         class IEventManager; // Still awaiting review
00032         class IEvent; // Still awaiting review
00033         class ILogManager;
00034         class ISceneManager; // Still awaiting review
00035         class IVideoManager; // Still awaiting review
00036         class IScriptManager;
00037         
00039     
00043     enum EManagerType
00044     {
00046         EMT_ROOT,
00047 
00049         EMT_CONFIGMANAGER,
00050 
00052         EMT_FILEMANAGER,
00053 
00055         EMT_EVENTMANAGER,
00056 
00058         EMT_LOGMANAGER,
00060         EMT_LOGMANAGERFILE,
00061 
00063         EMT_SCENEMANAGER,
00065         EMT_SCENEEND,
00066 
00068         EMT_VIDEOMANAGER,
00069 
00071         EMT_SCRIPTMANAGER,
00072 
00074         EMT_COUNT
00075     };
00076 };
00077 
00078 #include "utilities.h"
00079 #include "IConfigManager.h"
00080 #include "IFileManager.h"
00081 #include "IEventManager.h"
00082 #include "ILogManager.h"
00083 #include "ISceneManager.h"
00084 #include "IVideoManager.h"
00085 #include "IScriptManager.h"
00086 
00087 namespace mortic
00088 {
00090     
00098     class IRoot
00099     {
00100     public:
00102         IRoot()
00103         { }
00105         virtual ~IRoot()
00106         { }
00107 
00109         
00113         virtual void addObject(IObject* o) = 0;
00114         
00116         
00120         virtual void removeObject(IObject* o) = 0;
00121         
00123         
00127         virtual void removeObject(unsigned int id) = 0;
00128 
00130         
00135         virtual IObject* getObject(unsigned int id) = 0;
00136         
00138         
00145         virtual IObject* getObject(enum EManagerType id) = 0;
00146         
00148         
00153         virtual std::vector<IObject*> getObjects(std::string name) = 0;
00154         
00156         
00160         template<class T> T* getObjectCast(unsigned int id)
00161         {
00162             return static_cast<T*>(getObject(id));
00163         }
00164         
00166         
00170         template<class T> T* getObjectCast(enum EManagerType id)
00171         {
00172             return static_cast<T*>(getObject(id));
00173         }
00174         
00176         
00182         virtual unsigned int newID() = 0;
00183         
00185         
00190         virtual void returnID(unsigned int id) = 0;
00191         
00193         
00198         virtual void shutdown() = 0;
00199         
00201         
00211         virtual bool run() = 0;
00212         
00214         
00219         virtual bool isRunning() = 0;
00220         
00222         
00253         virtual std::string getVersion() = 0;
00254 
00255         // Convenience
00256         
00258         
00263         IConfigManager* getConfigManager()
00264         {
00265                 return getObjectCast<IConfigManager>(EMT_CONFIGMANAGER);
00266         }
00267         
00269         
00274         IFileManager* getFileManager()
00275         {
00276                 return getObjectCast<IFileManager>(EMT_FILEMANAGER);
00277         }
00278         
00280         
00285         ILogManager* getLogManager()
00286         {
00287                 return getObjectCast<ILogManager>(EMT_LOGMANAGER);
00288         }
00289         
00291         
00296         ISceneManager* getSceneManager()
00297         {
00298                 return getObjectCast<ISceneManager>(EMT_SCENEMANAGER);
00299         }
00300         
00302         
00307         IVideoManager* getVideoManager()
00308         {
00309                 return getObjectCast<IVideoManager>(EMT_VIDEOMANAGER);
00310         }
00311         
00313         
00318         IEventManager* getEventManager()
00319         {
00320                 return getObjectCast<IEventManager>(EMT_EVENTMANAGER);
00321         }
00322         
00324         
00329         IScriptManager* getScriptManager()
00330         {
00331                 return getObjectCast<IScriptManager>(EMT_SCRIPTMANAGER);
00332         }
00333     };
00334         
00336         
00344     IRoot* createRoot(std::string configFilename = "settings.xml",
00345                                   IConfigSet* defaults = NULL, IConfigSet* overrides = NULL);
00346     
00348     
00353     void destroyRoot(IRoot* root);
00354     
00356     
00361     IRoot* getLastRoot();
00362 
00363 }; // namespace mortic
00364 
00365 #ifdef SWIG
00366 #ifndef SWIGINTERN
00367 %template(ObjectList) std::vector<mortic::IObject*>;
00368 %template(getObjectConfigManager) mortic::IRoot::getObjectCast<mortic::IConfigManager>;
00369 %template(getObjectFileManager) mortic::IRoot::getObjectCast<mortic::IFileManager>;
00370 %template(getObjectFile) mortic::IRoot::getObjectCast<mortic::IFile>;
00371 %template(getObjectEventManager) mortic::IRoot::getObjectCast<mortic::IEventManager>;
00372 %template(getObjectEvent) mortic::IRoot::getObjectCast<mortic::IEvent>;
00373 %template(getObjectLogManager) mortic::IRoot::getObjectCast<mortic::ILogManager>;
00374 %template(getObjectSceneManager) mortic::IRoot::getObjectCast<mortic::ISceneManager>;
00375 %template(getObjectScene) mortic::IRoot::getObjectCast<mortic::IScene>;
00376 %template(getObjectVideoManager) mortic::IRoot::getObjectCast<mortic::IVideoManager>;
00377 %template(getObjectScriptManager) mortic::IRoot::getObjectCast<mortic::IScriptManager>;
00378 %template(getObjectScript) mortic::IRoot::getObjectCast<mortic::IScript>;
00379 #endif // SWIGINTERN
00380 #endif // SWIG
00381 
00382 #endif // __IRoot_h_INCLUDED__

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