+#include <simgear/structure/SGExpression.hxx>
+
+using std::istream;
+using std::ostream;
+using std::string;
+
+/**
+ * Condition for a single property.
+ *
+ * This condition is true only if the property returns a boolean
+ * true value.
+ */
+class SGPropertyCondition : public SGCondition
+{
+public:
+ SGPropertyCondition ( SGPropertyNode *prop_root,
+ const char * propname );
+ virtual ~SGPropertyCondition ();
+ virtual bool test () const { return _node->getBoolValue(); }
+ virtual void collectDependentProperties(std::set<const SGPropertyNode*>& props) const
+ { props.insert(_node.get()); }
+private:
+ SGConstPropertyNode_ptr _node;
+};
+
+/**
+ * Condition with constant value
+ *
+ */
+class SGConstantCondition : public SGCondition
+{
+public:
+ SGConstantCondition (bool v) : _value(v) { ; }
+ virtual bool test () const { return _value; }
+private:
+ bool _value;
+};
+
+/**
+ * Condition for a 'not' operator.
+ *
+ * This condition is true only if the child condition is false.
+ */
+class SGNotCondition : public SGCondition
+{
+public:
+ SGNotCondition (SGCondition * condition);
+ virtual ~SGNotCondition ();
+ virtual bool test () const;
+ virtual void collectDependentProperties(std::set<const SGPropertyNode*>& props) const;
+private:
+ SGConditionRef _condition;
+};
+
+
+/**
+ * Condition for an 'and' group.
+ *
+ * This condition is true only if all of the conditions
+ * in the group are true.
+ */
+class SGAndCondition : public SGCondition
+{
+public:
+ SGAndCondition ();
+ virtual ~SGAndCondition ();
+ virtual bool test () const;
+ // transfer pointer ownership
+ virtual void addCondition (SGCondition * condition);
+ virtual void collectDependentProperties(std::set<const SGPropertyNode*>& props) const;
+private:
+ std::vector<SGConditionRef> _conditions;
+};
+
+
+/**
+ * Condition for an 'or' group.
+ *
+ * This condition is true if at least one of the conditions in the
+ * group is true.
+ */
+class SGOrCondition : public SGCondition
+{
+public:
+ SGOrCondition ();
+ virtual ~SGOrCondition ();
+ virtual bool test () const;
+ // transfer pointer ownership
+ virtual void addCondition (SGCondition * condition);
+ virtual void collectDependentProperties(std::set<const SGPropertyNode*>& props) const;
+private:
+ std::vector<SGConditionRef> _conditions;
+};
+
+
+/**
+ * Abstract base class for property comparison conditions.
+ */
+class SGComparisonCondition : public SGCondition
+{
+public:
+ enum Type {
+ LESS_THAN,
+ GREATER_THAN,
+ EQUALS
+ };
+ SGComparisonCondition (Type type, bool reverse = false);
+ virtual ~SGComparisonCondition ();
+ virtual bool test () const;
+ virtual void setLeftProperty( SGPropertyNode *prop_root,
+ const char * propname );
+ virtual void setRightProperty( SGPropertyNode *prop_root,
+ const char * propname );
+ virtual void setPrecisionProperty( SGPropertyNode *prop_root,
+ const char * propname );
+ // will make a local copy
+ virtual void setLeftValue (const SGPropertyNode * value);
+ virtual void setRightValue (const SGPropertyNode * value);
+ virtual void setPrecisionValue (const SGPropertyNode * value);
+
+ void setLeftDExpression(SGExpressiond* dexp);
+ void setRightDExpression(SGExpressiond* dexp);
+ void setPrecisionDExpression(SGExpressiond* dexp);
+
+ virtual void collectDependentProperties(std::set<const SGPropertyNode*>& props) const;
+private:
+ Type _type;
+ bool _reverse;
+ SGPropertyNode_ptr _left_property;
+ SGPropertyNode_ptr _right_property;
+ SGPropertyNode_ptr _precision_property;
+
+ SGSharedPtr<SGExpressiond> _left_dexp;
+ SGSharedPtr<SGExpressiond> _right_dexp;
+ SGSharedPtr<SGExpressiond> _precision_dexp;
+};