32 #ifndef XFormulaAutomatonH 33 #define XFormulaAutomatonH 37 #include <zeusbase/System/SingleLinkedList.hpp> 38 #include <zeusbase/System/XObject.h> 39 #include <zeusbase/System/VariableResolver.h> 40 #include <zeusbase/System/StringMap.hpp> 41 #include <zeusbase/System/Set.hpp> 42 #include <zeusbase/System/XObjectFactory.h> 47 class IXFormulaAutomatonObserver;
60 virtual Retval MQUALIFIER getValue(
const IString& rName, Float& rfValue);
61 virtual bool MQUALIFIER isLocked()
const;
62 virtual bool MQUALIFIER isValid()
const;
63 virtual void MQUALIFIER lockEvaluation();
64 virtual void MQUALIFIER unlockEvaluation();
65 virtual Retval MQUALIFIER setInputValue(
const IString& rName,
const Float& rfValue);
68 virtual bool MQUALIFIER freeze();
69 virtual bool MQUALIFIER unfreeze();
72 virtual Retval MQUALIFIER attach(IObserver& rObserver);
73 virtual Retval MQUALIFIER detach(IObserver& rObserver);
83 virtual ~TXFormulaAutomaton();
85 Retval evaluate_internal(
bool bAll);
92 class TPredicate : public TVariableResolver
99 Retval calculateValue(TSet<TPredicate*>& rSetOfUnCalculatedPredicates);
101 inline Float getCalculationValue()
const {
return m_fValue; }
102 inline TString getCondition()
const {
return m_strCondition; }
103 inline TString getFormula()
const {
return m_mapFormula.getItemConst(TString(L
"")); }
104 inline TString getFormula(
const TString& rConditionValue)
const {
return m_mapFormula.getItemConst(rConditionValue); }
105 inline TString getName()
const {
return m_strName; }
106 inline bool isCalculated()
const {
return m_bCalculated; }
107 inline bool isValid()
const {
return m_bValid; }
109 void resetCalculationValue();
110 inline void setCalculationValue(
const Float& rValue) { m_fValue = rValue; }
112 void resolveDependancies(TStringMap<TPredicate*>& rMap);
113 void releaseDependancies();
114 void releaseObservers();
117 virtual ~TPredicate();
118 void addPredecessor(TPredicate& rPredicate);
119 void addSuccessor(TPredicate& rPredicate);
120 void notifyObservers();
123 virtual Retval resolveVariable(
const TString& rName, TString& rValue);
131 TString m_strCondition;
133 TStringMap<TString> m_mapFormula;
141 TStringMap<TPredicate*> m_mapPredecessors;
143 TStringMap<TPredicate*> m_mapSuccessors;
147 TSingleLinkedList<IXFormulaAutomatonObserver*> m_lstObservers;
153 TStringMap<TPredicate*> m_mapInputVariables;
155 TStringMap<TPredicate*> m_mapPredicates;
157 TStringMap<TPredicate*> m_mapOutputVariables;
159 void releaseInstances();
166 inline bool MQUALIFIER TXFormulaAutomaton::isLocked()
const 168 return (m_iLock > 0);
175 inline void MQUALIFIER TXFormulaAutomaton::lockEvaluation()
184 inline void MQUALIFIER TXFormulaAutomaton::unlockEvaluation()
190 evaluate_internal(
true);
ESystem
Definition: IAngle.hpp:53