The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::FunctionManager Class Reference

Singleton Function Manager class. This class contains two maps and one constant string token. These maps contain a string as key and function pointers as value. The string key is the same as the name of the free functions as defined by the users and the keys are the function pointers to those methods. One map is dedicated for HistogramTreeNodes while the other is dedicated for CycleHistogramTreeNodes. This was necessary because these two classes do not share a common polymorphic base. More...

#include <HistogramFunctionManager.hpp>

Public Member Functions

 FunctionManager (const FunctionManager &)=delete
 Not copy-constructable.
 
 FunctionManager (FunctionManager &&)=delete
 Not move-constructable.
 
FunctionManageroperator= (const FunctionManager &)=delete
 Not copy-assignable.
 
FunctionManageroperator= (FunctionManager *&)=delete
 Not move-assignable.
 
const std::string & getToken () const
 This method returns the constant string "hist_def" which should be prefixed in the stat pathnames in yaml files by users.
 
template<typename T >
MetaStruct::enable_if_t< std::is_same< MetaStruct::decay_t< T >, CycleHistogramTreeNode >::value, void > add (const std::string &name, HistStatCalcFcn< T > fcn)
 This method adds an entry to one of the internal maps. This method takes as parameters, a string name of the free function as the user calls it and the function pointer to the same method. This method is enabled only when users are using a CycleHistogramTreeNode.
 
template<typename T >
MetaStruct::enable_if_t< std::is_same< MetaStruct::decay_t< T >, HistogramTreeNode >::value, void > add (const std::string &name, HistStatCalcFcn< T > fcn)
 This method adds an entry to one of the internal maps. This method takes as parameters, a string name of the free function as the user calls it and the function pointer to the same method. This method is enabled only when users are using a HistogramTreeNode.
 
template<typename T >
MetaStruct::enable_if_t< std::is_same< MetaStruct::decay_t< T >, CycleHistogramTreeNode >::value, HistStatCalcFcn< T > & > find (const std::string &name)
 This method finds the function pointer mapped to the name. This method takes as parameters, a string name of the free function as the user calls it. It looks through its internal map to find the correct function pointer and returns it. This method is enable only when users are using a CycleHistogramTreeNode.
 
template<typename T >
MetaStruct::enable_if_t< std::is_same< MetaStruct::decay_t< T >, HistogramTreeNode >::value, HistStatCalcFcn< T > & > find (const std::string &name)
 This method finds the function pointer mapped to the name. This method takes as parameters, a string name of the free function as the user calls it. It looks through its internal map to find the correct function pointer and returns it. This method is enable only when users are using a HistogramTreeNode.
 

Static Public Member Functions

static FunctionManagerget ()
 This method returns the singleton instance of Function Manager.
 

Detailed Description

Singleton Function Manager class. This class contains two maps and one constant string token. These maps contain a string as key and function pointers as value. The string key is the same as the name of the free functions as defined by the users and the keys are the function pointers to those methods. One map is dedicated for HistogramTreeNodes while the other is dedicated for CycleHistogramTreeNodes. This was necessary because these two classes do not share a common polymorphic base.

Definition at line 87 of file HistogramFunctionManager.hpp.

Member Function Documentation

◆ add() [1/2]

template<typename T >
MetaStruct::enable_if_t< std::is_same< MetaStruct::decay_t< T >, CycleHistogramTreeNode >::value, void > sparta::FunctionManager::add ( const std::string &  name,
HistStatCalcFcn< T >  fcn 
)
inline

This method adds an entry to one of the internal maps. This method takes as parameters, a string name of the free function as the user calls it and the function pointer to the same method. This method is enabled only when users are using a CycleHistogramTreeNode.

Definition at line 138 of file HistogramFunctionManager.hpp.

◆ add() [2/2]

template<typename T >
MetaStruct::enable_if_t< std::is_same< MetaStruct::decay_t< T >, HistogramTreeNode >::value, void > sparta::FunctionManager::add ( const std::string &  name,
HistStatCalcFcn< T >  fcn 
)
inline

This method adds an entry to one of the internal maps. This method takes as parameters, a string name of the free function as the user calls it and the function pointer to the same method. This method is enabled only when users are using a HistogramTreeNode.

Definition at line 160 of file HistogramFunctionManager.hpp.

◆ find() [1/2]

template<typename T >
MetaStruct::enable_if_t< std::is_same< MetaStruct::decay_t< T >, CycleHistogramTreeNode >::value, HistStatCalcFcn< T > & > sparta::FunctionManager::find ( const std::string &  name)
inline

This method finds the function pointer mapped to the name. This method takes as parameters, a string name of the free function as the user calls it. It looks through its internal map to find the correct function pointer and returns it. This method is enable only when users are using a CycleHistogramTreeNode.

Definition at line 184 of file HistogramFunctionManager.hpp.

◆ find() [2/2]

template<typename T >
MetaStruct::enable_if_t< std::is_same< MetaStruct::decay_t< T >, HistogramTreeNode >::value, HistStatCalcFcn< T > & > sparta::FunctionManager::find ( const std::string &  name)
inline

This method finds the function pointer mapped to the name. This method takes as parameters, a string name of the free function as the user calls it. It looks through its internal map to find the correct function pointer and returns it. This method is enable only when users are using a HistogramTreeNode.

Definition at line 209 of file HistogramFunctionManager.hpp.

◆ get()

static FunctionManager & sparta::FunctionManager::get ( )
inlinestatic

This method returns the singleton instance of Function Manager.

Definition at line 113 of file HistogramFunctionManager.hpp.

◆ getToken()

const std::string & sparta::FunctionManager::getToken ( ) const
inline

This method returns the constant string "hist_def" which should be prefixed in the stat pathnames in yaml files by users.

Definition at line 122 of file HistogramFunctionManager.hpp.


The documentation for this class was generated from the following file: