Condition Class Reference

A Condition can check any Condition and trigger Actions if the condition is met. More...

#include <condition.h>

Inheritance diagram for Condition:
TemplatePropertyCondition< T, std::set< T > > TemplatePropertyCondition< T, T > NumericPropertyValidation< T > OptionPropertyValidation< T > TemplatePropertyCondition< T, S > TrueCondition InCondition< T > EqualCondition< T > GreaterCondition< T > GreaterEqualCondition< T > LessCondition< T > LessEqualCondition< T > BinaryOperatorCondition< T, S >

List of all members.

Classes

class  ValidationFailed
 Exception thrown when validation of the Condition failed. More...

Public Member Functions

 Condition (const Action &action=NoAction(), const Action &elseaction=NoAction())
 Condition (const Condition &condition)
virtual Conditionclone () const =0
ConditionaddAction (const Action &action)
 Add an arbitrary number of Actions to the Condition.
ConditionaddElseAction (const Action &action)
 Add an arbitrary number of ElseActions to the Condition.
virtual bool met () const =0 throw ()
 This implements the actual checking of the Condition.
 operator bool () const
 Overloading the bool() operator to call met().
void exec ()
 Checks if Condition is met and execs the right Actions.
bool validate () const
 Returns whether the condition is met and logs a warning, if not.
virtual std::string description () const
 Returns a string describing the condition.

Detailed Description

A Condition can check any Condition and trigger Actions if the condition is met.

The foremost purpose is to monitor the state of a Property and react to its changes (Look at TemplateProperty and TemplateProperty(*)Condition).

Definition at line 39 of file condition.h.


Member Function Documentation

Condition & addAction ( const Action action  ) 

Add an arbitrary number of Actions to the Condition.

These will be exec'd every time the method check() is called and met() returns true. Equivalent to thenDo().

Definition at line 60 of file condition.cpp.

Condition & addElseAction ( const Action action  ) 

Add an arbitrary number of ElseActions to the Condition.

These will be exec'd every time the method exec() is called and met() returns false. Equivalent to elseDo().

Definition at line 67 of file condition.cpp.

virtual std::string description (  )  const [inline, virtual]

Returns a string describing the condition.

This is added to the exception message when validation failed.

Reimplemented in NumericPropertyValidation< T >.

Definition at line 99 of file condition.h.

void exec (  ) 

Checks if Condition is met and execs the right Actions.

If met() returns true Actions are exec'd, and if met() returns false ElseActions are exec'd.

Definition at line 74 of file condition.cpp.

bool validate (  )  const

Returns whether the condition is met and logs a warning, if not.

This is used for validation of TemplateProperties and should not be abused.

Definition at line 84 of file condition.cpp.