Gecode::Reflection::VarMap Class Reference
[Reflection API]
List of all members.
Detailed Description
Mapping Gecode variable implementations to variable specifications.
The reflection API always references variables by indices into a VarMap. The VarMap is filled with information when you access the specification of a propagator. If, for instance, a propagator references some IntVarImp, and that particular variable implementation is already contained in the VarMap, the ActorSpec for the propagator will contain a reference to the index of the variable implementation. If it is not already in the VarMap, its VarSpec is extracted, and the variable implementation is put in the map. The ActorSpec then of course references the newly created index.
A VarMap also maps variable implementations to names. The names can be assigned in the script, using the virtual function Space::getVars (see Queens as an example). That way, the variables mentioned in an ActorSpec can be identified with variables from the model.
Definition at line 64 of file var-map.icc.
|
Interface for modeling |
template<class Var> |
void | put (const Space *home, const Var &v, const Support::Symbol &n, bool registerOnly=false) |
| Insert specification for variable v with name n.
|
template<class Var> |
void | putArray (const Space *home, const VarArgArray< Var > &v, const Support::Symbol &n, bool registerOnly=false) |
| Insert specifications for variables in x with name n.
|
template<class Var> |
void | putArray (const Space *home, const VarArray< Var > &v, const Support::Symbol &n, bool registerOnly=false) |
| Insert specifications for variables in x with name n.
|
Public Member Functions |
| VarMap (void) |
| Default constructor.
|
| VarMap (const VarMap &) |
| Copy constructor.
|
VarMap & | operator= (const VarMap &) |
| Assignment operator.
|
| ~VarMap (void) |
| Destructor.
|
int | size (void) const |
| Return number of entries.
|
int | index (const VarImpBase *x) const |
| Return index for variable implementation x.
|
int | index (const Support::Symbol &n) const |
| Return index for variable implementation with name n.
|
bool | nameIsKnown (const Support::Symbol &n) const |
| Return if variable implementation with name n is known.
|
bool | hasName (const VarImpBase *x) const |
| Return if variable implementation x has a name.
|
bool | hasName (int i) const |
| Return if variable implementation at index i has a name.
|
Support::Symbol | name (const VarImpBase *x) const |
| Return name for variable implementation x.
|
Support::Symbol | name (int i) const |
| Return name for variable implementation at index i.
|
VarImpBase * | varImpBase (const Support::Symbol &n) const |
| Return variable implementation with name n.
|
VarImpBase * | varImpBase (int i) const |
| Return variable implementation at index i.
|
Var | var (const Support::Symbol &n) const |
| Return variable with name n.
|
Var | var (int i) const |
| Return variable at index i.
|
VarSpec & | spec (const VarImpBase *x) const |
| Return specification for variable implementation x.
|
VarSpec & | spec (int i) const |
| Return specification for variable implementation at index i.
|
VarSpec & | spec (const Support::Symbol &n) const |
| Return specification for variable implementation with name n.
|
void | name (VarImpBase *x, const Support::Symbol &n) |
| Register name n for variable implementation x.
|
int | put (const VarImpBase *x, VarSpec *vs) |
| Insert specification vs for variable implementation x, return index.
|
void | putMasterObject (void *obj) |
| Insert a shared object into the table.
|
int | getSharedIndex (void *obj) const |
| Get the index of a shared object from the table.
|
void * | getSharedObject (int i) const |
| Get the shared object stored at index i.
|
Classes |
class | VarMapObj |
| Implementation of a VarMap. More...
|
Constructor & Destructor Documentation
Gecode::Reflection::VarMap::VarMap |
( |
void |
|
) |
|
Default constructor.
Definition at line 78 of file var-map.cc.
Gecode::Reflection::VarMap::VarMap |
( |
const VarMap & |
v |
) |
|
Gecode::Reflection::VarMap::~VarMap |
( |
void |
|
) |
|
Member Function Documentation
VarMap & Gecode::Reflection::VarMap::operator= |
( |
const VarMap & |
v |
) |
|
Assignment operator.
Definition at line 83 of file var-map.cc.
int Gecode::Reflection::VarMap::size |
( |
void |
|
) |
const |
Return number of entries.
Definition at line 105 of file var-map.cc.
int Gecode::Reflection::VarMap::index |
( |
const VarImpBase * |
x |
) |
const |
Return index for variable implementation x.
Definition at line 110 of file var-map.cc.
Return index for variable implementation with name n.
Definition at line 117 of file var-map.cc.
bool Gecode::Reflection::VarMap::nameIsKnown |
( |
const Support::Symbol & |
n |
) |
const |
Return if variable implementation with name n is known.
Definition at line 123 of file var-map.cc.
bool Gecode::Reflection::VarMap::hasName |
( |
const VarImpBase * |
x |
) |
const |
Return if variable implementation x has a name.
Definition at line 129 of file var-map.cc.
bool Gecode::Reflection::VarMap::hasName |
( |
int |
i |
) |
const |
Return if variable implementation at index i has a name.
Definition at line 136 of file var-map.cc.
Return name for variable implementation x.
Definition at line 142 of file var-map.cc.
Return name for variable implementation at index i.
Definition at line 150 of file var-map.cc.
Return variable implementation with name n.
Definition at line 157 of file var-map.cc.
VarImpBase * Gecode::Reflection::VarMap::varImpBase |
( |
int |
i |
) |
const |
Return variable implementation at index i.
Definition at line 163 of file var-map.cc.
Return variable with name n.
Definition at line 237 of file var-map.cc.
Var Gecode::Reflection::VarMap::var |
( |
int |
i |
) |
const |
Return variable at index i.
Definition at line 242 of file var-map.cc.
Return specification for variable implementation x.
Definition at line 170 of file var-map.cc.
VarSpec & Gecode::Reflection::VarMap::spec |
( |
int |
i |
) |
const |
Return specification for variable implementation at index i.
Definition at line 179 of file var-map.cc.
Return specification for variable implementation with name n.
Definition at line 186 of file var-map.cc.
Register name n for variable implementation x.
Definition at line 191 of file var-map.cc.
Insert specification vs for variable implementation x, return index.
Definition at line 201 of file var-map.cc.
void Gecode::Reflection::VarMap::putMasterObject |
( |
void * |
obj |
) |
|
Insert a shared object into the table.
Definition at line 217 of file var-map.cc.
int Gecode::Reflection::VarMap::getSharedIndex |
( |
void * |
obj |
) |
const |
Get the index of a shared object from the table.
Definition at line 223 of file var-map.cc.
void * Gecode::Reflection::VarMap::getSharedObject |
( |
int |
i |
) |
const |
Get the shared object stored at index i.
Definition at line 231 of file var-map.cc.
template<class V>
void Gecode::Reflection::VarMap::put |
( |
const Space * |
home, |
|
|
const V & |
v, |
|
|
const Support::Symbol & |
n, |
|
|
bool |
registerOnly = false | |
|
) |
| | [inline] |
Insert specification for variable v with name n.
Definition at line 183 of file var-map.icc.
Insert specifications for variables in x with name n.
Definition at line 206 of file var-map.icc.
Insert specifications for variables in x with name n.
Definition at line 217 of file var-map.icc.
The documentation for this class was generated from the following files: