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

#include <ored/portfolio/trsunderlyingbuilder.hpp>

+ Inheritance diagram for TrsUnderlyingBuilderFactory:
+ Collaboration diagram for TrsUnderlyingBuilderFactory:

Public Member Functions

std::map< std::string, QuantLib::ext::shared_ptr< TrsUnderlyingBuilder > > getBuilders () const
 
QuantLib::ext::shared_ptr< TrsUnderlyingBuildergetBuilder (const std::string &tradeType) const
 
void addBuilder (const std::string &tradeType, const QuantLib::ext::shared_ptr< TrsUnderlyingBuilder > &builder, const bool allowOverwrite=false)
 

Private Attributes

map< std::string, QuantLib::ext::shared_ptr< TrsUnderlyingBuilder > > builders_
 
boost::shared_mutex mutex_
 

Detailed Description

Definition at line 50 of file trsunderlyingbuilder.hpp.

Member Function Documentation

◆ getBuilders()

std::map< std::string, QuantLib::ext::shared_ptr< TrsUnderlyingBuilder > > getBuilders ( ) const

Definition at line 56 of file trsunderlyingbuilder.hpp.

56 {
57 boost::shared_lock<boost::shared_mutex> lock(mutex_);
58 return builders_;
59 }
map< std::string, QuantLib::ext::shared_ptr< TrsUnderlyingBuilder > > builders_

◆ getBuilder()

QuantLib::ext::shared_ptr< TrsUnderlyingBuilder > getBuilder ( const std::string &  tradeType) const

Definition at line 63 of file trsunderlyingbuilder.cpp.

63 {
64 boost::shared_lock<boost::shared_mutex> lock(mutex_);
65 auto b = builders_.find(tradeType);
66 QL_REQUIRE(b != builders_.end(), "TrsUnderlyingBuilderFactory::getBuilder(" << tradeType << "): no builder found");
67 return b->second;
68}

◆ addBuilder()

void addBuilder ( const std::string &  tradeType,
const QuantLib::ext::shared_ptr< TrsUnderlyingBuilder > &  builder,
const bool  allowOverwrite = false 
)

Definition at line 70 of file trsunderlyingbuilder.cpp.

72 {
73 boost::unique_lock<boost::shared_mutex> locK(mutex_);
74 QL_REQUIRE(builders_.insert(std::make_pair(tradeType, builder)).second || allowOverwrite,
75 "TrsUnderlyingBuidlerFactory::addBuilder(" << tradeType << "): builder for key already exists.");
76}

Member Data Documentation

◆ builders_

map<std::string, QuantLib::ext::shared_ptr<TrsUnderlyingBuilder> > builders_
private

Definition at line 52 of file trsunderlyingbuilder.hpp.

◆ mutex_

boost::shared_mutex mutex_
mutableprivate

Definition at line 53 of file trsunderlyingbuilder.hpp.