dynrules
|
A simple memory-mapped RuleManagement implementation that does not load its rules from an external data source. More...
#include <MMapRuleManagement.h>
Public Member Functions | |
MMapRuleManagement (unsigned int maxrules) | |
Creates a new MMapRuleManagement instance. | |
virtual | ~MMapRuleManagement () |
Destroys the MMapRuleManagement. | |
std::vector< Rule * > | loadRules () |
Loads all existing rules. | |
std::vector< Rule * > | loadRules (unsigned int maxrules) |
Loads a specific amount of rules. | |
bool | saveRules (std::vector< Rule * > rules) |
Saves the passed rules to the underlying data source. | |
Protected Attributes | |
std::vector< Rule * > | _rules |
In-memory set of Rule objects to use. |
A simple memory-mapped RuleManagement implementation that does not load its rules from an external data source.
It is an extremely useful class for testing rules and basic algorithms, but due to the in-memory management of all rules, it should not be used in a productive environment, especially if large rule sets have to be managed.
By default, the MMapRuleManagement will reserve enough memory for the rules to manage, when it is constructed. It will NOT fill the rules with useful values though. It is up to caller to use loadRules() afterwards and fill the returned Rule instances with the necessary data.
Definition at line 29 of file MMapRuleManagement.h.
dynrules::MMapRuleManagement::MMapRuleManagement | ( | unsigned int | maxrules | ) |
Creates a new MMapRuleManagement instance.
maxrules | The amount of Rule objects to create. |
Definition at line 13 of file MMapRuleManagement.cpp.
dynrules::MMapRuleManagement::~MMapRuleManagement | ( | ) | [virtual] |
Destroys the MMapRuleManagement.
Destroys the MMapRuleManagement and frees the memory hold by the attached Rule instances.
Definition at line 22 of file MMapRuleManagement.cpp.
std::vector< Rule * > dynrules::MMapRuleManagement::loadRules | ( | ) | [virtual] |
Loads all existing rules.
Implements dynrules::RuleManagement.
Definition at line 32 of file MMapRuleManagement.cpp.
std::vector< Rule * > dynrules::MMapRuleManagement::loadRules | ( | unsigned int | maxrules | ) | [virtual] |
Loads a specific amount of rules.
This behaves exactly like loadRules().
maxrules | The amount of rules to load. |
Implements dynrules::RuleManagement.
Definition at line 37 of file MMapRuleManagement.cpp.
bool dynrules::MMapRuleManagement::saveRules | ( | std::vector< Rule * > | rules | ) | [virtual] |
Saves the passed rules to the underlying data source.
This does nothing.
rules | A std::vector containing the rules to save. |
Implements dynrules::RuleManagement.
Definition at line 42 of file MMapRuleManagement.cpp.