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

Serializable schedule data. More...

#include <ored/portfolio/schedule.hpp>

+ Inheritance diagram for ScheduleData:
+ Collaboration diagram for ScheduleData:

Public Member Functions

 ScheduleData ()
 Default constructor. More...
 
 ScheduleData (const ScheduleDates &dates, const string &name="")
 Constructor with ScheduleDates. More...
 
 ScheduleData (const ScheduleRules &rules, const string &name="")
 Constructor with ScheduleRules. More...
 
 ScheduleData (const ScheduleDerived &derived, const string &name="")
 Constructor with ScheduleDerived. More...
 
void addDates (const ScheduleDates &dates)
 Add dates. More...
 
void addRules (const ScheduleRules &rules)
 Add rules. More...
 
void addDerived (const ScheduleDerived &derived)
 Add derived schedules. More...
 
bool hasData () const
 Check if has any dates/rules/derived schedules. More...
 
vector< string > baseScheduleNames ()
 
Inspectors
const vector< ScheduleDates > & dates () const
 
const vector< ScheduleRules > & rules () const
 
const vector< ScheduleDerived > & derived () const
 
const string & name () const
 
const boolhasDerived () const
 
Modifiers
vector< ScheduleDates > & modifyDates ()
 
vector< ScheduleRules > & modifyRules ()
 
vector< ScheduleDerived > & modifyDerived ()
 
- 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

vector< ScheduleDatesdates_
 
vector< ScheduleRulesrules_
 
vector< ScheduleDerivedderived_
 
string name_ = ""
 
bool hasDerived_ = false
 
virtual void fromXML (XMLNode *node) override
 
virtual XMLNodetoXML (XMLDocument &doc) const override
 

Detailed Description

Serializable schedule data.

Definition at line 202 of file schedule.hpp.

Constructor & Destructor Documentation

◆ ScheduleData() [1/4]

Default constructor.

Definition at line 205 of file schedule.hpp.

205{}

◆ ScheduleData() [2/4]

ScheduleData ( const ScheduleDates dates,
const string &  name = "" 
)

Constructor with ScheduleDates.

Definition at line 207 of file schedule.hpp.

207: name_(name) { addDates(dates); }
const vector< ScheduleDates > & dates() const
Definition: schedule.hpp:228
void addDates(const ScheduleDates &dates)
Add dates.
Definition: schedule.hpp:214
const string & name() const
Definition: schedule.hpp:231
+ Here is the call graph for this function:

◆ ScheduleData() [3/4]

ScheduleData ( const ScheduleRules rules,
const string &  name = "" 
)

Constructor with ScheduleRules.

Definition at line 209 of file schedule.hpp.

209: name_(name) { addRules(rules); }
void addRules(const ScheduleRules &rules)
Add rules.
Definition: schedule.hpp:216
const vector< ScheduleRules > & rules() const
Definition: schedule.hpp:229
+ Here is the call graph for this function:

◆ ScheduleData() [4/4]

ScheduleData ( const ScheduleDerived derived,
const string &  name = "" 
)

Constructor with ScheduleDerived.

Definition at line 211 of file schedule.hpp.

const vector< ScheduleDerived > & derived() const
Definition: schedule.hpp:230
void addDerived(const ScheduleDerived &derived)
Add derived schedules.
Definition: schedule.hpp:218
+ Here is the call graph for this function:

Member Function Documentation

◆ addDates()

void addDates ( const ScheduleDates dates)

Add dates.

Definition at line 214 of file schedule.hpp.

214{ dates_.emplace_back(dates); }
vector< ScheduleDates > dates_
Definition: schedule.hpp:248
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addRules()

void addRules ( const ScheduleRules rules)

Add rules.

Definition at line 216 of file schedule.hpp.

216{ rules_.emplace_back(rules); }
vector< ScheduleRules > rules_
Definition: schedule.hpp:249
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addDerived()

void addDerived ( const ScheduleDerived derived)

Add derived schedules.

Definition at line 218 of file schedule.hpp.

218 {
219 derived_.emplace_back(derived);
220 hasDerived_ = true;
221 }
vector< ScheduleDerived > derived_
Definition: schedule.hpp:250
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasData()

bool hasData ( ) const

Check if has any dates/rules/derived schedules.

Definition at line 223 of file schedule.hpp.

223{ return dates_.size() > 0 || rules_.size() > 0 || derived_.size() > 0; }
+ Here is the caller graph for this function:

◆ baseScheduleNames()

vector< string > baseScheduleNames ( )

Definition at line 172 of file schedule.cpp.

172 {
173 vector<string> baseScheduleNames;
174 for (auto& dv : derived_)
175 baseScheduleNames.push_back(dv.baseSchedule());
176 return baseScheduleNames;
177}
vector< string > baseScheduleNames()
Definition: schedule.cpp:172
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dates()

const vector< ScheduleDates > & dates ( ) const

Definition at line 228 of file schedule.hpp.

228{ return dates_; }
+ Here is the caller graph for this function:

◆ rules()

const vector< ScheduleRules > & rules ( ) const

Definition at line 229 of file schedule.hpp.

229{ return rules_; }
+ Here is the caller graph for this function:

◆ derived()

const vector< ScheduleDerived > & derived ( ) const

Definition at line 230 of file schedule.hpp.

230{ return derived_; }
+ Here is the caller graph for this function:

◆ name()

const string & name ( ) const

Definition at line 231 of file schedule.hpp.

231{ return name_; }
+ Here is the caller graph for this function:

◆ hasDerived()

const bool & hasDerived ( ) const

Definition at line 232 of file schedule.hpp.

232{ return hasDerived_; }
+ Here is the caller graph for this function:

◆ modifyDates()

vector< ScheduleDates > & modifyDates ( )

Definition at line 237 of file schedule.hpp.

237{ return dates_; }

◆ modifyRules()

vector< ScheduleRules > & modifyRules ( )

Definition at line 238 of file schedule.hpp.

238{ return rules_; }

◆ modifyDerived()

vector< ScheduleDerived > & modifyDerived ( )

Definition at line 239 of file schedule.hpp.

239{ return derived_; }

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 179 of file schedule.cpp.

179 {
180 QL_REQUIRE(node, "ScheduleData::fromXML(): no node given");
182 for (auto& r : XMLUtils::getChildrenNodes(node, "Rules")) {
183 rules_.emplace_back();
184 rules_.back().fromXML(r);
185 }
186 for (auto& d : XMLUtils::getChildrenNodes(node, "Dates")) {
187 dates_.emplace_back();
188 dates_.back().fromXML(d);
189 }
190 for (auto& dv : XMLUtils::getChildrenNodes(node, "Derived")) {
191 derived_.emplace_back();
192 derived_.back().fromXML(dv);
193 if (!hasDerived_)
194 hasDerived_ = true;
195 }
196}
static vector< XMLNode * > getChildrenNodes(XMLNode *node, const string &name)
Returns all the children with a given name.
Definition: xmlutils.cpp:428
static string getNodeName(XMLNode *n)
Get and set a node's name.
Definition: xmlutils.cpp:473
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 198 of file schedule.cpp.

198 {
199 XMLNode* node = doc.allocNode("ScheduleData");
200 for (auto& r : rules_)
201 XMLUtils::appendNode(node, r.toXML(doc));
202 for (auto& d : dates_)
203 XMLUtils::appendNode(node, d.toXML(doc));
204 for (auto& dv : derived_)
205 XMLUtils::appendNode(node, dv.toXML(doc));
206 return node;
207}
static void appendNode(XMLNode *parent, XMLNode *child)
Definition: xmlutils.cpp:406
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ dates_

vector<ScheduleDates> dates_
private

Definition at line 248 of file schedule.hpp.

◆ rules_

vector<ScheduleRules> rules_
private

Definition at line 249 of file schedule.hpp.

◆ derived_

vector<ScheduleDerived> derived_
private

Definition at line 250 of file schedule.hpp.

◆ name_

string name_ = ""
private

Definition at line 251 of file schedule.hpp.

◆ hasDerived_

bool hasDerived_ = false
private

Definition at line 252 of file schedule.hpp.