The Sparta Modeling Framework
|
Public Member Functions | |
StatInstCalculator (const SpartaHandler &handler, const double &aggregated_value) | |
double | getCurrentValue () const |
void | setNode (const TreeNode *node) |
const TreeNode * | getNode () const |
Definition at line 32 of file StatInstCalculator.hpp.
|
inline |
Give the calculator a SpartaHandler to your own code which performs the calculation, as well as a variable in your code which holds the calculated value. For example:
class MyFoo { public: MyFoo() { auto cb = CREATE_SPARTA_HANDLER(MyFoo, randomNum_); std::shared_ptr<StatInstCalculator> calc( new StatInstCalculator(cb, my_random_num_)); //Do whatever you want with this 'calc' object, //such as creating a StatisticInstance out of //it for evaluation (in reports, etc.) } private: void randomNum_() { my_random_num_ = (double)rand(); } double my_random_num_ = 0; };
Definition at line 60 of file StatInstCalculator.hpp.
|
inline |
Invoke the user's SpartaHandler to perform the calculation, and return the result.
Definition at line 68 of file StatInstCalculator.hpp.
|
inline |
Return the TreeNode to which this calculator belongs
Definition at line 85 of file StatInstCalculator.hpp.
|
inline |
If you want to give this StatInstCalculator to a StatisticInstance (for getting these calculated values into a SPARTA report for instance) then you need to give this object the TreeNode to which it belongs.
Definition at line 77 of file StatInstCalculator.hpp.