diff --git a/include/crpropa/Module.h b/include/crpropa/Module.h index e1fd41aaa..eaa6e20b4 100644 --- a/include/crpropa/Module.h +++ b/include/crpropa/Module.h @@ -59,7 +59,17 @@ class AbstractCondition: public Module { void setMakeAcceptedInactive(bool makeInactive); void setRejectFlag(std::string key, std::string value); void setAcceptFlag(std::string key, std::string value); + + void printRejectFlag(); + void printAcceptFlag(); +}; + +class DeactivateModule: public AbstractCondition { + public: + void process(Candidate *cand) const { reject(cand); } }; + + } // namespace crpropa #endif /* CRPROPA_MODULE_H */ diff --git a/src/Module.cpp b/src/Module.cpp index aa32c4a8c..aabbfd694 100644 --- a/src/Module.cpp +++ b/src/Module.cpp @@ -19,8 +19,7 @@ void Module::setDescription(const std::string &d) { AbstractCondition::AbstractCondition() : makeRejectedInactive(true), makeAcceptedInactive(false), rejectFlagKey( - "Rejected") { - + "Rejected"), rejectFlagValue( typeid(*this).name() ) { } void AbstractCondition::reject(Candidate *candidate) const { @@ -77,4 +76,13 @@ void AbstractCondition::setAcceptFlag(std::string key, std::string value) { acceptFlagValue = value; } +void AbstractCondition::printRejectFlag() { + std::cout << "rejectKey: " << rejectFlagKey << " with flag: " << rejectFlagValue << "\n"; +} + +void AbstractCondition::printAcceptFlag() { + std::cout << "acceptKey: " << acceptFlagKey << " with flag: " << acceptFlagValue << "\n"; +} + + } // namespace crpropa