Changes in src/Actions/ActionRegistry.cpp [d56640:cf1a07]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/ActionRegistry.cpp
rd56640 rcf1a07 9 9 #include "Actions/Action.hpp" 10 10 11 #include "Patterns/Singleton_impl.hpp"12 13 11 #include <string> 14 #include "Helpers/Assert.hpp"12 #include <cassert> 15 13 #include <iostream> 16 14 17 15 using namespace std; 16 17 ActionRegistry *ActionRegistry::theInstance=0; 18 18 19 19 ActionRegistry::ActionRegistry() … … 33 33 map<const string,Action*>::iterator iter; 34 34 iter = actionMap.find(name); 35 ASSERT(iter!=actionMap.end(),"Query for an action not stored in registry");35 assert(iter!=actionMap.end() && "Query for an action not stored in registry"); 36 36 return iter->second; 37 37 } … … 40 40 pair<map<const string,Action*>::iterator,bool> ret; 41 41 ret = actionMap.insert(pair<const string,Action*>(action->getName(),action)); 42 ASSERT(ret.second,"Two actions with the same name added to registry");42 assert(ret.second && "Two actions with the same name added to registry"); 43 43 } 44 44 45 CONSTRUCT_SINGLETON(ActionRegistry) 45 // singleton stuff 46 ActionRegistry* ActionRegistry::getRegistry(){ 47 if(!theInstance){ 48 theInstance = new ActionRegistry(); 49 } 50 return theInstance; 51 } 52 53 void ActionRegistry::purgeRegistry(){ 54 if(theInstance){ 55 delete theInstance; 56 theInstance = 0; 57 } 58 }
Note:
See TracChangeset
for help on using the changeset viewer.