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

Serializable object holding schedule Rules data. More...

#include <ored/portfolio/schedule.hpp>

+ Inheritance diagram for ScheduleRules:
+ Collaboration diagram for ScheduleRules:

Public Member Functions

 ScheduleRules ()
 Default constructor. More...
 
 ScheduleRules (const string &startDate, const string &endDate, const string &tenor, const string &calendar, const string &convention, const string &termConvention, const string &rule, const string &endOfMonth="N", const string &firstDate="", const string &lastDate="", const bool removeFirstDate=false, const bool removeLastDate=false, const string &endOfMonthConvention="")
 
const bool hasData () const
 Check if key attributes are empty. More...
 
Inspectors
const string & startDate () const
 
const string & endDate () const
 
const string & tenor () const
 
const string & calendar () const
 
const string & convention () const
 
const string & termConvention () const
 
const string & rule () const
 
const string & endOfMonth () const
 
const string & endOfMonthConvention () const
 
const string & firstDate () const
 
const string & lastDate () const
 
bool removeFirstDate () const
 
bool removeLastDate () const
 
Modifiers
string & modifyStartDate ()
 
string & modifyEndDate ()
 
string & modifyCalendar ()
 
string & modifyConvention ()
 
string & modifyTermConvention ()
 
string & modifyEndOfMonthConvention ()
 
- Public Member Functions inherited from XMLSerializable
virtual ~XMLSerializable ()
 
virtual void fromXML (XMLNode *node)=0
 
virtual XMLNodetoXML (XMLDocument &doc) const =0
 
void fromFile (const std::string &filename)
 
void toFile (const std::string &filename) const
 
void fromXMLString (const std::string &xml)
 Parse from XML string. More...
 
std::string toXMLString () const
 Parse from XML string. More...
 

Serialisation

string startDate_
 
string endDate_
 
string tenor_
 
string calendar_
 
string convention_
 
string termConvention_
 
string rule_
 
string endOfMonth_
 
string endOfMonthConvention_
 
string firstDate_
 
string lastDate_
 
bool adjustEndDateToPreviousMonthEnd_ {false}
 
bool removeFirstDate_ = false
 
bool removeLastDate_ = false
 
bool was1T_ = false
 
virtual void fromXML (XMLNode *node) override
 
virtual XMLNodetoXML (XMLDocument &doc) const override
 

Detailed Description

Serializable object holding schedule Rules data.

Definition at line 37 of file schedule.hpp.

Constructor & Destructor Documentation

◆ ScheduleRules() [1/2]

Default constructor.

Definition at line 40 of file schedule.hpp.

40{}

◆ ScheduleRules() [2/2]

ScheduleRules ( const string &  startDate,
const string &  endDate,
const string &  tenor,
const string &  calendar,
const string &  convention,
const string &  termConvention,
const string &  rule,
const string &  endOfMonth = "N",
const string &  firstDate = "",
const string &  lastDate = "",
const bool  removeFirstDate = false,
const bool  removeLastDate = false,
const string &  endOfMonthConvention = "" 
)

Definition at line 42 of file schedule.hpp.

const string & termConvention() const
Definition: schedule.hpp:63
const string & endDate() const
Definition: schedule.hpp:59
const string & endOfMonthConvention() const
Definition: schedule.hpp:66
const string & rule() const
Definition: schedule.hpp:64
const string & startDate() const
Definition: schedule.hpp:57
bool removeLastDate() const
Definition: schedule.hpp:70
const string & convention() const
Definition: schedule.hpp:62
const string & lastDate() const
Definition: schedule.hpp:68
const string & tenor() const
Definition: schedule.hpp:60
const string & calendar() const
Definition: schedule.hpp:61
bool removeFirstDate() const
Definition: schedule.hpp:69
const string & endOfMonth() const
Definition: schedule.hpp:65
const string & firstDate() const
Definition: schedule.hpp:67

Member Function Documentation

◆ hasData()

const bool hasData ( ) const

Check if key attributes are empty.

Definition at line 53 of file schedule.hpp.

53{ return !startDate_.empty() && !tenor_.empty(); }

◆ startDate()

const string & startDate ( ) const

Definition at line 57 of file schedule.hpp.

57{ return startDate_; }

◆ endDate()

const string & endDate ( ) const

Definition at line 59 of file schedule.hpp.

59{ return endDate_; }

◆ tenor()

const string & tenor ( ) const

Definition at line 60 of file schedule.hpp.

60{ return tenor_; }

◆ calendar()

const string & calendar ( ) const

Definition at line 61 of file schedule.hpp.

61{ return calendar_; }

◆ convention()

const string & convention ( ) const

Definition at line 62 of file schedule.hpp.

62{ return convention_; }

◆ termConvention()

const string & termConvention ( ) const

Definition at line 63 of file schedule.hpp.

63{ return termConvention_; }

◆ rule()

const string & rule ( ) const

Definition at line 64 of file schedule.hpp.

64{ return rule_; }

◆ endOfMonth()

const string & endOfMonth ( ) const

Definition at line 65 of file schedule.hpp.

65{ return endOfMonth_; }

◆ endOfMonthConvention()

const string & endOfMonthConvention ( ) const

Definition at line 66 of file schedule.hpp.

66{ return endOfMonthConvention_; }

◆ firstDate()

const string & firstDate ( ) const

Definition at line 67 of file schedule.hpp.

67{ return firstDate_; }

◆ lastDate()

const string & lastDate ( ) const

Definition at line 68 of file schedule.hpp.

68{ return lastDate_; }

◆ removeFirstDate()

bool removeFirstDate ( ) const

Definition at line 69 of file schedule.hpp.

69{ return removeFirstDate_; }

◆ removeLastDate()

bool removeLastDate ( ) const

Definition at line 70 of file schedule.hpp.

70{ return removeLastDate_; }

◆ modifyStartDate()

string & modifyStartDate ( )

Definition at line 75 of file schedule.hpp.

75{ return startDate_; }

◆ modifyEndDate()

string & modifyEndDate ( )

Definition at line 76 of file schedule.hpp.

76{ return endDate_; }

◆ modifyCalendar()

string & modifyCalendar ( )

Definition at line 77 of file schedule.hpp.

77{ return calendar_; }

◆ modifyConvention()

string & modifyConvention ( )

Definition at line 78 of file schedule.hpp.

78{ return convention_; }

◆ modifyTermConvention()

string & modifyTermConvention ( )

Definition at line 79 of file schedule.hpp.

79{ return termConvention_; }

◆ modifyEndOfMonthConvention()

string & modifyEndOfMonthConvention ( )

Definition at line 80 of file schedule.hpp.

80{ return endOfMonthConvention_; }

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 75 of file schedule.cpp.

75 {
76 XMLUtils::checkNode(node, "Rules");
77 startDate_ = XMLUtils::getChildValue(node, "StartDate");
78 endDate_ = XMLUtils::getChildValue(node, "EndDate", false);
79 adjustEndDateToPreviousMonthEnd_ = XMLUtils::getChildValueAsBool(node, "AdjustEndDateToPreviousMonthEnd", false, false);
81 auto ed = parseDate(endDate_);
82 while(!Date::isEndOfMonth(ed))ed--;
83 endDate_ = to_string(ed);
84 }
85 tenor_ = XMLUtils::getChildValue(node, "Tenor") == "1T" ? "0D" : XMLUtils::getChildValue(node, "Tenor");
86 was1T_ = XMLUtils::getChildValue(node, "Tenor") == "1T" ? true : false;
87 calendar_ = XMLUtils::getChildValue(node, "Calendar");
88 convention_ = XMLUtils::getChildValue(node, "Convention");
89 termConvention_ = XMLUtils::getChildValue(node, "TermConvention", false);
90 if (termConvention_.empty()) {
92 }
93 rule_ = XMLUtils::getChildValue(node, "Rule");
94 endOfMonth_ = XMLUtils::getChildValue(node, "EndOfMonth");
95 endOfMonthConvention_ = XMLUtils::getChildValue(node, "EndOfMonthConvention");
96 firstDate_ = XMLUtils::getChildValue(node, "FirstDate");
97 lastDate_ = XMLUtils::getChildValue(node, "LastDate");
98 removeFirstDate_ = XMLUtils::getChildValueAsBool(node, "RemoveFirstDate", false, false);
99 removeLastDate_ = XMLUtils::getChildValueAsBool(node, "RemoveLastDate", false, false);
100}
static void checkNode(XMLNode *n, const string &expectedName)
Definition: xmlutils.cpp:175
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
Definition: xmlutils.cpp:277
static bool getChildValueAsBool(XMLNode *node, const string &name, bool mandatory=false, bool defaultValue=true)
Definition: xmlutils.cpp:296
Date parseDate(const string &s)
Convert std::string to QuantLib::Date.
Definition: parsers.cpp:51
std::string to_string(const LocationInfo &l)
Definition: ast.cpp:28
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 102 of file schedule.cpp.

102 {
103 XMLNode* rules = doc.allocNode("Rules");
104 XMLUtils::addChild(doc, rules, "StartDate", startDate_);
105 if (!endDate_.empty())
106 XMLUtils::addChild(doc, rules, "EndDate", endDate_);
107 XMLUtils::addChild(doc, rules, "Tenor", was1T_ ? "1T" : tenor_);
108 XMLUtils::addChild(doc, rules, "Calendar", calendar_);
109 XMLUtils::addChild(doc, rules, "Convention", convention_);
110 XMLUtils::addChild(doc, rules, "TermConvention", termConvention_);
111 XMLUtils::addChild(doc, rules, "Rule", rule_);
112 XMLUtils::addChild(doc, rules, "EndOfMonth", endOfMonth_);
113 if (!endOfMonthConvention_.empty())
114 XMLUtils::addChild(doc, rules, "EndOfMonthConvention", endOfMonthConvention_);
115 XMLUtils::addChild(doc, rules, "FirstDate", firstDate_);
116 XMLUtils::addChild(doc, rules, "LastDate", lastDate_);
118 XMLUtils::addChild(doc,rules,"RemoveFirstDate", removeFirstDate_);
120 XMLUtils::addChild(doc,rules,"RemoveLastDate", removeLastDate_);
121 return rules;
122}
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
+ Here is the call graph for this function:

Member Data Documentation

◆ startDate_

string startDate_
private

Definition at line 89 of file schedule.hpp.

◆ endDate_

string endDate_
private

Definition at line 90 of file schedule.hpp.

◆ tenor_

string tenor_
private

Definition at line 91 of file schedule.hpp.

◆ calendar_

string calendar_
private

Definition at line 92 of file schedule.hpp.

◆ convention_

string convention_
private

Definition at line 93 of file schedule.hpp.

◆ termConvention_

string termConvention_
private

Definition at line 94 of file schedule.hpp.

◆ rule_

string rule_
private

Definition at line 95 of file schedule.hpp.

◆ endOfMonth_

string endOfMonth_
private

Definition at line 96 of file schedule.hpp.

◆ endOfMonthConvention_

string endOfMonthConvention_
private

Definition at line 97 of file schedule.hpp.

◆ firstDate_

string firstDate_
private

Definition at line 98 of file schedule.hpp.

◆ lastDate_

string lastDate_
private

Definition at line 99 of file schedule.hpp.

◆ adjustEndDateToPreviousMonthEnd_

bool adjustEndDateToPreviousMonthEnd_ {false}
private

Definition at line 100 of file schedule.hpp.

◆ removeFirstDate_

bool removeFirstDate_ = false
private

Definition at line 101 of file schedule.hpp.

◆ removeLastDate_

bool removeLastDate_ = false
private

Definition at line 102 of file schedule.hpp.

◆ was1T_

bool was1T_ = false
private

Definition at line 103 of file schedule.hpp.