dynrules::MMapRuleManagement Class Reference

A simple memory-mapped RuleManagement implementation that does not load its rules from an external data source. More...

#include <MMapRuleManagement.h>

Inheritance diagram for dynrules::MMapRuleManagement:
dynrules::RuleManagement

List of all members.

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.

Detailed Description

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.


Constructor & Destructor Documentation

dynrules::MMapRuleManagement::MMapRuleManagement ( unsigned int  maxrules  ) 

Creates a new MMapRuleManagement instance.

Parameters:
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.


Member Function Documentation

std::vector< Rule * > dynrules::MMapRuleManagement::loadRules ( unsigned int  maxrules  )  [virtual]

Loads a specific amount of rules.

This behaves exactly like loadRules().

Parameters:
maxrules The amount of rules to load.
Returns:
A std::vector containing the loaded rules.

Implements dynrules::RuleManagement.

Definition at line 37 of file MMapRuleManagement.cpp.

std::vector< Rule * > dynrules::MMapRuleManagement::loadRules (  )  [virtual]

Loads all existing rules.

Returns:
A vector containing the Rule objects hold by this instance. The caller should not free the returned results.

Implements dynrules::RuleManagement.

Definition at line 32 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.

Parameters:
rules A std::vector containing the rules to save.
Returns:
true, if saving the rules was successful, false otherwise.

Implements dynrules::RuleManagement.

Definition at line 42 of file MMapRuleManagement.cpp.


The documentation for this class was generated from the following files:
 All Classes Functions Variables
Generated on Wed May 19 08:35:11 2010 for dynrules by  doxygen 1.6.3