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

Serializable object holding generic trade actions. More...

#include <ored/portfolio/tradeactions.hpp>

+ Inheritance diagram for TradeActions:
+ Collaboration diagram for TradeActions:

Public Member Functions

 TradeActions (const vector< TradeAction > &actions=vector< TradeAction >())
 
void addAction (const TradeAction &action)
 
const vector< TradeAction > & actions () const
 
bool empty () const
 Returns true of this set of actions is empty. More...
 
void clear ()
 Clear the trade actions. More...
 
virtual void fromXML (XMLNode *node) override
 
virtual XMLNodetoXML (XMLDocument &doc) const override
 
- 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...
 

Private Attributes

vector< TradeActionactions_
 

Detailed Description

Serializable object holding generic trade actions.

Definition at line 71 of file tradeactions.hpp.

Constructor & Destructor Documentation

◆ TradeActions()

TradeActions ( const vector< TradeAction > &  actions = vector<TradeAction>())

Definition at line 73 of file tradeactions.hpp.

73: actions_(actions) {}
vector< TradeAction > actions_
const vector< TradeAction > & actions() const

Member Function Documentation

◆ addAction()

void addAction ( const TradeAction action)

Definition at line 75 of file tradeactions.hpp.

75{ actions_.push_back(action); }

◆ actions()

const vector< TradeAction > & actions ( ) const

Definition at line 77 of file tradeactions.hpp.

77{ return actions_; }

◆ empty()

bool empty ( ) const

Returns true of this set of actions is empty.

Definition at line 80 of file tradeactions.hpp.

80{ return actions_.size() == 0; }
+ Here is the caller graph for this function:

◆ clear()

void clear ( )

Clear the trade actions.

Definition at line 83 of file tradeactions.hpp.

83{ actions_.clear(); }
+ Here is the caller graph for this function:

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 42 of file tradeactions.cpp.

42 {
43 XMLUtils::checkNode(node, "TradeActions");
44 for (auto& action : XMLUtils::getChildrenNodes(node, "TradeAction")) {
45 actions_.emplace_back();
46 actions_.back().fromXML(action);
47 }
48}
static void checkNode(XMLNode *n, const string &expectedName)
Definition: xmlutils.cpp:175
static vector< XMLNode * > getChildrenNodes(XMLNode *node, const string &name)
Returns all the children with a given name.
Definition: xmlutils.cpp:428
+ 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 50 of file tradeactions.cpp.

50 {
51 XMLNode* node = doc.allocNode("TradeActions");
52 for (auto& action : actions_)
53 XMLUtils::appendNode(node, action.toXML(doc));
54 return node;
55}
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

◆ actions_

vector<TradeAction> actions_
private

Definition at line 89 of file tradeactions.hpp.