All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ratedMove.h
Go to the documentation of this file.
1 /* ratedMove.h
2  */
3 #ifndef OSL_RATEDMOVE_H
4 #define OSL_RATEDMOVE_H
5 
6 #include "osl/move.h"
7 #include <iosfwd>
8 
9 namespace osl
10 {
11  namespace rating
12  {
13  class RatedMove
14  {
17  public:
18  RatedMove(Move move, int rating, int optimistic) : my_move(move), all_rating(rating), optimistic_rating(optimistic)
19  {
20  }
21  RatedMove(Move move, int rating) : my_move(move), all_rating(rating), optimistic_rating(rating)
22  {
23  }
25  void setRating(int rating) { all_rating = rating; }
27 
28  const Move move() const { return my_move; }
29  int rating() const { return all_rating; }
30  int optimisticRating() const { return optimistic_rating; }
31  };
32 
33  std::ostream& operator<<(std::ostream& os, RatedMove const& moveLogProb);
34 
35  inline bool operator==(RatedMove const& lhs, RatedMove const& rhs)
36  {
37  return lhs.move()==rhs.move() && lhs.rating()==rhs.rating();
38  }
39  inline bool operator<(RatedMove const& lhs, RatedMove const& rhs)
40  {
41  if (lhs.rating() != rhs.rating())
42  return lhs.rating() < rhs.rating();
43  if (lhs.optimisticRating() != rhs.optimisticRating())
44  return lhs.optimisticRating() < rhs.optimisticRating();
45  return lhs.move() < rhs.move();
46  }
47  inline bool operator>(RatedMove const& lhs, RatedMove const& rhs)
48  {
49  if (lhs.rating() != rhs.rating())
50  return lhs.rating() > rhs.rating();
51  if (lhs.optimisticRating() != rhs.optimisticRating())
52  return lhs.optimisticRating() > rhs.optimisticRating();
53  return lhs.move() < rhs.move();
54  }
55  }
56  using rating::RatedMove;
57 } // namespace osl
58 
59 
60 #endif /* OSl_RATEDMOVE_H */
61 // ;;; Local Variables:
62 // ;;; mode:c++
63 // ;;; c-basic-offset:2
64 // ;;; End: