return true;
}
-Parser::ParserMap ExpressionParser::_parserTable;
-
void ExpressionParser::addExpParser(const string& token, exp_parser parsefn)
{
- _parserTable.insert(std::make_pair(token, parsefn));
+ ParserMapSingleton::instance()
+ ->_parserTable.insert(std::make_pair(token, parsefn));
}
Expression* valueParser(const SGPropertyNode* exp, Parser* parser)
#include <simgear/math/SGMath.hxx>
#include <simgear/scene/model/persparam.hxx>
#include <simgear/structure/exception.hxx>
+#include <simgear/structure/Singleton.hxx>
/// Expression tree implementation.
class ExpressionParser : public Parser
{
public:
- ParserMap& getParserMap() { return _parserTable; }
+ ParserMap& getParserMap()
+ {
+ return ParserMapSingleton::instance()->_parserTable;
+ }
static void addExpParser(const std::string&, exp_parser);
protected:
- static ParserMap _parserTable;
+ struct ParserMapSingleton : public simgear::Singleton<ParserMapSingleton>
+ {
+ ParserMap _parserTable;
+ };
};
/**