moveLogProbVector.h
Go to the documentation of this file.
00001 #ifndef OSL_MOVE_LOG_PROB_VECTOR_H
00002 #define OSL_MOVE_LOG_PROB_VECTOR_H
00003 #include "osl/moveLogProb.h"
00004 
00005 #include "osl/misc/fixedCapacityVector.h"
00006 #include <iosfwd>
00007 
00008 namespace osl
00009 {
00010   namespace container
00011   {
00012   typedef FixedCapacityVector<MoveLogProb,Move::MaxUniqMoves> MoveLogProbVectorBase;
00013 
00014   class MoveLogProbVector : public MoveLogProbVectorBase
00015   {
00016     typedef MoveLogProbVectorBase base_t;
00017   public:
00018     MoveLogProbVector() {}
00019     explicit MoveLogProbVector(size_t size) : MoveLogProbVectorBase(size)
00020     {
00021     }
00022     MoveLogProbVector(const MoveLogProbVector& src) : MoveLogProbVectorBase(src)
00023     {
00024     }
00025     template <class RangeIterator>
00026     MoveLogProbVector(const RangeIterator& first, const RangeIterator& last)
00027       : MoveLogProbVectorBase(first, last)
00028     {
00029     }
00030     void push_back(Move move,int prob) {
00031       base_t::push_back(MoveLogProb(move,prob));
00032     }
00033     void push_back(const MoveLogProb& move) {
00034       base_t::push_back(move);
00035     }
00036     template <class RangeIterator>
00037     void push_back(const RangeIterator& first, const RangeIterator& last)
00038     {
00039       MoveLogProbVectorBase::push_back(first, last);
00040     }
00042     void sortByProbability();
00044     void sortByProbabilityReverse();
00045     const MoveLogProb* find(Move) const;
00046   };
00047   std::ostream& operator<<(std::ostream& os,MoveLogProbVector const& mv);
00048   bool operator==(const MoveLogProbVector& l, const MoveLogProbVector& r);
00049 
00050   } // namespace container
00051   using container::MoveLogProbVector;
00052 } // namespace osl
00053 #endif // OSL_MOVE_LOG_PROB_VECTOR_H
00054 // ;;; Local Variables:
00055 // ;;; mode:c++
00056 // ;;; c-basic-offset:2
00057 // ;;; coding:utf-8
00058 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines