#include <simgear/compiler.h>
-#include STL_STRING
+#include <string>
#include <map>
#include <vector>
+#include <OpenThreads/Mutex>
+
#include <simgear/props/props.hxx>
-SG_USING_STD(string);
-SG_USING_STD(map);
-SG_USING_STD(vector);
+using std::string;
+using std::map;
+using std::vector;
/**
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.
*/
virtual bool execute (const string &name, const SGPropertyNode * arg) const;
+protected:
+ /**
+ * Default constructor.
+ */
+ SGCommandMgr ();
+
+
private:
typedef map<string,command_t> command_map;
command_map _commands;
+ static OpenThreads::Mutex _instanceMutex;
+
};
#endif // __COMMANDS_HXX