X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fstructure%2Fcommands.hxx;h=0825ffd9fc58c3c97b966d3d498dd11892acd1a6;hb=f525a05be8be446f93b2ed386ab34c2e1efe5d61;hp=4ab28a09960a7c320bdb90f4b31efcc3f9bd7c75;hpb=d22640ef4e938b523bdc30cd83370977d30de856;p=simgear.git diff --git a/simgear/structure/commands.hxx b/simgear/structure/commands.hxx index 4ab28a09..0825ffd9 100644 --- a/simgear/structure/commands.hxx +++ b/simgear/structure/commands.hxx @@ -13,15 +13,17 @@ #include -#include STL_STRING +#include #include #include +#include + #include -SG_USING_STD(string); -SG_USING_STD(map); -SG_USING_STD(vector); +using std::string; +using std::map; +using std::vector; /** @@ -44,17 +46,15 @@ public: typedef bool (*command_t) (const SGPropertyNode * arg); - /** - * Default constructor. - */ - SGCommandMgr (); - - /** * Destructor. */ virtual ~SGCommandMgr (); + /** + * Implement the classical singleton. + */ + static SGCommandMgr* instance(); /** * Register a new command with the manager. @@ -99,11 +99,20 @@ public: */ virtual bool execute (const string &name, const SGPropertyNode * arg) const; +protected: + /** + * Default constructor. + */ + SGCommandMgr (); + + private: typedef map command_map; command_map _commands; + static OpenThreads::Mutex _instanceMutex; + }; #endif // __COMMANDS_HXX