TheChess
|
00001 /* 00002 * thechess, chess game web application written in C++ and based on Wt 00003 * Copyright (C) 2010 Boris Nagaev 00004 * 00005 * thechess is licensed under the GNU GPL Version 2. 00006 * Other versions of the GPL do not apply. 00007 * See the LICENSE file for terms of use. 00008 */ 00009 00010 #ifndef THECHESS_MODEL_COMPETITION_PARAMETERS_HPP_ 00011 #define THECHESS_MODEL_COMPETITION_PARAMETERS_HPP_ 00012 00013 #include <Wt/Dbo/Dbo> 00014 #include <Wt/Dbo/ptr> 00015 namespace dbo = Wt::Dbo; 00016 00017 namespace thechess { 00018 namespace model { 00019 class CompetitionParameters; 00020 } 00021 } 00022 00023 #include "model/GameParameters.hpp" 00024 #include "model/UserClassification.hpp" 00025 #include "model/CompetitionType.hpp" 00026 #include "model/td.hpp" 00027 00028 namespace thechess { 00029 namespace model { 00030 00031 class CompetitionParameters : public GameParameters { 00032 public: 00033 typedef CompetitionType Type; 00034 00035 CompetitionParameters(); 00036 CompetitionParameters(bool); 00037 00038 template<class Action> 00039 void persist(Action& a) { 00040 GameParameters::persist(a); 00041 dbo::field(a, type_, "type"); 00042 dbo::field(a, min_rating_, "min_rating"); 00043 dbo::field(a, max_rating_, "max_rating"); 00044 dbo::field(a, min_classification_, "min_classification"); 00045 dbo::field(a, max_classification_, "max_classification"); 00046 dbo::field(a, force_start_delay_, "force_start_delay"); 00047 dbo::field(a, min_users_, "min_users"); 00048 dbo::field(a, max_users_, "max_users"); 00049 dbo::field(a, min_recruiting_time_, "min_recruiting_time"); 00050 dbo::field(a, max_recruiting_time_, "max_recruiting_time"); 00051 dbo::field(a, max_simultaneous_games_, "max_simultaneous_games"); 00052 dbo::field(a, games_factor_, "games_factor"); 00053 dbo::field(a, relax_time_, "relax_time"); 00054 dbo::field(a, min_substages_, "min_substages"); 00055 dbo::field(a, increment_substages_, "increment_substages"); 00056 } 00057 00058 Type type() const { 00059 return type_; 00060 } 00061 void set_type(Type v) { 00062 type_ = v; 00063 } 00064 00065 int min_rating() const { 00066 return min_rating_; 00067 } 00068 void set_min_rating(int v) { 00069 min_rating_ = v; 00070 } 00071 int max_rating() const { 00072 return max_rating_; 00073 } 00074 void set_max_rating(int v) { 00075 max_rating_ = v; 00076 } 00077 00078 Classification min_classification() const { 00079 return min_classification_; 00080 } 00081 void set_min_classification(Classification v) { 00082 min_classification_ = v; 00083 } 00084 Classification max_classification() const { 00085 return max_classification_; 00086 } 00087 void set_max_classification(Classification v) { 00088 max_classification_ = v; 00089 } 00090 00091 Td force_start_delay() const { 00092 return force_start_delay_; 00093 } 00094 void set_force_start_delay(Td v) { 00095 force_start_delay_ = v; 00096 } 00097 00098 int min_users() const { 00099 return min_users_; 00100 } 00101 void set_min_users(int v) { 00102 min_users_ = v; 00103 } 00104 int max_users() const { 00105 return max_users_; 00106 } 00107 void set_max_users(int v) { 00108 max_users_ = v; 00109 } 00110 00111 Td min_recruiting_time() const { 00112 return min_recruiting_time_; 00113 } 00114 void set_min_recruiting_time(Td v) { 00115 min_recruiting_time_ = v; 00116 } 00117 Td max_recruiting_time() const { 00118 return max_recruiting_time_; 00119 } 00120 void set_max_recruiting_time(Td v) { 00121 max_recruiting_time_ = v; 00122 } 00123 00124 int max_simultaneous_games() const { 00125 return max_simultaneous_games_; 00126 } 00127 void set_max_simultaneous_games(int v) { 00128 max_simultaneous_games_ = v; 00129 } 00130 00131 float games_factor() const { 00132 return games_factor_; 00133 } 00134 void set_games_factor(float v) { 00135 games_factor_ = v; 00136 } 00137 00138 Td relax_time() const { 00139 return relax_time_; 00140 } 00141 void set_relax_time(Td v) { 00142 relax_time_ = v; 00143 } 00144 int min_substages() const { 00145 return min_substages_; 00146 } 00147 void set_min_substages(int v) { 00148 min_substages_ = v; 00149 } 00150 int increment_substages() const { 00151 return increment_substages_; 00152 } 00153 void set_increment_substages(int v) { 00154 increment_substages_ = v; 00155 } 00156 00157 private: 00158 Type type_; 00159 00160 int min_rating_; 00161 int max_rating_; 00162 Classification min_classification_; 00163 Classification max_classification_; 00164 00165 Td force_start_delay_; 00166 00167 // classical and staged 00168 int min_users_; 00169 int max_users_; 00170 Td min_recruiting_time_; 00171 Td max_recruiting_time_; 00172 00173 // classical 00174 int max_simultaneous_games_; 00175 float games_factor_; 00176 00177 // staged 00178 Td relax_time_; 00179 int min_substages_; 00180 int increment_substages_; 00181 }; 00182 00183 } 00184 } 00185 00186 #endif 00187