Go to the documentation of this file.00001 #ifndef _EFFECTUTIL_H
00002 #define _EFFECTUTIL_H
00003
00004 #include "osl/state/numEffectState.h"
00005 #include "osl/misc/carray.h"
00006 #include "osl/container/pieceVector.h"
00007
00008 #include <iosfwd>
00009 #include <cassert>
00010
00011 namespace osl
00012 {
00013 namespace container
00014 {
00015 class PieceVector;
00016 }
00017
00018 namespace effect_util
00019 {
00025 struct EffectUtil
00026 {
00032 template <class Function, bool InterestEmpty>
00033 static void forEachEffectOfPtypeO(const NumEffectState& state, Square, PtypeO,
00034 Function& f);
00035 template <Player P, class Function, bool InterestEmpty>
00036 static void forEachEffectOfPtypeO(const NumEffectState& state, Square, Ptype,
00037 Function& f);
00038
00045 template <Player P>
00046 static Piece safeCaptureNotByKing(const NumEffectState& state, Square target,
00047 Piece king);
00048 static Piece safeCaptureNotByKing(Player P, const NumEffectState& state,
00049 Square target)
00050 {
00051 const Piece king = state.kingPiece(P);
00052 if (P == BLACK)
00053 return safeCaptureNotByKing<BLACK>(state, target, king);
00054 else
00055 return safeCaptureNotByKing<WHITE>(state, target, king);
00056 }
00062 template <class Action>
00063 static void forEachEffect(Player P, const NumEffectState& state, Square pos,
00064 Action& a)
00065 {
00066 if (P == BLACK)
00067 state.template forEachEffect<BLACK>(pos,a);
00068 else
00069 state.template forEachEffect<WHITE>(pos,a);
00070 }
00074 static void findEffect(Player P, const NumEffectState& state, Square target,
00075 container::PieceVector& out);
00076
00080 template <class EvalT>
00081 static void findThreat(const NumEffectState& state, Square position,
00082 PtypeO ptypeo, PieceVector& out);
00083
00084 template <class EvalT>
00085 struct FindThreat;
00086 struct SafeCapture;
00087 };
00088
00089 }
00090 using effect_util::EffectUtil;
00091 }
00092
00093 #endif
00094
00095
00096
00097