QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Settings Class Reference

global repository for run-time library settings More...

#include <settings.hpp>

+ Inheritance diagram for Settings:
+ Collaboration diagram for Settings:

Classes

class  DateProxy
 

Public Member Functions

DateProxyevaluationDate ()
 the date at which pricing is to be performed. More...
 
const DateProxyevaluationDate () const
 
void anchorEvaluationDate ()
 
void resetEvaluationDate ()
 
boolincludeReferenceDateEvents ()
 
bool includeReferenceDateEvents () const
 
ext::optional< bool > & includeTodaysCashFlows ()
 
ext::optional< boolincludeTodaysCashFlows () const
 
boolenforcesTodaysHistoricFixings ()
 
bool enforcesTodaysHistoricFixings () const
 
- Public Member Functions inherited from Singleton< Settings >
 Singleton (const Singleton &)=delete
 
 Singleton (Singleton &&)=delete
 
Singletonoperator= (const Singleton &)=delete
 
Singletonoperator= (Singleton &&)=delete
 
 ~Singleton ()=default
 

Private Member Functions

 Settings ()
 

Private Attributes

DateProxy evaluationDate_
 
bool includeReferenceDateEvents_ = false
 
ext::optional< boolincludeTodaysCashFlows_
 
bool enforcesTodaysHistoricFixings_ = false
 

Friends

class Singleton< Settings >
 
std::ostream & operator<< (std::ostream &, const DateProxy &)
 

Additional Inherited Members

- Static Public Member Functions inherited from Singleton< Settings >
static Settingsinstance ()
 access to the unique instance More...
 
- Protected Member Functions inherited from Singleton< Settings >
 Singleton ()=default
 

Detailed Description

global repository for run-time library settings

Definition at line 37 of file settings.hpp.

Constructor & Destructor Documentation

◆ Settings()

Settings ( )
privatedefault

Member Function Documentation

◆ evaluationDate() [1/2]

Settings::DateProxy & evaluationDate ( )

the date at which pricing is to be performed.

Client code can inspect the evaluation date, as in:

Concrete date class.
Definition: date.hpp:125
DateProxy & evaluationDate()
the date at which pricing is to be performed.
Definition: settings.hpp:147
static Settings & instance()
access to the unique instance
Definition: singleton.hpp:104
Date d

where today's date is returned if the evaluation date is set to the null date (its default value;) can set it to a new value, as in:

and can register with it, as in:

to be notified when it is set to a new value.

Warning:
a notification is not sent when the evaluation date changes for natural causes—i.e., a date was not explicitly set (which results in today's date being used for pricing) and the current date changes as the clock strikes midnight.

Definition at line 147 of file settings.hpp.

+ Here is the caller graph for this function:

◆ evaluationDate() [2/2]

const Settings::DateProxy & evaluationDate ( ) const

Definition at line 151 of file settings.hpp.

◆ anchorEvaluationDate()

void anchorEvaluationDate ( )

Call this to prevent the evaluation date to change at midnight (and, incidentally, to gain quite a bit of performance.) If no evaluation date was previously set, it is equivalent to setting the evaluation date to Date::todaysDate(); if an evaluation date other than Date() was already set, it has no effect.

Definition at line 38 of file settings.cpp.

+ Here is the call graph for this function:

◆ resetEvaluationDate()

void resetEvaluationDate ( )

Call this to reset the evaluation date to Date::todaysDate() and allow it to change at midnight. It is equivalent to setting the evaluation date to Date(). This comes at the price of losing some performance, since the evaluation date is re-evaluated each time it is read.

Definition at line 45 of file settings.cpp.

◆ includeReferenceDateEvents() [1/2]

bool & includeReferenceDateEvents ( )

This flag specifies whether or not Events occurring on the reference date should, by default, be taken into account as not happened yet. It can be overridden locally when calling the Event::hasOccurred method.

Definition at line 155 of file settings.hpp.

+ Here is the caller graph for this function:

◆ includeReferenceDateEvents() [2/2]

bool includeReferenceDateEvents ( ) const

Definition at line 159 of file settings.hpp.

◆ includeTodaysCashFlows() [1/2]

ext::optional< bool > & includeTodaysCashFlows ( )

If set, this flag specifies whether or not CashFlows occurring on today's date should enter the NPV. When the NPV date (i.e., the date at which the cash flows are discounted) equals today's date, this flag overrides the behavior chosen for includeReferenceDate. It cannot be overridden locally when calling the CashFlow::hasOccurred method.

Definition at line 163 of file settings.hpp.

+ Here is the caller graph for this function:

◆ includeTodaysCashFlows() [2/2]

ext::optional< bool > includeTodaysCashFlows ( ) const

Definition at line 167 of file settings.hpp.

◆ enforcesTodaysHistoricFixings() [1/2]

bool & enforcesTodaysHistoricFixings ( )

Definition at line 171 of file settings.hpp.

+ Here is the caller graph for this function:

◆ enforcesTodaysHistoricFixings() [2/2]

bool enforcesTodaysHistoricFixings ( ) const

Definition at line 175 of file settings.hpp.

Friends And Related Function Documentation

◆ Singleton< Settings >

friend class Singleton< Settings >
friend

Definition at line 175 of file settings.hpp.

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
const DateProxy p 
)
friend

Definition at line 29 of file settings.cpp.

Member Data Documentation

◆ evaluationDate_

DateProxy evaluationDate_
private

Definition at line 112 of file settings.hpp.

◆ includeReferenceDateEvents_

bool includeReferenceDateEvents_ = false
private

Definition at line 113 of file settings.hpp.

◆ includeTodaysCashFlows_

ext::optional<bool> includeTodaysCashFlows_
private

Definition at line 114 of file settings.hpp.

◆ enforcesTodaysHistoricFixings_

bool enforcesTodaysHistoricFixings_ = false
private

Definition at line 115 of file settings.hpp.