Skip to content

Commit

Permalink
update Abstract condition with debug information about flags and defa…
Browse files Browse the repository at this point in the history
…ult rejectionFlag
  • Loading branch information
JulienDoerner committed Aug 28, 2024
1 parent 19be5ff commit d48ba06
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
10 changes: 10 additions & 0 deletions include/crpropa/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
12 changes: 10 additions & 2 deletions src/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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

0 comments on commit d48ba06

Please sign in to comment.