CashFlowVector.hpp
Go to the documentation of this file.
1 #ifndef JULIAN_CASHFLOWVECTOR_HPP
2 #define JULIAN_CASHFLOWVECTOR_HPP
3 
5 #include <utils/smartPointer.hpp>
6 #include <boost/serialization/vector.hpp>
7 #include <vector>
8 
9 namespace julian {
10 
23  public:
24  CashFlowVector(){};
27  explicit CashFlowVector(std::vector<SmartPointer<CashFlow> >& cfs_): cfs(cfs_){};
28 
29  double prize(const SmartPointer<ir::Curve>& disc) const;
30  double valuation(const SmartPointer<ir::Curve>& disc) const;
31 
32  void updateCashFlows(double quote, const InterestRate& rate);
35 
37 
38  std::vector<Date> getDates() const;
39  int size() const;
40 
41  friend std::ostream& operator<<(std::ostream&, CashFlowVector&);
42  friend class boost::serialization::access;
43  private:
44  template<class Archive>
45  void serialize(Archive & ar, const unsigned int);
46 
47  std::vector<SmartPointer<CashFlow> > cfs;
48  };
49 
52  template<class Archive>
53  void CashFlowVector::serialize(Archive & ar, const unsigned int) {
54  ar & BOOST_SERIALIZATION_NVP(cfs);
55  }
56 }
57 #endif /* CASHFLOWVECTOR_HPP */
CashFlowVector(std::vector< SmartPointer< CashFlow > > &cfs_)
Constructor.
Definition: CashFlowVector.hpp:27
File contains template of deep-coping smart pointer.
File contains definition of cash flow class.
friend std::ostream & operator<<(std::ostream &, CashFlowVector &)
Overloads stream operator.
Definition: CashFlowVector.cpp:43
int size() const
number of CF
Definition: CashFlowVector.cpp:80
Definition: cadHoliday.cpp:3
Template of deep-coping smart pointer.
Definition: smartPointer.hpp:14
Class helps to handle the vector of CFs.
Definition: CashFlowVector.hpp:22
double prize(const SmartPointer< ir::Curve > &disc) const
calculate discounted value of all CFs
Definition: CashFlowVector.cpp:15
double valuation(const SmartPointer< ir::Curve > &disc) const
values the CF
Definition: CashFlowVector.cpp:60
SmartPointer< CashFlow > operator[](int) const
returns i-th CF
Definition: CashFlowVector.cpp:54
std::vector< Date > getDates() const
returns dates of cfs
Definition: CashFlowVector.cpp:70
void addCashFlow(SmartPointer< CashFlow > cf)
appends CF to vector
Definition: CashFlowVector.cpp:9
void updateCashFlows(double quote, const InterestRate &rate)
updates all CFs with given quote
Definition: CashFlowVector.cpp:25
The class implements the concept of interest rate.
Definition: interestRate.hpp:25
void serialize(Archive &ar, const unsigned int)
interface used by Boost serialization library
Definition: CashFlowVector.hpp:53
std::vector< SmartPointer< CashFlow > > cfs
Vector of cashflows.
Definition: CashFlowVector.hpp:47