using std::istream;
using std::ostream;
-\f
+using std::string;
+
/**
* Condition for a single property.
*
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;
};
SGNotCondition (SGCondition * condition);
virtual ~SGNotCondition ();
virtual bool test () const;
+ virtual void collectDependentProperties(std::set<const SGPropertyNode*>& props) const;
private:
SGSharedPtr<SGCondition> _condition;
};
virtual bool test () const;
// transfer pointer ownership
virtual void addCondition (SGCondition * condition);
+ virtual void collectDependentProperties(std::set<const SGPropertyNode*>& props) const;
private:
std::vector<SGSharedPtr<SGCondition> > _conditions;
};
virtual bool test () const;
// transfer pointer ownership
virtual void addCondition (SGCondition * condition);
+ virtual void collectDependentProperties(std::set<const SGPropertyNode*>& props) const;
private:
std::vector<SGSharedPtr<SGCondition> > _conditions;
};
void setRightDExpression(SGExpressiond* dexp);
void setPrecisionDExpression(SGExpressiond* dexp);
+ virtual void collectDependentProperties(std::set<const SGPropertyNode*>& props) const;
private:
Type _type;
bool _reverse;
}
-\f
////////////////////////////////////////////////////////////////////////
// Implementation of SGPropertyCondition.
////////////////////////////////////////////////////////////////////////
}
-\f
////////////////////////////////////////////////////////////////////////
// Implementation of SGNotCondition.
////////////////////////////////////////////////////////////////////////
return !(_condition->test());
}
+void
+SGNotCondition::collectDependentProperties(std::set<const SGPropertyNode*>& props) const
+{
+ _condition->collectDependentProperties(props);
+}
-\f
////////////////////////////////////////////////////////////////////////
// Implementation of SGAndCondition.
////////////////////////////////////////////////////////////////////////
bool
SGAndCondition::test () const
{
- int nConditions = _conditions.size();
- for (int i = 0; i < nConditions; i++) {
+ for( size_t i = 0; i < _conditions.size(); i++ )
+ {
if (!_conditions[i]->test())
return false;
}
_conditions.push_back(condition);
}
+void
+SGAndCondition::collectDependentProperties(std::set<const SGPropertyNode*>& props) const
+{
+ for( size_t i = 0; i < _conditions.size(); i++ )
+ _conditions[i]->collectDependentProperties(props);
+}
+
-\f
////////////////////////////////////////////////////////////////////////
// Implementation of SGOrCondition.
////////////////////////////////////////////////////////////////////////
bool
SGOrCondition::test () const
{
- int nConditions = _conditions.size();
- for (int i = 0; i < nConditions; i++) {
+ for( size_t i = 0; i < _conditions.size(); i++ )
+ {
if (_conditions[i]->test())
return true;
}
_conditions.push_back(condition);
}
+void
+SGOrCondition::collectDependentProperties(std::set<const SGPropertyNode*>& props) const
+{
+ for( size_t i = 0; i < _conditions.size(); i++ )
+ _conditions[i]->collectDependentProperties(props);
+}
+
-\f
////////////////////////////////////////////////////////////////////////
// Implementation of SGComparisonCondition.
////////////////////////////////////////////////////////////////////////
{
_precision_property = new SGPropertyNode();
_precision_dexp = dexp;
-}\f
+}
+
+void
+SGComparisonCondition::collectDependentProperties(std::set<const SGPropertyNode*>& props) const
+{
+ if (_left_dexp)
+ _left_dexp->collectDependentProperties(props);
+ else
+ props.insert(_left_property);
+
+ if (_right_dexp)
+ _right_dexp->collectDependentProperties(props);
+ else
+ props.insert(_right_property);
+
+ if (_precision_dexp)
+ _precision_dexp->collectDependentProperties(props);
+ else if (_precision_property)
+ props.insert(_precision_property);
+
+}
+
////////////////////////////////////////////////////////////////////////
// Read a condition and use it if necessary.
////////////////////////////////////////////////////////////////////////
}
-\f
////////////////////////////////////////////////////////////////////////
// Implementation of SGConditional.
////////////////////////////////////////////////////////////////////////
}
-\f
// The top-level is always an implicit 'and' group
SGCondition *
sgReadCondition( SGPropertyNode *prop_root, const SGPropertyNode *node )