Changeset 3366 for code/branches/resource/src/orxonox
- Timestamp:
- Jul 29, 2009, 10:27:10 PM (15 years ago)
- Location:
- code/branches/resource/src/orxonox
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/resource/src/orxonox/CameraManager.cc
r3346 r3366 42 42 namespace orxonox 43 43 { 44 CameraManager* CameraManager::singleton Ref_s = 0;44 CameraManager* CameraManager::singletonPtr_s = 0; 45 45 46 46 CameraManager::CameraManager(Ogre::Viewport* viewport) 47 47 : viewport_(viewport) 48 48 { 49 assert(singletonRef_s == 0);50 singletonRef_s = this;51 52 49 this->fallbackCamera_ = 0; 53 50 } … … 55 52 CameraManager::~CameraManager() 56 53 { 57 assert(singletonRef_s != 0);58 singletonRef_s = 0;59 60 54 if (this->fallbackCamera_) 61 55 this->fallbackCamera_->getSceneManager()->destroyCamera(this->fallbackCamera_); -
code/branches/resource/src/orxonox/CameraManager.h
r3196 r3366 41 41 #include <list> 42 42 #include "util/OgreForwardRefs.h" 43 #include "util/Singleton.h" 43 44 44 45 namespace orxonox 45 46 { 46 class _OrxonoxExport CameraManager 47 class _OrxonoxExport CameraManager : public Singleton<CameraManager> 47 48 { 49 friend class Singleton<CameraManager>; 48 50 public: 49 51 CameraManager(Ogre::Viewport* viewport); … … 57 59 void useCamera(Ogre::Camera* camera); 58 60 59 static CameraManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } 60 static CameraManager* getInstancePtr() { return singletonRef_s; } 61 static CameraManager* getInstancePtr() { return singletonPtr_s; } 61 62 62 63 private: … … 67 68 Ogre::Camera* fallbackCamera_; 68 69 69 static CameraManager* singleton Ref_s;70 static CameraManager* singletonPtr_s; 70 71 }; 71 72 } -
code/branches/resource/src/orxonox/LevelManager.cc
r3343 r3366 45 45 SetCommandLineArgument(level, "").shortcut("l").information("Default level file (overrides LevelManager::defaultLevelName_ configValue)"); 46 46 47 LevelManager* LevelManager::singleton Ref_s = 0;47 LevelManager* LevelManager::singletonPtr_s = 0; 48 48 49 49 LevelManager::LevelManager() 50 50 { 51 assert(singletonRef_s == 0);52 singletonRef_s = this;53 54 51 RegisterRootObject(LevelManager); 55 52 this->setConfigValues(); … … 64 61 LevelManager::~LevelManager() 65 62 { 66 assert(singletonRef_s != 0);67 singletonRef_s = 0;68 63 } 69 64 -
code/branches/resource/src/orxonox/LevelManager.h
r3339 r3366 35 35 #include <list> 36 36 #include <string> 37 38 #include "util/Singleton.h" 37 39 #include "core/OrxonoxClass.h" 38 40 … … 42 44 class _OrxonoxExport LevelManager 43 45 // tolua_end 44 : public OrxonoxClass46 : public Singleton<LevelManager>, public OrxonoxClass 45 47 { // tolua_export 48 friend class Singleton<LevelManager>; 46 49 public: 47 50 LevelManager(); … … 59 62 std::string getAvailableLevelListItem(unsigned int index) const; //tolua_export 60 63 61 static LevelManager* getInstancePtr() { return singleton Ref_s; }62 static LevelManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } // tolua_export64 static LevelManager* getInstancePtr() { return singletonPtr_s; } 65 static LevelManager& getInstance() { return Singleton<LevelManager>::getInstance(); } // tolua_export 63 66 64 67 private: … … 73 76 std::string defaultLevelName_; 74 77 75 static LevelManager* singleton Ref_s;78 static LevelManager* singletonPtr_s; 76 79 }; // tolua_export 77 80 } // tolua_export -
code/branches/resource/src/orxonox/PawnManager.cc
r3196 r3366 34 34 namespace orxonox 35 35 { 36 PawnManager* PawnManager::singleton Ref_s = 0;36 PawnManager* PawnManager::singletonPtr_s = 0; 37 37 38 38 PawnManager::PawnManager() 39 39 { 40 40 RegisterRootObject(PawnManager); 41 42 assert(PawnManager::singletonRef_s == 0);43 PawnManager::singletonRef_s = this;44 41 } 45 42 46 43 PawnManager::~PawnManager() 47 44 { 48 assert(PawnManager::singletonRef_s != 0);49 PawnManager::singletonRef_s = 0;50 45 } 51 46 52 47 void PawnManager::touch() 53 48 { 54 if (!PawnManager::singleton Ref_s)49 if (!PawnManager::singletonPtr_s) 55 50 new PawnManager(); 56 51 } -
code/branches/resource/src/orxonox/PawnManager.h
r3196 r3366 31 31 32 32 #include "OrxonoxPrereqs.h" 33 34 #include "util/Singleton.h" 33 35 #include "interfaces/Tickable.h" 34 36 35 37 namespace orxonox 36 38 { 37 class _OrxonoxExport PawnManager : p ublic Tickable39 class _OrxonoxExport PawnManager : protected Singleton<PawnManager>, public Tickable 38 40 { 41 friend class Singleton<PawnManager>; 39 42 public: 40 43 static void touch(); … … 46 49 virtual ~PawnManager(); 47 50 48 static PawnManager* singleton Ref_s;51 static PawnManager* singletonPtr_s; 49 52 }; 50 53 } -
code/branches/resource/src/orxonox/PlayerManager.cc
r3297 r3366 37 37 namespace orxonox 38 38 { 39 PlayerManager* PlayerManager::singleton Ref_s = 0;39 PlayerManager* PlayerManager::singletonPtr_s = 0; 40 40 41 41 PlayerManager::PlayerManager() 42 42 { 43 43 RegisterRootObject(PlayerManager); 44 45 assert(singletonRef_s == 0);46 singletonRef_s = this;47 44 48 45 this->getConnectedClients(); … … 51 48 PlayerManager::~PlayerManager() 52 49 { 53 assert(singletonRef_s);54 singletonRef_s = 0;55 50 } 56 51 -
code/branches/resource/src/orxonox/PlayerManager.h
r3196 r3366 34 34 #include <cassert> 35 35 #include <map> 36 #include "util/Singleton.h" 36 37 #include "network/ClientConnectionListener.h" 37 38 38 39 namespace orxonox 39 40 { 40 class _OrxonoxExport PlayerManager : public ClientConnectionListener41 class _OrxonoxExport PlayerManager : public Singleton<PlayerManager>, public ClientConnectionListener 41 42 { 43 friend class Singleton<PlayerManager>; 42 44 public: 43 45 PlayerManager(); 44 46 virtual ~PlayerManager(); 45 46 inline static PlayerManager& getInstance()47 { assert(singletonRef_s); return *singletonRef_s; }48 47 49 48 PlayerInfo* getClient(unsigned int clientID) const; … … 57 56 std::map<unsigned int, PlayerInfo*> clients_; 58 57 59 static PlayerManager* singleton Ref_s;58 static PlayerManager* singletonPtr_s; 60 59 }; 61 60 } -
code/branches/resource/src/orxonox/objects/pickup/BaseItem.h
r3196 r3366 51 51 Daniel 'Huty' Haggenmueller 52 52 */ 53 class _OrxonoxExport BaseItem 54 // tolua_end 55 : public BaseObject 56 // tolua_begin 53 class _OrxonoxExport BaseItem : public BaseObject 57 54 { 58 55 // tolua_end -
code/branches/resource/src/orxonox/objects/pickup/PickupInventory.h
r3196 r3366 43 43 namespace orxonox 44 44 { 45 // tolua_end46 45 /** 47 46 @brief Static class for the inventory GUI window. 48 47 @author Daniel 'Huty' Haggenmueller 49 48 */ 50 // tolua_begin51 49 class _OrxonoxExport PickupInventory 52 50 { -
code/branches/resource/src/orxonox/objects/quest/QuestDescription.h
r3196 r3366 54 54 Damian 'Mozork' Frick 55 55 */ 56 class _OrxonoxExport QuestDescription 56 class _OrxonoxExport QuestDescription : public BaseObject 57 { 57 58 // tolua_end 58 : public BaseObject59 { // tolua_export60 59 public: 61 60 QuestDescription(BaseObject* creator); -
code/branches/resource/src/orxonox/objects/quest/QuestManager.cc
r3349 r3366 47 47 { 48 48 //! Pointer to the current (and single) instance of this class. 49 /*static*/ QuestManager* QuestManager::singleton Ref_s = NULL;49 /*static*/ QuestManager* QuestManager::singletonPtr_s = NULL; 50 50 51 51 /** … … 58 58 { 59 59 RegisterRootObject(QuestManager); 60 61 assert(singletonRef_s == 0);62 singletonRef_s = this;63 60 } 64 61 … … 70 67 { 71 68 72 }73 74 /**75 @brief76 Returns a reference to the current (and single) instance of the QuestManager, and creates one if there isn't one to begin with.77 @return78 Returns a reference to the single instance of the Quest Manager.79 */80 /*static*/ QuestManager & QuestManager::getInstance()81 {82 assert(singletonRef_s);83 return *singletonRef_s;84 69 } 85 70 -
code/branches/resource/src/orxonox/objects/quest/QuestManager.h
r3196 r3366 40 40 #include <map> 41 41 #include <string> 42 43 #include "util/Singleton.h" 42 44 #include "core/OrxonoxClass.h" 43 45 … … 71 73 Damian 'Mozork' Frick 72 74 */ 73 class _OrxonoxExport QuestManager 74 // tolua_end 75 : public OrxonoxClass 76 // tolua_begin 75 class _OrxonoxExport QuestManager : public Singleton<QuestManager>, public orxonox::OrxonoxClass 77 76 { 78 77 // tolua_end 78 friend class Singleton<QuestManager>; 79 79 public: 80 80 QuestManager(); 81 81 virtual ~QuestManager(); 82 82 83 static QuestManager& getInstance(); // tolua_export //!< Returns a reference to the single instance of the Quest Manager. 83 //! Returns a reference to the single instance of the Quest Manager. 84 static QuestManager& getInstance() { return Singleton<QuestManager>::getInstance(); } // tolua_export 84 85 85 86 bool registerQuest(Quest* quest); //!< Registers a Quest in the QuestManager. … … 92 93 93 94 private: 94 static QuestManager* singleton Ref_s;95 static QuestManager* singletonPtr_s; 95 96 96 97 std::map<std::string, Quest*> questMap_; //!< All Quests registered by their id's. -
code/branches/resource/src/orxonox/overlays/console/InGameConsole.cc
r3327 r3366 60 60 SetConsoleCommand(InGameConsole, closeConsole, true); 61 61 62 InGameConsole* InGameConsole::singleton Ref_s = 0;62 InGameConsole* InGameConsole::singletonPtr_s = 0; 63 63 64 64 /** … … 76 76 RegisterObject(InGameConsole); 77 77 78 assert(singletonRef_s == 0);79 singletonRef_s = this;80 81 78 this->bActive_ = false; 82 79 this->cursor_ = 0.0f; … … 131 128 if (this->consoleOverlay_) 132 129 Ogre::OverlayManager::getSingleton().destroy(consoleOverlay_); 133 134 singletonRef_s = 0;135 130 } 136 131 -
code/branches/resource/src/orxonox/overlays/console/InGameConsole.h
r3327 r3366 34 34 35 35 #include <string> 36 36 37 #include "util/OgreForwardRefs.h" 38 #include "util/Singleton.h" 37 39 #include "core/Shell.h" 38 40 #include "core/WindowEventListener.h" … … 40 42 namespace orxonox 41 43 { 42 class _OrxonoxExport InGameConsole : public S hellListener, public WindowEventListener44 class _OrxonoxExport InGameConsole : public Singleton<InGameConsole>, public ShellListener, public WindowEventListener 43 45 { 46 friend class Singleton<InGameConsole>; 44 47 public: // functions 45 48 InGameConsole(); … … 51 54 52 55 void update(const Clock& time); 53 54 static InGameConsole& getInstance() { assert(singletonRef_s); return *singletonRef_s; }55 static InGameConsole* getInstancePtr() { return singletonRef_s; }56 56 57 57 static void openConsole(); … … 112 112 bool bHidesAllInput_; 113 113 114 static InGameConsole* singleton Ref_s;114 static InGameConsole* singletonPtr_s; 115 115 }; 116 116 } -
code/branches/resource/src/orxonox/overlays/notifications/NotificationManager.cc
r3196 r3366 46 46 const std::string NotificationManager::NONE = "none"; 47 47 48 NotificationManager* NotificationManager::singleton Ref_s = NULL;48 NotificationManager* NotificationManager::singletonPtr_s = NULL; 49 49 50 50 /** … … 55 55 { 56 56 RegisterRootObject(NotificationManager); 57 58 assert(singletonRef_s == 0);59 singletonRef_s = this;60 57 61 58 this->highestIndex_ = 0; … … 70 67 } 71 68 72 /**73 @brief74 Returns the current (and single) instance of the NotificationManager. Creates one, if there isn't one to begin with.75 @return76 Returns a reference to the single instance of the NotificationManager.77 */78 /*static*/ NotificationManager & NotificationManager::getInstance()79 {80 assert(singletonRef_s);81 return *singletonRef_s;82 }83 84 69 /** 85 70 @brief -
code/branches/resource/src/orxonox/overlays/notifications/NotificationManager.h
r3196 r3366 40 40 #include <map> 41 41 #include <string> 42 43 #include "util/Singleton.h" 42 44 #include "core/OrxonoxClass.h" 43 45 … … 52 54 Damian 'Mozork' Frick 53 55 */ 54 class _OrxonoxExport NotificationManager : public OrxonoxClass56 class _OrxonoxExport NotificationManager : public Singleton<NotificationManager>, public OrxonoxClass 55 57 { 58 friend class Singleton<NotificationManager>; 56 59 public: 57 60 NotificationManager(); … … 60 63 static const std::string ALL; 61 64 static const std::string NONE; 62 63 static NotificationManager & getInstance(); //! Returns a reference to the single instance of the NotificationManager.64 65 65 66 bool registerNotification(Notification* notification); //!< Registers a Notification within the NotificationManager. … … 88 89 89 90 private: 90 static NotificationManager* singleton Ref_s;91 static NotificationManager* singletonPtr_s; 91 92 92 93 int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that no key appears twice. -
code/branches/resource/src/orxonox/sound/SoundManager.cc
r3342 r3366 38 38 namespace orxonox 39 39 { 40 SoundManager* SoundManager::singleton Ref_s = NULL;40 SoundManager* SoundManager::singletonPtr_s = NULL; 41 41 42 42 /** … … 45 45 SoundManager::SoundManager() 46 46 { 47 assert(singletonRef_s == NULL);48 singletonRef_s = this;49 50 47 this->device_ = NULL; 51 48 this->soundavailable_ = true; … … 93 90 SoundManager::~SoundManager() 94 91 { 95 assert(singletonRef_s != NULL);96 singletonRef_s = NULL;97 98 92 alcDestroyContext(this->context_); 99 93 alcCloseDevice(this->device_); -
code/branches/resource/src/orxonox/sound/SoundManager.h
r3280 r3366 32 32 #include <cassert> 33 33 #include <list> 34 #include "util/Singleton.h" 34 35 #include "interfaces/Tickable.h" 35 36 … … 42 43 * 43 44 */ 44 class _OrxonoxExport SoundManager : public Tickable45 class _OrxonoxExport SoundManager : public Singleton<SoundManager>, public Tickable 45 46 { 47 friend class Singleton<SoundManager>; 46 48 public: 47 49 SoundManager(); … … 52 54 bool isSoundAvailable(); 53 55 54 static SoundManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }55 56 56 private: 57 57 ALCdevice* device_; … … 60 60 bool soundavailable_; 61 61 62 static SoundManager* singleton Ref_s;62 static SoundManager* singletonPtr_s; 63 63 }; // class SoundManager 64 64 } // namespace orxonox
Note: See TracChangeset
for help on using the changeset viewer.