StdAir Logo  1.00.19
C++ Standard Airline IT Object Library
Loading...
Searching...
No Matches
FRAT5CurveHolderStruct.cpp
Go to the documentation of this file.
1// //////////////////////////////////////////////////////////////////////
2// Import section
3// //////////////////////////////////////////////////////////////////////
4// STL
5#include <cassert>
6#include <sstream>
7// StdAir
10
11namespace stdair {
12
13 // ////////////////////////////////////////////////////////////////////
16
17 // ////////////////////////////////////////////////////////////////////
20 : _frat5CurveHolder (iHolder._frat5CurveHolder) {
21 }
22
23 // ////////////////////////////////////////////////////////////////////
26
27 // ////////////////////////////////////////////////////////////////////
29 getFRAT5Curve (const std::string& iKey) const {
30 FRAT5CurveHolder_T::const_iterator itCurve = _frat5CurveHolder.find (iKey);
31 if (itCurve == _frat5CurveHolder.end()) {
32 STDAIR_LOG_DEBUG ("Cannot find the FRAT5 curve correponding to the "
33 << "given key: " << iKey);
34 assert (false);
35 }
36
37 return itCurve->second;
38 }
39
40 // ////////////////////////////////////////////////////////////////////
42 addCurve (const std::string& iKey, const FRAT5Curve_T& iCurve) {
43 bool insert = _frat5CurveHolder.insert (FRAT5CurveHolder_T::value_type(iKey, iCurve)).second;
44 if (insert == false) {
45 STDAIR_LOG_DEBUG ("Cannot add the FRAT5 curve correponding to the "
46 << "given key: " << iKey
47 << ", the key may already exist.");
48 assert (false);
49 }
50 }
51
52 // ////////////////////////////////////////////////////////////////////
53 void FRAT5CurveHolderStruct::toStream (std::ostream& ioOut) const {
54 ioOut << describe();
55 }
56
57 // ////////////////////////////////////////////////////////////////////
58 void FRAT5CurveHolderStruct::fromStream (std::istream& ioIn) {
59 }
60
61 // ////////////////////////////////////////////////////////////////////
62 const std::string FRAT5CurveHolderStruct::describe() const {
63 std::ostringstream oStr;
64 for (FRAT5CurveHolder_T::const_iterator itCurve = _frat5CurveHolder.begin();
65 itCurve != _frat5CurveHolder.end(); ++itCurve) {
66 const std::string& lKey = itCurve->first;
67 const FRAT5Curve_T& lCurve = itCurve->second;
68 oStr << lKey << "; ";
69 for (FRAT5Curve_T::const_reverse_iterator itFRAT5 = lCurve.rbegin();
70 itFRAT5 != lCurve.rend(); ++itFRAT5) {
71 const DTD_T& lDTD = itFRAT5->first;
72 const double& lFRAT5 = itFRAT5->second;
73 oStr << lDTD << ":" << lFRAT5 << ";";
74 }
75 oStr << std::endl;
76 }
77 return oStr.str();
78 }
79
80}
#define STDAIR_LOG_DEBUG(iToBeLogged)
Definition Logger.hpp:32
Handle on the StdAir library context.
std::map< const DTD_T, FRAT5_T > FRAT5Curve_T
void addCurve(const std::string &, const FRAT5Curve_T &)
const FRAT5Curve_T & getFRAT5Curve(const std::string &) const
void toStream(std::ostream &ioOut) const