BWAPI
SPAR/AIModule/SparAIModule/DecisionMaking/Layer1Reactive/FSM/Conditions/CompositeCondition.h
Go to the documentation of this file.
00001 #pragma once
00002 #include "../../../../Utils/FSM/Condition.h"
00003 #include <functional>
00004 
00005 template<class T0, class T1, class Op=std::logical_and<bool>>
00006 struct CompositeCondition
00007 {
00008   CompositeCondition(T0 c0, T1 c1, Op op=Op())
00009     : m_c0(c0)
00010     , m_c1(c1)
00011     , m_op(op)
00012   {}
00013 
00014   bool evaluate() const
00015   {
00016     return m_op(m_c0.evaluate(), m_c1.evaluate());
00017   }
00018 
00019   bool evaluate()
00020   {
00021     return m_op(m_c0.evaluate(), m_c1.evaluate());
00022   }
00023 
00024 private:
00025   T0 m_c0;
00026   T1 m_c1;
00027   Op m_op;
00028 };
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines