- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Mers::Estimation::Discrete::ProbabilityRules::RuleTriggering::RuleTrigger Class Reference

`#include <RuleTrigger.h>`

List of all members.

## Public Member Functions
| RuleTrigger (std::vector< Mers::Estimation::Discrete::ProbabilityRules::Rule * > &theRules, bool hasOwnership=true, unsigned short db=0)
virtual | ~RuleTrigger ()
bool | loadAssignment (unsigned int varID, unsigned int valID)
std::vector< Mers::Estimation::Discrete::ProbabilityRules::Rule * > | getTriggeredRules (void)
std::vector< Mers::Estimation::Discrete::ProbabilityRules::Rule * > | getTriggeredRules (unsigned int numSat)
void | reset (void)
void | setOwnership (bool hasOwnership)
void | setDebug (const unsigned short db)
## Friends
std::ostream & | operator<< (std::ostream &, RuleTrigger const &)

## Detailed Description

The Rule Trigger is used as an quick and efficient way to determine which rules are enabled (triggered). This is done by mapping the variableID, valueID pairs of each rule assignment to the rule itself; decrementing a counter each time a new assignment is satisfied. This rule trigger identifies which rules are enabled (or partially enabled) and returns them.

Definition at line 55 of file RuleTrigger.h.

## Constructor & Destructor Documentation

Mers::Estimation::Discrete::ProbabilityRules::RuleTriggering::RuleTrigger::RuleTrigger | ( | std::vector< Mers::Estimation::Discrete::ProbabilityRules::Rule * > & | theRules,
|  | bool | hasOwnership = `true`,
|  | unsigned short | db = `0` |
| ) |  |  |

Creates new Rule Trigger This class assumes ownership over all of the rules that are given to it.

Parameters:

  | theRules | is the set of rules that will be used by this trigger.
  | db | the initial debug value (0 if unassigned)

RuleTrigger::~RuleTrigger | ( |  | ) | `[virtual]`

Destroys all the probability rules if the ownership flag is set to true. Otherwise, it does nothing.

Definition at line 64 of file RuleTrigger.cpp.

## Member Function Documentation

bool RuleTrigger::loadAssignment | ( | unsigned int | varID,
|  | unsigned int | valID |
| ) |  |  |

Adds the assignment to all the rules. If the same assignment was already made, it is ignored.

Parameters:

  | varID | the base model assignment valariable ID
  | valID | the base model assignment value ID

Returns:
  false if unable to increment rule, true otherwise

Definition at line 83 of file RuleTrigger.cpp.

vector< Rule * > RuleTrigger::getTriggeredRules | ( | void |  | ) |

Determines which rules are triggered and places them into a vector. Note that this class still has ownership over the rules.

Returns:
  a vector of triggered rules

Definition at line 108 of file RuleTrigger.cpp.

vector< Rule * > RuleTrigger::getTriggeredRules | ( | unsigned int | numSat | ) |

Determines which rules are partially triggered (such that numSat or greater of the assignments in the rule are satisfied) and places them into a vector. Note that this class still has ownership over the rules.

Parameters:

  | numSat | the minimum number of assignments that are satisfied in each returned rule

Returns:
  a vector of triggered rules

Definition at line 121 of file RuleTrigger.cpp.

void RuleTrigger::reset | ( | void |  | ) |

Resets the rule trigger

Definition at line 134 of file RuleTrigger.cpp.

void RuleTrigger::setOwnership | ( | bool | hasOwnership | ) |

Sets the ownership flag. If true, the trigger will delete all the rules.

Parameters:

  | hasOwnership | is the new ownership value

Definition at line 153 of file RuleTrigger.cpp.

void RuleTrigger::setDebug | ( | const unsigned short | db | ) |

Sets the debug flag to the value specified

Parameters:

  | db | the value to set the debug flag to (higher numbers are more output)

Definition at line 160 of file RuleTrigger.cpp.

The documentation for this class was generated from the following files:

- /Users/fpy/titan-1-5-MBARI/Mers/Estimation/Discrete/ProbabilityRules/RuleTriggering/RuleTrigger.h
- /Users/fpy/titan-1-5-MBARI/Mers/Estimation/Discrete/ProbabilityRules/RuleTriggering/RuleTrigger.cpp