Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
KoduRule.hGo to the documentation of this file.00001 #ifndef KODU_RULE_H_ 00002 #define KODU_RULE_H_ 00003 00004 // Kodu Library 00005 #include "Kodu/Primitives/KoduAction.h" 00006 #include "Kodu/Primitives/KoduCondition.h" 00007 00008 namespace Kodu { 00009 //! Kodu Rule 00010 class KoduRule { 00011 public: 00012 unsigned int ruleNumber; //!< Rule number 00013 unsigned int parent; //!< Parent rule (assigned during program parsing) 00014 KoduCondition* condition; //!< Condition to evaluate 00015 KoduAction* action; //!< Action to execute 00016 bool condLastEvalResult; //!< Evaluation result for a condition (true|false) 00017 00018 //! Constructor 00019 KoduRule(unsigned int kRuleNumber, unsigned int kParent) 00020 : ruleNumber(kRuleNumber), 00021 parent(kParent), 00022 condition(NULL), 00023 action(NULL), 00024 condLastEvalResult(false) 00025 { } 00026 00027 //! Destructor 00028 ~KoduRule() { 00029 delete condition; 00030 delete action; 00031 } 00032 00033 //! Get the rule number 00034 unsigned int getRuleNumber() const { 00035 return ruleNumber; 00036 } 00037 00038 //! Get the parent number 00039 unsigned int getParentNumber() const { 00040 return parent; 00041 } 00042 00043 //! Returns whether or not a rule is indented 00044 bool isIndented() const { 00045 return (getParentNumber() > 0); 00046 } 00047 00048 //! Reinitializes a rule's primitives 00049 void reinitializePrimitives() { 00050 condLastEvalResult = false; 00051 condition->reinitialize(); 00052 action->reinitialize(); 00053 } 00054 00055 //! Sets the condition evaluation result 00056 void setConditionEvalResult(bool bVal) { 00057 condLastEvalResult = bVal; 00058 } 00059 00060 private: 00061 DISALLOW_COPY_ASSIGN(KoduRule); 00062 }; 00063 } 00064 #endif // KODU_RULE_H_ |
Tekkotsu v5.1CVS |
Generated Mon May 9 04:58:43 2016 by Doxygen 1.6.3 |