A simple rule container. More...
#include <Rule.h>
Public Member Functions | |
Rule () | |
Creates a new Rule instance. | |
Rule (int id) | |
Creates a new Rule instance with an unique id. More... | |
Rule (int id, std::string code) | |
Creates a new Rule instance with an unique id and code. More... | |
Rule (int id, double weight) | |
Creates a new Rule instance with an unique id and weight. More... | |
Rule (int id, std::string code, double weight) | |
Creates a new Rule instance. More... | |
virtual | ~Rule () |
Destroys the Rule. | |
double | getWeight () const |
Gets the weight of the Rule. More... | |
void | setWeight (double weight) |
Sets the weight of the Rule. More... | |
bool | getUsed () const |
Gets whether the Rule was used or not. More... | |
void | setUsed (bool used) |
Sets whether the Rule was used or not. More... | |
int | getId () const |
Gets the (unique) id of the Rule. More... | |
void | setId (int id) |
Sets the (unique) id of the Rule. More... | |
std::string | getCode () const |
Gets the code hold by the Rule. More... | |
void | setCode (const std::string &code) |
Sets the code to hold by the Rule. More... | |
bool | operator== (const Rule &rule) |
Compares the rule with another Rule. More... | |
Protected Attributes | |
int | _id |
The (unique) id. | |
double | _weight |
The current weight. | |
bool | _used |
Usage flag indicating whether the Rule was executed. | |
std::string | _code |
The code to execute. | |
A simple rule container.
Rule is a simple class type that carries a weight indicator and arbitrary code data for usage in the dynamic script generation process.
dynrules::Rule::Rule | ( | int | id | ) |
dynrules::Rule::Rule | ( | int | id, |
std::string | code | ||
) |
dynrules::Rule::Rule | ( | int | id, |
double | weight | ||
) |
dynrules::Rule::Rule | ( | int | id, |
std::string | code, | ||
double | weight | ||
) |
std::string dynrules::Rule::getCode | ( | ) | const |
int dynrules::Rule::getId | ( | ) | const |
bool dynrules::Rule::getUsed | ( | ) | const |
double dynrules::Rule::getWeight | ( | ) | const |
bool dynrules::Rule::operator== | ( | const Rule & | rule | ) |
void dynrules::Rule::setCode | ( | const std::string & | code | ) |
void dynrules::Rule::setId | ( | int | id | ) |
void dynrules::Rule::setUsed | ( | bool | used | ) |
void dynrules::Rule::setWeight | ( | double | weight | ) |