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

#include <ored/marketdata/expiry.hpp>

+ Inheritance diagram for ExpiryPeriod:
+ Collaboration diagram for ExpiryPeriod:

Public Member Functions

 ExpiryPeriod ()
 Default constructor. More...
 
 ExpiryPeriod (const QuantLib::Period &expiryPeriod)
 Constructor with expiry period. More...
 
const QuantLib::Period & expiryPeriod () const
 Return the expiry period. More...
 
void fromString (const std::string &strExpiryPeriod) override
 
std::string toString () const override
 
- Public Member Functions inherited from Expiry
virtual ~Expiry ()
 
virtual void fromString (const std::string &strExpiry)=0
 Populate the Expiry object from strExpiry. More...
 
virtual std::string toString () const =0
 Write the Expiry object to string. More...
 

Protected Member Functions

bool equal_to (const Expiry &other) const override
 Override in derived classes to compare specific expiries. More...
 
virtual bool equal_to (const Expiry &other) const =0
 Override in derived classes to compare specific expiries. More...
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

QuantLib::Period expiryPeriod_
 

Friends

class boost::serialization::access
 Serialization. More...
 

Detailed Description

Expiry consisting of a period

Definition at line 99 of file expiry.hpp.

Constructor & Destructor Documentation

◆ ExpiryPeriod() [1/2]

Default constructor.

Definition at line 60 of file expiry.cpp.

60{}

◆ ExpiryPeriod() [2/2]

ExpiryPeriod ( const QuantLib::Period &  expiryPeriod)

Constructor with expiry period.

Member Function Documentation

◆ expiryPeriod()

const Period & expiryPeriod ( ) const

Return the expiry period.

Definition at line 64 of file expiry.cpp.

64{ return expiryPeriod_; }
QuantLib::Period expiryPeriod_
Definition: expiry.hpp:124
+ Here is the caller graph for this function:

◆ fromString()

void fromString ( const std::string &  strExpiryPeriod)
overridevirtual

Populate ExpiryPeriod object from strExpiryPeriod which should be a period. An exception is thrown if strExpiryPeriod cannot be parsed as a QuantLib::Period.

Implements Expiry.

Definition at line 66 of file expiry.cpp.

66{ expiryPeriod_ = parsePeriod(strExpiryPeriod); }
Period parsePeriod(const string &s)
Convert text to QuantLib::Period.
Definition: parsers.cpp:171
+ Here is the call graph for this function:

◆ toString()

string toString ( ) const
overridevirtual

Writes the ExpiryPeriod object to string. This returns the string representation of the expiry period.

Implements Expiry.

Definition at line 68 of file expiry.cpp.

68{ return to_string(expiryPeriod_); }
std::string to_string(const LocationInfo &l)
Definition: ast.cpp:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ equal_to()

bool equal_to ( const Expiry other) const
overrideprotectedvirtual

Override in derived classes to compare specific expiries.

Implements Expiry.

Definition at line 70 of file expiry.cpp.

70 {
71 if (const ExpiryPeriod* p = dynamic_cast<const ExpiryPeriod*>(&other)) {
72 return expiryPeriod_ == p->expiryPeriod();
73 } else {
74 return false;
75 }
76}
ExpiryPeriod()
Default constructor.
Definition: expiry.cpp:60

◆ serialize()

template void serialize ( Archive &  ar,
const unsigned int  version 
)
private

Definition at line 78 of file expiry.cpp.

78 {
79 ar& boost::serialization::base_object<Expiry>(*this);
80 ar& expiryPeriod_;
81}

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Serialization.

Definition at line 126 of file expiry.hpp.

Member Data Documentation

◆ expiryPeriod_

QuantLib::Period expiryPeriod_
private

Definition at line 124 of file expiry.hpp.