/usr/include/gecode/driver/options.hpp is in libgecode-dev 3.7.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* Christian Schulte, 2004
*
* Last modified:
* $Date: 2011-02-22 13:52:12 +0100 (Tue, 22 Feb 2011) $ by $Author: schulte $
* $Revision: 11766 $
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#include <cstring>
namespace Gecode {
namespace Driver {
/*
* String option
*
*/
inline
StringValueOption::StringValueOption(const char* o, const char* e,
const char* v)
: BaseOption(o,e), cur(strdup(v)) {}
inline void
StringValueOption::value(const char* v) {
strdel(cur);
cur = strdup(v);
}
inline const char*
StringValueOption::value(void) const {
return cur;
}
/*
* String option
*
*/
inline
StringOption::StringOption(const char* o, const char* e, int v)
: BaseOption(o,e), cur(v), fst(NULL), lst(NULL) {}
inline void
StringOption::value(int v) {
cur = v;
}
inline int
StringOption::value(void) const {
return cur;
}
/*
* Integer option
*
*/
inline
IntOption::IntOption(const char* o, const char* e, int v)
: BaseOption(o,e), cur(v) {}
inline void
IntOption::value(int v) {
cur = v;
}
inline int
IntOption::value(void) const {
return cur;
}
/*
* Unsigned integer option
*
*/
inline
UnsignedIntOption::UnsignedIntOption(const char* o, const char* e,
unsigned int v)
: BaseOption(o,e), cur(v) {}
inline void
UnsignedIntOption::value(unsigned int v) {
cur = v;
}
inline unsigned int
UnsignedIntOption::value(void) const {
return cur;
}
/*
* Double option
*
*/
inline
DoubleOption::DoubleOption(const char* o, const char* e,
unsigned int v)
: BaseOption(o,e), cur(v) {}
inline void
DoubleOption::value(double v) {
cur = v;
}
inline double
DoubleOption::value(void) const {
return cur;
}
/*
* Bool option
*
*/
inline
BoolOption::BoolOption(const char* o, const char* e)
: BaseOption(o,e), cur(false) {}
inline void
BoolOption::value(bool v) {
cur = v;
}
inline bool
BoolOption::value(void) const {
return cur;
}
}
/*
* Options
*
*/
inline void
BaseOptions::add(Driver::BaseOption& o) {
o.next = NULL;
if (fst == NULL) {
fst=&o;
} else {
lst->next=&o;
}
lst=&o;
}
inline const char*
BaseOptions::name(void) const {
return _name;
}
/*
* Model options
*
*/
inline void
Options::model(int v) {
_model.value(v);
}
inline void
Options::model(int v, const char* o, const char* h) {
_model.add(v,o,h);
}
inline int
Options::model(void) const {
return _model.value();
}
inline void
Options::symmetry(int v) {
_symmetry.value(v);
}
inline void
Options::symmetry(int v, const char* o, const char* h) {
_symmetry.add(v,o,h);
}
inline int
Options::symmetry(void) const {
return _symmetry.value();
}
inline void
Options::propagation(int v) {
_propagation.value(v);
}
inline void
Options::propagation(int v, const char* o, const char* h) {
_propagation.add(v,o,h);
}
inline int
Options::propagation(void) const {
return _propagation.value();
}
inline void
Options::icl(IntConLevel i) {
_icl.value(i);
}
inline IntConLevel
Options::icl(void) const {
return static_cast<IntConLevel>(_icl.value());
}
inline void
Options::branching(int v) {
_branching.value(v);
}
inline void
Options::branching(int v, const char* o, const char* h) {
_branching.add(v,o,h);
}
inline int
Options::branching(void) const {
return _branching.value();
}
/*
* Search options
*
*/
inline void
Options::search(int v) {
_search.value(v);
}
inline void
Options::search(int v, const char* o, const char* h) {
_search.add(v,o,h);
}
inline int
Options::search(void) const {
return _search.value();
}
inline void
Options::solutions(unsigned int n) {
_solutions.value(n);
}
inline unsigned int
Options::solutions(void) const {
return _solutions.value();
}
inline void
Options::threads(double n) {
_threads.value(n);
}
inline double
Options::threads(void) const {
return _threads.value();
}
inline void
Options::c_d(unsigned int d) {
_c_d.value(d);
}
inline unsigned int
Options::c_d(void) const {
return _c_d.value();
}
inline void
Options::a_d(unsigned int d) {
_a_d.value(d);
}
inline unsigned int
Options::a_d(void) const {
return _a_d.value();
}
inline void
Options::node(unsigned int n) {
_node.value(n);
}
inline unsigned int
Options::node(void) const {
return _node.value();
}
inline void
Options::fail(unsigned int n) {
_fail.value(n);
}
inline unsigned int
Options::fail(void) const {
return _fail.value();
}
inline void
Options::time(unsigned int t) {
_time.value(t);
}
inline unsigned int
Options::time(void) const {
return _time.value();
}
inline void
Options::interrupt(bool b) {
_interrupt.value(b);
}
inline bool
Options::interrupt(void) const {
return static_cast<bool>(_interrupt.value());
}
/*
* Execution options
*
*/
inline void
Options::mode(ScriptMode sm) {
_mode.value(sm);
}
inline ScriptMode
Options::mode(void) const {
return static_cast<ScriptMode>(_mode.value());
}
inline void
Options::iterations(unsigned int i) {
_iterations.value(i);
}
inline unsigned int
Options::iterations(void) const {
return _iterations.value();
}
inline void
Options::samples(unsigned int s) {
_samples.value(s);
}
inline unsigned int
Options::samples(void) const {
return _samples.value();
}
#ifdef GECODE_HAS_GIST
forceinline
Options::_I::_I(void) : _click(heap,1), n_click(0),
_solution(heap,1), n_solution(0), _move(heap,1), n_move(0),
_compare(heap,1), n_compare(0) {}
forceinline void
Options::_I::click(Gist::Inspector* i) {
_click[static_cast<int>(n_click++)] = i;
}
forceinline void
Options::_I::solution(Gist::Inspector* i) {
_solution[static_cast<int>(n_solution++)] = i;
}
forceinline void
Options::_I::move(Gist::Inspector* i) {
_move[static_cast<int>(n_move++)] = i;
}
forceinline void
Options::_I::compare(Gist::Comparator* i) {
_compare[static_cast<int>(n_compare++)] = i;
}
forceinline Gist::Inspector*
Options::_I::click(unsigned int i) const {
return (i < n_click) ? _click[i] : NULL;
}
forceinline Gist::Inspector*
Options::_I::solution(unsigned int i) const {
return (i < n_solution) ? _solution[i] : NULL;
}
forceinline Gist::Inspector*
Options::_I::move(unsigned int i) const {
return (i < n_move) ? _move[i] : NULL;
}
forceinline Gist::Comparator*
Options::_I::compare(unsigned int i) const {
return (i < n_compare) ? _compare[i] : NULL;
}
#endif
/*
* Options with additional size argument
*
*/
inline void
SizeOptions::size(unsigned int s) {
_size = s;
}
inline unsigned int
SizeOptions::size(void) const {
return _size;
}
/*
* Options with additional string argument
*
*/
inline const char*
InstanceOptions::instance(void) const {
return _inst;
}
}
// STATISTICS: driver-any
|