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
FutureContinuationExpiry Class Reference

#include <ored/marketdata/expiry.hpp>

+ Inheritance diagram for FutureContinuationExpiry:
+ Collaboration diagram for FutureContinuationExpiry:

Public Member Functions

 FutureContinuationExpiry (QuantLib::Natural expiryIndex=1)
 Constructor with optional explicit future continuation index. More...
 
QuantLib::Natural expiryIndex () const
 Return the future continuation expiry index. More...
 
void fromString (const std::string &strIndex) 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::Natural expiryIndex_
 

Friends

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

Detailed Description

Expiry represented by a future continuation index

Definition at line 132 of file expiry.hpp.

Constructor & Destructor Documentation

◆ FutureContinuationExpiry()

FutureContinuationExpiry ( QuantLib::Natural  expiryIndex = 1)

Constructor with optional explicit future continuation index.

Definition at line 83 of file expiry.cpp.

QuantLib::Natural expiryIndex() const
Return the future continuation expiry index.
Definition: expiry.cpp:85
QuantLib::Natural expiryIndex_
Definition: expiry.hpp:154

Member Function Documentation

◆ expiryIndex()

QuantLib::Natural expiryIndex ( ) const

Return the future continuation expiry index.

Definition at line 85 of file expiry.cpp.

85{ return expiryIndex_; }
+ Here is the caller graph for this function:

◆ fromString()

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

Populate FutureContinuationExpiry object from strIndex which should be of the form c<Index> where Index is a positive integer. An exception is thrown if strIndex is not of this form.

Implements Expiry.

Definition at line 87 of file expiry.cpp.

87 {
88 QL_REQUIRE(strIndex.size() > 1, "Future continuation expiry must have at least 2 characters");
89 QL_REQUIRE(strIndex.at(0) == 'c', "Future continuation expiry string must start with a 'c'");
90 expiryIndex_ = parseInteger(strIndex.substr(1));
91}
Integer parseInteger(const string &s)
Convert text to QuantLib::Integer.
Definition: parsers.cpp:136
+ Here is the call graph for this function:

◆ toString()

string toString ( ) const
overridevirtual

Writes the FutureContinuationExpiry object to string. This returns the string representation of the future continuation index i.e. a string of the form c<Index>.

Implements Expiry.

Definition at line 93 of file expiry.cpp.

93{ return "c" + to_string(expiryIndex_); }
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 95 of file expiry.cpp.

95 {
96 if (const FutureContinuationExpiry* p = dynamic_cast<const FutureContinuationExpiry*>(&other)) {
97 return expiryIndex_ == p->expiryIndex();
98 } else {
99 return false;
100 }
101}
FutureContinuationExpiry(QuantLib::Natural expiryIndex=1)
Constructor with optional explicit future continuation index.
Definition: expiry.cpp:83

◆ serialize()

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

Definition at line 103 of file expiry.cpp.

103 {
104 ar& boost::serialization::base_object<Expiry>(*this);
105 ar& expiryIndex_;
106}

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Serialization.

Definition at line 156 of file expiry.hpp.

Member Data Documentation

◆ expiryIndex_

QuantLib::Natural expiryIndex_
private

Definition at line 154 of file expiry.hpp.