All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
effectUtil.h
Go to the documentation of this file.
1 #ifndef _EFFECTUTIL_H
2 #define _EFFECTUTIL_H
3 
5 #include "osl/misc/carray.h"
7 
8 #include <iosfwd>
9 #include <cassert>
10 
11 namespace osl
12 {
13  namespace container
14  {
15  class PieceVector;
16  }
17 
18  namespace effect_util
19  {
25  struct EffectUtil
26  {
32  template <class Function, bool InterestEmpty>
33  static void forEachEffectOfPtypeO(const NumEffectState& state, Square, PtypeO,
34  Function& f);
35  template <Player P, class Function, bool InterestEmpty>
36  static void forEachEffectOfPtypeO(const NumEffectState& state, Square, Ptype,
37  Function& f);
38 
45  template <Player P>
46  static Piece safeCaptureNotByKing(const NumEffectState& state, Square target,
47  Piece king);
48  static Piece safeCaptureNotByKing(Player P, const NumEffectState& state,
49  Square target)
50  {
51  const Piece king = state.kingPiece(P);
52  if (P == BLACK)
53  return safeCaptureNotByKing<BLACK>(state, target, king);
54  else
55  return safeCaptureNotByKing<WHITE>(state, target, king);
56  }
62  template <class Action>
63  static void forEachEffect(Player P, const NumEffectState& state, Square pos,
64  Action& a)
65  {
66  if (P == BLACK)
67  state.template forEachEffect<BLACK>(pos,a);
68  else
69  state.template forEachEffect<WHITE>(pos,a);
70  }
74  static void findEffect(Player P, const NumEffectState& state, Square target,
76 
80  template <class EvalT>
81  static void findThreat(const NumEffectState& state, Square position,
82  PtypeO ptypeo, PieceVector& out);
83 
84  template <class EvalT>
85  struct FindThreat;
86  struct SafeCapture;
87  };
88 
89  } // namespace effect_util
91 } // namespace osl
92 
93 #endif /* _EFFECTUTIL_H */
94 // ;;; Local Variables:
95 // ;;; mode:c++
96 // ;;; c-basic-offset:2
97 // ;;; End: