DISPLACE
1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
|
A class that implements a Singleton for managing the Decision Trees for vessels. More...
#include <decisiontreemanager.h>
Public Types | |
enum | TreeType { InvalidTreeType = -1, GoFishing, ChooseGround, StartFishing, ChangeGround, StopFishing, ChoosePort, SIZE } |
An enumerated type to identify which tree to refer. They are internally used as index to various container classes (mostly vectors) so don't change the integer values, especially for InvalidTreeType and SIZE (that must be the last). More... | |
Public Member Functions | |
int | readFromDirectory (std::string path) |
Read all the dtrees in a directory, returning the number of loaded trees. More... | |
int | readFromScenario (std::string path, displace::commons::Scenario scenario) |
std::shared_ptr< dtree::DecisionTree > | tree (TreeType type) |
Returns a reference to the specified tree. More... | |
bool | hasTree (TreeType type) |
bool | hasTreeVariable (TreeType type, dtree::Variable variable) const |
Static Public Member Functions | |
static DecisionTreeManager * | manager () |
returns the instance of the singleton. Uses lazy initialization to proper initialize the instance. More... | |
static std::string | treeTypeCode (TreeType type) |
static TreeType | treeTypeFromCode (std::string code) |
Protected Member Functions | |
bool | readFile (std::string filename) |
Loads a specific file, creating the dtree and allocating it to the type specified in the file. More... | |
void | readScenarioFileIfAvailable (std::string path, std::string scenarioname) |
A class that implements a Singleton for managing the Decision Trees for vessels.
An enumerated type to identify which tree to refer. They are internally used as index to various container classes (mostly vectors) so don't change the integer values, especially for InvalidTreeType and SIZE (that must be the last).
Enumerator | |
---|---|
InvalidTreeType | |
GoFishing | |
ChooseGround | |
StartFishing | |
ChangeGround | |
StopFishing | |
ChoosePort | |
SIZE |
bool DecisionTreeManager::hasTree | ( | DecisionTreeManager::TreeType | type | ) |
bool DecisionTreeManager::hasTreeVariable | ( | DecisionTreeManager::TreeType | type, |
dtree::Variable | variable | ||
) | const |
|
inlinestatic |
returns the instance of the singleton. Uses lazy initialization to proper initialize the instance.
|
protected |
Loads a specific file, creating the dtree and allocating it to the type specified in the file.
int DecisionTreeManager::readFromDirectory | ( | std::string | path | ) |
Read all the dtrees in a directory, returning the number of loaded trees.
int DecisionTreeManager::readFromScenario | ( | std::string | path, |
displace::commons::Scenario | scenario | ||
) |
|
protected |
std::shared_ptr< dtree::DecisionTree > DecisionTreeManager::tree | ( | DecisionTreeManager::TreeType | type | ) |
Returns a reference to the specified tree.
|
static |
|
static |