The Reflection Registry
The registry maps an actor type identifier (ati) to a function that posts the corresponding constraint. The type of these post functions is defined in the registry asclass Registry { public: typedef void (*poster) (Gecode::Space*, Gecode::Reflection::VarMap&, const Gecode::Reflection::ActorSpec&); };
There are two kinds of post functions in the registry:
- One function per actor instance. These functions correspond directly to individual propagators and branchings. For instance, the registry contains a function for the ati
Int::Distinct::Dom<Int::OffsetView>
. Each propagator registers one post function per instance. The registry is populated with these post functions as soon as the library in which the propagator is defined is loaded.
- One function per constraint post function (the functions found in gecode/int.hh or gecode/set.hh, for example). The functions are useful for interfacing to Gecode, as they provide a higher-level interface to the propagators. For example, the registry contains a post function for the ati
Gecode::rel
. Depending on the arguments given in the ActorSpec, this function can post any of therel
constraints found in gecode/int.hh and gecode/set.hh. All high-level post functions are registered when the serialization library is loaded, which can be triggered by callling Gecode::Serialization::initRegistry.
Mapping arguments to ActorSpecs
The high-level post functions are generated automatically from the post functions in gecode/int.hh and gecode/set.hh. The argument types are mapped automatically to Gecode::Reflection::Arg terms.
C++ argument type | Reflection::Arg type | Comment |
---|---|---|
int | INT | |
unsigned int | INT | |
bool | INT | |
IntVar | VAR | |
BoolVar | VAR | |
SetVar | VAR | |
IntVarArgs | [VAR,...,VAR] | |
BoolVarArgs | [VAR,...,VAR] | |
SetVarArgs | [VAR,...,VAR] | |
IntArgs | [INT,...,INT] | |
IntSet | [INT,...,INT] | Two consecutive integers are interpreted as a range |
IntSetArgs | [[INT,...,INT],...,[INT,...,INT]] | Same representation as for IntSet |
Any enumeration | STRING | The string representation of the enum value, e.g. "IRT_EQ" |