Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
ComputeFrameworkRegistry Class Reference

#include <qle/math/computeenvironment.hpp>

+ Inheritance diagram for ComputeFrameworkRegistry:
+ Collaboration diagram for ComputeFrameworkRegistry:

Public Member Functions

 ComputeFrameworkRegistry ()
 
void add (const std::string &name, std::function< ComputeFramework *(void)> creator, const bool allowOverwrite=false)
 
const std::vector< std::function< ComputeFramework *(void)> > & getAll () const
 

Private Attributes

boost::shared_mutex mutex_
 
std::vector< std::string > names_
 
std::vector< std::function< ComputeFramework *(void)> > creators_
 

Detailed Description

Definition at line 120 of file computeenvironment.hpp.

Constructor & Destructor Documentation

◆ ComputeFrameworkRegistry()

Definition at line 122 of file computeenvironment.hpp.

122{}

Member Function Documentation

◆ add()

void add ( const std::string &  name,
std::function< ComputeFramework *(void)>  creator,
const bool  allowOverwrite = false 
)

Definition at line 80 of file computeenvironment.cpp.

81 {
82 boost::unique_lock<boost::shared_mutex> lock(mutex_);
83 QL_REQUIRE(allowOverwrite || std::find(names_.begin(), names_.end(), name) == names_.end(),
84 "FrameworkRegistry::add(): creator for '"
85 << name << "' already exists and allowOverwrite is false, can't add it.");
86 names_.push_back(name);
87 creators_.push_back(creator);
88}
std::vector< std::function< ComputeFramework *(void)> > creators_

◆ getAll()

const std::vector< std::function< ComputeFramework *(void)> > & getAll ( ) const

Definition at line 90 of file computeenvironment.cpp.

90 {
91 boost::shared_lock<boost::shared_mutex> lock(mutex_);
92 return creators_;
93}

Member Data Documentation

◆ mutex_

boost::shared_mutex mutex_
mutableprivate

Definition at line 128 of file computeenvironment.hpp.

◆ names_

std::vector<std::string> names_
private

Definition at line 129 of file computeenvironment.hpp.

◆ creators_

std::vector<std::function<ComputeFramework*(void)> > creators_
private

Definition at line 130 of file computeenvironment.hpp.