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

#include <ored/portfolio/formulabasedlegdata.hpp>

+ Inheritance diagram for FormulaBasedLegData:
+ Collaboration diagram for FormulaBasedLegData:

Public Member Functions

 FormulaBasedLegData ()
 Default constructor. More...
 
 FormulaBasedLegData (const string &formulaBasedIndex, int fixingDays, bool isInArrears)
 Constructor. More...
 
Inspectors
const string & formulaBasedIndex () const
 
int fixingDays () const
 
const string & fixingCalendar () const
 
bool isInArrears () const
 
- Public Member Functions inherited from LegAdditionalData
 LegAdditionalData (const string &legType, const string &legNodeName)
 
 LegAdditionalData (const string &legType)
 
const string & legType () const
 
const string & legNodeName () const
 
const std::set< std::string > & indices () const
 
- 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 formulaBasedIndex_
 
int fixingDays_
 
string fixingCalendar_
 
bool isInArrears_
 
virtual void fromXML (XMLNode *node) override
 
virtual XMLNodetoXML (XMLDocument &doc) const override
 
void initIndices ()
 

Additional Inherited Members

- Protected Attributes inherited from LegAdditionalData
std::set< std::string > indices_
 

Detailed Description

Definition at line 32 of file formulabasedlegdata.hpp.

Constructor & Destructor Documentation

◆ FormulaBasedLegData() [1/2]

Default constructor.

Definition at line 35 of file formulabasedlegdata.hpp.

35: LegAdditionalData("FormulaBased"), fixingDays_(0), isInArrears_(false) {}
LegAdditionalData(const string &legType, const string &legNodeName)
Definition: legdata.hpp:65

◆ FormulaBasedLegData() [2/2]

FormulaBasedLegData ( const string &  formulaBasedIndex,
int  fixingDays,
bool  isInArrears 
)

Constructor.

Definition at line 37 of file formulabasedlegdata.hpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ formulaBasedIndex()

const string & formulaBasedIndex ( ) const

Definition at line 45 of file formulabasedlegdata.hpp.

45{ return formulaBasedIndex_; }

◆ fixingDays()

int fixingDays ( ) const

Definition at line 46 of file formulabasedlegdata.hpp.

46{ return fixingDays_; }

◆ fixingCalendar()

const string & fixingCalendar ( ) const

Definition at line 47 of file formulabasedlegdata.hpp.

◆ isInArrears()

bool isInArrears ( ) const

Definition at line 48 of file formulabasedlegdata.hpp.

48{ return isInArrears_; }

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 60 of file formulabasedlegdata.cpp.

60 {
62 formulaBasedIndex_ = XMLUtils::getChildValue(node, "Index", true);
63 fixingDays_ = XMLUtils::getChildValueAsInt(node, "FixingDays", true);
64 // These are all optional
65 XMLNode* arrNode = XMLUtils::getChildNode(node, "IsInArrears");
66 if (arrNode)
67 isInArrears_ = XMLUtils::getChildValueAsBool(node, "IsInArrears", true);
68 else
69 isInArrears_ = false; // default to fixing-in-advance
70 fixingCalendar_ = XMLUtils::getChildValue(node, "FixingCalendar"); // defaults to empty string
72}
const string & legNodeName() const
Definition: legdata.hpp:70
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
static XMLNode * getChildNode(XMLNode *n, const string &name="")
Definition: xmlutils.cpp:387
static int getChildValueAsInt(XMLNode *node, const string &name, bool mandatory=false, int defaultValue=0)
Definition: xmlutils.cpp:291
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 51 of file formulabasedlegdata.cpp.

51 {
52 XMLNode* node = doc.allocNode(legNodeName());
53 XMLUtils::addChild(doc, node, "Index", formulaBasedIndex_);
54 XMLUtils::addChild(doc, node, "IsInArrears", isInArrears_);
55 XMLUtils::addChild(doc, node, "FixingDays", fixingDays_);
56 XMLUtils::addChild(doc, node, "FixingCalendar", fixingCalendar_);
57 return node;
58}
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
+ Here is the call graph for this function:

◆ initIndices()

void initIndices ( )
private

Definition at line 74 of file formulabasedlegdata.cpp.

74 {
75 std::vector<std::string> variables;
76 QuantExt::CompiledFormula compiledFormula = parseFormula(formulaBasedIndex_, variables);
77 indices_.insert(variables.begin(), variables.end());
78}
std::set< std::string > indices_
Definition: legdata.hpp:77
QuantExt::CompiledFormula parseFormula(const std::string &text, std::vector< std::string > &variables)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ formulaBasedIndex_

string formulaBasedIndex_
private

Definition at line 58 of file formulabasedlegdata.hpp.

◆ fixingDays_

int fixingDays_
private

Definition at line 59 of file formulabasedlegdata.hpp.

◆ fixingCalendar_

string fixingCalendar_
private

Definition at line 60 of file formulabasedlegdata.hpp.

◆ isInArrears_

bool isInArrears_
private

Definition at line 61 of file formulabasedlegdata.hpp.