1 #ifndef __JCOMPASS__JPOLICY__
2 #define __JCOMPASS__JPOLICY__
19 namespace JPP {
using namespace JCOMPASS; }
51 for (
T i = __begin; i != __end; ++i) {
55 const JLocation& location = router.
getModule(*i);
57 zmap[location.getString()].insert(location.getFloor());
64 detector[module->getLocation()] = module->getID();
69 if (module->getFloor() != 0) {
71 const int id = module->getID();
72 const int string = module->getString();
74 if (!zmap[
string].empty()) {
76 if (zmap[
string].
count(module->getFloor()) != 0) {
78 (*this)[id].push_back(
id);
82 for (
size_t step = 1; (*this)[id].size() < size && (module->getFloor() + (int) step <= *zmap[
string].rbegin() ||
83 module->getFloor() - (int) step >= *zmap[
string]. begin()); ++step) {
84 for (
int sign : { -1, +1 }) {
86 const int floor = module->getFloor() +
sign * step;
88 if (zmap[
string].
count(floor) != 0) {
89 (*this)[id].push_back(
detector[JLocation(
string,floor)]);
const JModule & getModule(const JObjectID &id) const
Get module parameters.
Router for direct addressing of module data in detector data structure.
JDetector::const_iterator const_iterator
JPolicy(const JModuleRouter &router, T __begin, T __end, const size_t size=1)
Constructor.
Auxiliary class to define policy for invalid modules.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
Logical location of module.
Direct access to module in detector data structure.
bool hasModule(const JObjectID &id) const
Has module.
int sign(const T &value)
Get sign of value.
do set_variable DETECTOR_TXT $WORKDIR detector