Changeset 8a4f12 for molecuilder/src/Actions
- Timestamp:
- Mar 11, 2010, 2:08:44 PM (16 years ago)
- Children:
- c3f8c4
- Parents:
- abab7e
- Location:
- molecuilder/src/Actions
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/Actions/Action.cpp
rabab7e r8a4f12 17 17 { 18 18 if(_doRegister){ 19 ActionRegistry::get Registry()->registerAction(this);19 ActionRegistry::getInstance().registerAction(this); 20 20 } 21 21 } -
molecuilder/src/Actions/ActionRegistry.cpp
rabab7e r8a4f12 9 9 #include "Actions/Action.hpp" 10 10 11 #include "Patterns/Singleton_impl.hpp" 12 11 13 #include <string> 12 14 #include <cassert> … … 14 16 15 17 using namespace std; 16 17 ActionRegistry *ActionRegistry::theInstance=0;18 18 19 19 ActionRegistry::ActionRegistry() … … 43 43 } 44 44 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 } 45 CONSTRUCT_SINGLETON(ActionRegistry) -
molecuilder/src/Actions/ActionRegistry.hpp
rabab7e r8a4f12 12 12 #include <map> 13 13 14 #include "Patterns/Singleton.hpp" 15 14 16 class Action; 15 17 16 class ActionRegistry 18 class ActionRegistry : public Singleton<ActionRegistry> 17 19 { 20 friend class Singleton<ActionRegistry>; 18 21 public: 19 22 Action* getActionByName(const std::string); … … 23 26 std::map<const std::string,Action*> actionMap; 24 27 25 // singleton stuff26 public:27 static ActionRegistry* getRegistry();28 static void purgeRegistry();29 28 private: 30 29 ActionRegistry(); 31 30 virtual ~ActionRegistry(); 32 static ActionRegistry *theInstance;33 31 }; 34 32
Note:
See TracChangeset
for help on using the changeset viewer.