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

IndexNameTranslator. More...

#include <ored/utilities/indexnametranslator.hpp>

+ Inheritance diagram for IndexNameTranslator:
+ Collaboration diagram for IndexNameTranslator:

Public Member Functions

std::string oreName (const std::string &qlName) const
 throws if qlName is not known More...
 
std::string qlName (const std::string &oreName) const
 throws if oreName is not known More...
 
void add (const std::string &qlName, const std::string &oreName)
 adds a pair to the mapping More...
 
void clear ()
 clears the mapping More...
 

Private Attributes

boost::bimap< std::string, std::string > data_
 
boost::shared_mutex mutex_
 

Detailed Description

IndexNameTranslator.

Allows translating from QuantLib::Index::name() to the ORE name that parses to that index and vice versa.

Definition at line 39 of file indexnametranslator.hpp.

Member Function Documentation

◆ oreName()

std::string oreName ( const std::string &  qlName) const

throws if qlName is not known

Definition at line 27 of file indexnametranslator.cpp.

27 {
28 boost::shared_lock<boost::shared_mutex> lock(mutex_);
29 auto n = data_.left.find(qlName);
30 if (n == data_.left.end())
31 return qlName;
32 else
33 return n->second;
34}
boost::bimap< std::string, std::string > data_
std::string qlName(const std::string &oreName) const
throws if oreName is not known
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qlName()

std::string qlName ( const std::string &  oreName) const

throws if oreName is not known

Definition at line 36 of file indexnametranslator.cpp.

36 {
37 boost::shared_lock<boost::shared_mutex> lock(mutex_);
38 auto n = data_.right.find(oreName);
39 QL_REQUIRE(n != data_.right.end(), "IndexNameTranslator: oreName '" << oreName << "' not found.");
40 return n->second;
41}
std::string oreName(const std::string &qlName) const
throws if qlName is not known
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add()

void add ( const std::string &  qlName,
const std::string &  oreName 
)

adds a pair to the mapping

Definition at line 43 of file indexnametranslator.cpp.

43 {
44 boost::unique_lock<boost::shared_mutex> lock(mutex_);
45 data_.insert(boost::bimap<std::string, std::string>::value_type(qlName, oreName));
46 TLOG("IndexNameTranslator: adding '" << qlName << "' <-> '" << oreName << "'");
47}
#define TLOG(text)
Logging Macro (Level = Data)
Definition: log.hpp:556
+ Here is the call graph for this function:

◆ clear()

void clear ( )

clears the mapping

Definition at line 49 of file indexnametranslator.cpp.

49 {
50 boost::unique_lock<boost::shared_mutex> lock(mutex_);
51 data_.clear();
52}

Member Data Documentation

◆ data_

boost::bimap<std::string, std::string> data_
private

Definition at line 54 of file indexnametranslator.hpp.

◆ mutex_

boost::shared_mutex mutex_
mutableprivate

Definition at line 55 of file indexnametranslator.hpp.