#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;
+ };
};
/**
void eval(bool& value, const expression::Binding* b) const
{
value = false;
- for (int i = 0; i < getNumOperands(); ++i) {
+ for (int i = 0; i < (int)getNumOperands(); ++i) {
value = value || getOperand(i)->getValue(b);
if (value)
return;
void eval(bool& value, const expression::Binding* b) const
{
value = true;
- for (int i = 0; i < getNumOperands(); ++i) {
+ for (int i = 0; i < (int)getNumOperands(); ++i) {
value = value && getOperand(i)->getValue(b);
if (!value)
return;