00001
00028 #ifndef TOURNAMENT_CUP_H
00029 #define TOURNAMENT_CUP_H 1
00030
00031
00032 #include <dmn/core.h>
00033 #include <dmn/tournament.h>
00034
00035 #include <list>
00036
00037 namespace dmn
00038 {
00045 class TournamentCup: public Tournament
00046 {
00047 private:
00048 struct data_t {
00049 ID team1, team2;
00050 unsigned short number_couple;
00051 short result;
00052
00053
00054 };
00055
00056 Core* core_;
00057 ID match_;
00058 std::list<data_t> teams_;
00059 std::list<ID> next_eliminatoria_;
00060
00069 bool teams_in_order(std::list<ID> teams, std::list<data_t> *order);
00070
00079 ID couple_in_position(ID team, unsigned long position);
00080
00088 data_t *search_team(ID team);
00089
00090 public:
00094 TournamentCup();
00095
00096 bool configure(Core *core);
00097 bool next_match(ID match, std::list<ID> *couples);
00098 bool set_match_winner(ID match, ID couple_winner);
00099 bool classification(std::list<ID> *teams);
00100 ID winner();
00101 bool is_finished();
00102 };
00103 };
00104
00105 #endif // TOURNAMENT_CUP_H