Generated on Mon Aug 25 11:35:33 2008 for Gecode by doxygen 1.5.6

options.icc

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Christian Schulte <schulte@gecode.org>
00005  *
00006  *  Copyright:
00007  *     Christian Schulte, 2004
00008  *
00009  *  Last modified:
00010  *     $Date: 2008-07-11 10:45:19 +0200 (Fri, 11 Jul 2008) $ by $Author: tack $
00011  *     $Revision: 7344 $
00012  *
00013  *  This file is part of Gecode, the generic constraint
00014  *  development environment:
00015  *     http://www.gecode.org
00016  *
00017  *
00018  *  Permission is hereby granted, free of charge, to any person obtaining
00019  *  a copy of this software and associated documentation files (the
00020  *  "Software"), to deal in the Software without restriction, including
00021  *  without limitation the rights to use, copy, modify, merge, publish,
00022  *  distribute, sublicense, and/or sell copies of the Software, and to
00023  *  permit persons to whom the Software is furnished to do so, subject to
00024  *  the following conditions:
00025  *
00026  *  The above copyright notice and this permission notice shall be
00027  *  included in all copies or substantial portions of the Software.
00028  *
00029  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00030  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00031  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00032  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00033  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00034  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00035  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00036  *
00037  */
00038 
00039 /*
00040  * Option baseclass
00041  *
00042  */
00043 inline
00044 BaseOption::BaseOption(const char* o, const char* e) 
00045   : opt(o), exp(e) {}
00046 inline
00047 BaseOption::~BaseOption(void) {
00048 }
00049 
00050 
00051 /*
00052  * String option
00053  *
00054  */
00055 inline
00056 StringOption::StringOption(const char* o, const char* e, int v) 
00057   : BaseOption(o,e), cur(v), fst(NULL), lst(NULL) {}
00058 inline void 
00059 StringOption::value(int v) {
00060   cur = v;
00061 }
00062 inline int 
00063 StringOption::value(void) const {
00064   return cur;
00065 }
00066 
00067 /*
00068  * Unsigned integer option
00069  *
00070  */
00071 inline
00072 UnsignedIntOption::UnsignedIntOption(const char* o, const char* e, 
00073                                      unsigned int v) 
00074   : BaseOption(o,e), cur(v) {}
00075 inline void 
00076 UnsignedIntOption::value(unsigned int v) {
00077   cur = v;
00078 }
00079 inline unsigned int 
00080 UnsignedIntOption::value(void) const {
00081   return cur;
00082 }
00083 
00084 
00085 /*
00086  * Options
00087  *
00088  */
00089 inline void
00090 Options::add(BaseOption& o) {
00091   o.next = NULL;
00092   if (fst == NULL) {
00093     fst=&o;
00094   } else {
00095     lst->next=&o;
00096   }
00097   lst=&o;
00098 }
00099 inline const char*
00100 Options::name(void) const {
00101   return _name;
00102 }
00103 
00104 /*
00105  * Model options
00106  *
00107  */
00108 inline void
00109 Options::model(int v) {
00110   _model.value(v);
00111 }
00112 inline void
00113 Options::model(int v, const char* o, const char* h) {
00114   _model.add(v,o,h);
00115 }
00116 inline int
00117 Options::model(void) const {
00118   return _model.value();
00119 }
00120 
00121 inline void
00122 Options::propagation(int v) {
00123   _propagation.value(v);
00124 }
00125 inline void
00126 Options::propagation(int v, const char* o, const char* h) {
00127   _propagation.add(v,o,h);
00128 }
00129 inline int
00130 Options::propagation(void) const {
00131   return _propagation.value();
00132 }
00133 
00134 inline void
00135 Options::pk(PropKind p) {
00136   _pk.value(p);
00137 }
00138 inline PropKind
00139 Options::pk(void) const {
00140   return static_cast<PropKind>(_pk.value());
00141 }
00142 
00143 inline void
00144 Options::icl(IntConLevel i) {
00145   _icl.value(i);
00146 }
00147 inline IntConLevel
00148 Options::icl(void) const {
00149   return static_cast<IntConLevel>(_icl.value());
00150 }
00151 
00152 inline void
00153 Options::branching(int v) {
00154   _branching.value(v);
00155 }
00156 inline void
00157 Options::branching(int v, const char* o, const char* h) {
00158   _branching.add(v,o,h);
00159 }
00160 inline int
00161 Options::branching(void) const {
00162   return _branching.value();
00163 }
00164 
00165 /*
00166  * Search options
00167  *
00168  */
00169 inline void
00170 Options::search(int v) {
00171   _search.value(v);
00172 }
00173 inline void
00174 Options::search(int v, const char* o, const char* h) {
00175   _search.add(v,o,h);
00176 }
00177 inline int
00178 Options::search(void) const {
00179   return _search.value();
00180 }
00181 
00182 inline void
00183 Options::solutions(unsigned int n) {
00184   _solutions.value(n);
00185 }
00186 inline unsigned int
00187 Options::solutions(void) const {
00188   return _solutions.value();
00189 }
00190 
00191 inline void
00192 Options::c_d(unsigned int d) {
00193   _c_d.value(d);
00194 }
00195 inline unsigned int
00196 Options::c_d(void) const {
00197   return _c_d.value();
00198 }
00199 
00200 inline void
00201 Options::a_d(unsigned int d) {
00202   _a_d.value(d);
00203 }
00204 inline unsigned int
00205 Options::a_d(void) const {
00206   return _a_d.value();
00207 }
00208 
00209 inline void
00210 Options::fail(unsigned int n) {
00211   _fail.value(n);
00212 }
00213 inline unsigned int
00214 Options::fail(void) const {
00215   return _fail.value();
00216 }
00217 
00218 inline void
00219 Options::time(unsigned int t) {
00220   _time.value(t);
00221 }
00222 inline unsigned int
00223 Options::time(void) const {
00224   return _time.value();
00225 }
00226 
00227 
00228 
00229 /*
00230  * Execution options
00231  *
00232  */
00233 inline void
00234 Options::mode(ExampleMode em) {
00235   _mode.value(em);
00236 }
00237 inline ExampleMode
00238 Options::mode(void) const {
00239   return static_cast<ExampleMode>(_mode.value());
00240 }
00241 
00242 inline void
00243 Options::iterations(unsigned int i) {
00244   _iterations.value(i);
00245 }
00246 inline unsigned int
00247 Options::iterations(void) const {
00248   return _iterations.value();
00249 }
00250 
00251 inline void
00252 Options::samples(unsigned int s) {
00253   _samples.value(s);
00254 }
00255 inline unsigned int
00256 Options::samples(void) const {
00257   return _samples.value();
00258 }
00259 
00260 inline
00261 Options::~Options(void) {}
00262 
00263 /*
00264  * Options with additional size argument
00265  *
00266  */
00267 inline void
00268 SizeOptions::size(unsigned int s) {
00269   _size = s;
00270 }
00271 inline unsigned int
00272 SizeOptions::size(void) const {
00273   return _size;
00274 }
00275 
00276 // STATISTICS: example-any