Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

cup.h

Go to the documentation of this file.
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; /* Number of the couple to play */
00051       short result;     /* result = 0 -> draw,
00052              result > 0 -> team1 wins,
00053              result < 0 -> team2 wins */
00054     };
00055 
00056     Core* core_;      // Core
00057     ID match_;      // match played now
00058     std::list<data_t> teams_; // List of data_t
00059     std::list<ID> next_eliminatoria_; // galician_to_english("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

Generated on Fri Dec 26 22:52:54 2003 for dmn by doxygen 1.3.4