/usr/include/gecode/flatzinc/varspec.hh 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 | /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Guido Tack <tack@gecode.org>
*
* Copyright:
* Guido Tack, 2007
*
* Last modified:
* $Date: 2010-04-08 11:25:15 +0200 (Thu, 08 Apr 2010) $ by $Author: tack $
* $Revision: 10682 $
*
* 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.
*
*/
#ifndef __GECODE_FLATZINC_VARSPEC__HH__
#define __GECODE_FLATZINC_VARSPEC__HH__
#include <gecode/flatzinc/option.hh>
#include <gecode/flatzinc/ast.hh>
#include <vector>
#include <iostream>
namespace Gecode { namespace FlatZinc {
/// %Alias for a variable specification
class Alias {
public:
const int v;
Alias(int v0) : v(v0) {}
};
/// Base class for variable specifications
class VarSpec {
public:
/// Whether the variable was introduced in the mzn2fzn translation
bool introduced;
/// Destructor
virtual ~VarSpec(void) {}
/// Variable index
int i;
/// Whether the variable aliases another variable
bool alias;
/// Whether the variable is assigned
bool assigned;
/// Constructor
VarSpec(bool introduced0) : introduced(introduced0) {}
};
/// Specification for integer variables
class IntVarSpec : public VarSpec {
public:
Option<AST::SetLit* > domain;
IntVarSpec(const Option<AST::SetLit* >& d, bool introduced)
: VarSpec(introduced) {
alias = false;
assigned = false;
domain = d;
}
IntVarSpec(int i0, bool introduced) : VarSpec(introduced) {
alias = false; assigned = true; i = i0;
}
IntVarSpec(const Alias& eq, bool introduced) : VarSpec(introduced) {
alias = true; i = eq.v;
}
~IntVarSpec(void) {
if (!alias && !assigned && domain())
delete domain.some();
}
};
/// Specification for Boolean variables
class BoolVarSpec : public VarSpec {
public:
Option<AST::SetLit* > domain;
BoolVarSpec(Option<AST::SetLit* >& d, bool introduced)
: VarSpec(introduced) {
alias = false; assigned = false; domain = d;
}
BoolVarSpec(bool b, bool introduced) : VarSpec(introduced) {
alias = false; assigned = true; i = b;
}
BoolVarSpec(const Alias& eq, bool introduced) : VarSpec(introduced) {
alias = true; i = eq.v;
}
~BoolVarSpec(void) {
if (!alias && !assigned && domain())
delete domain.some();
}
};
/// Specification for floating point variables
class FloatVarSpec : public VarSpec {
public:
Option<std::vector<double>* > domain;
FloatVarSpec(Option<std::vector<double>* >& d, bool introduced)
: VarSpec(introduced) {
alias = false; assigned = false; domain = d;
}
FloatVarSpec(bool b, bool introduced) : VarSpec(introduced) {
alias = false; assigned = true; i = b;
}
FloatVarSpec(const Alias& eq, bool introduced) : VarSpec(introduced) {
alias = true; i = eq.v;
}
~FloatVarSpec(void) {
if (!alias && !assigned && domain())
delete domain.some();
}
};
/// Specification for set variables
class SetVarSpec : public VarSpec {
public:
Option<AST::SetLit*> upperBound;
SetVarSpec(bool introduced) : VarSpec(introduced) {
alias = false; assigned = false;
upperBound = Option<AST::SetLit* >::none();
}
SetVarSpec(const Option<AST::SetLit* >& v, bool introduced)
: VarSpec(introduced) {
alias = false; assigned = false; upperBound = v;
}
SetVarSpec(AST::SetLit* v, bool introduced) : VarSpec(introduced) {
alias = false; assigned = true;
upperBound = Option<AST::SetLit*>::some(v);
}
SetVarSpec(const Alias& eq, bool introduced) : VarSpec(introduced) {
alias = true; i = eq.v;
}
~SetVarSpec(void) {
if (!alias && upperBound())
delete upperBound.some();
}
};
}}
#endif
// STATISTICS: flatzinc-any
|