$treeview $search $mathjax
StdAir Logo  1.00.1
$projectbrief
$projectbrief
$searchbox

stdair/bom/FRAT5CurveHolderStruct.cpp

Go to the documentation of this file.
00001 // //////////////////////////////////////////////////////////////////////
00002 // Import section
00003 // //////////////////////////////////////////////////////////////////////
00004 // STL
00005 #include <cassert>
00006 #include <sstream>
00007 // StdAir
00008 #include <stdair/service/Logger.hpp>
00009 #include <stdair/bom/FRAT5CurveHolderStruct.hpp>
00010 
00011 namespace stdair {
00012   
00013   // ////////////////////////////////////////////////////////////////////
00014   FRAT5CurveHolderStruct::FRAT5CurveHolderStruct() {
00015   }
00016     
00017   // ////////////////////////////////////////////////////////////////////
00018   FRAT5CurveHolderStruct::
00019   FRAT5CurveHolderStruct (const FRAT5CurveHolderStruct& iHolder)
00020     : _frat5CurveHolder (iHolder._frat5CurveHolder) {
00021   }
00022   
00023   // ////////////////////////////////////////////////////////////////////
00024   FRAT5CurveHolderStruct::~FRAT5CurveHolderStruct() {
00025   }
00026 
00027   // ////////////////////////////////////////////////////////////////////
00028   const FRAT5Curve_T& FRAT5CurveHolderStruct::
00029   getFRAT5Curve (const std::string& iKey) const {
00030     FRAT5CurveHolder_T::const_iterator itCurve = _frat5CurveHolder.find (iKey);
00031     if (itCurve == _frat5CurveHolder.end()) {
00032       STDAIR_LOG_DEBUG ("Cannot find the FRAT5 curve correponding to the "
00033                         << "given key: " << iKey);
00034       assert (false);
00035     }
00036 
00037     return itCurve->second;
00038   }
00039 
00040   // ////////////////////////////////////////////////////////////////////
00041   void FRAT5CurveHolderStruct::
00042   addCurve (const std::string& iKey, const FRAT5Curve_T& iCurve) {
00043     bool insert = _frat5CurveHolder.insert (FRAT5CurveHolder_T::value_type(iKey, iCurve)).second;
00044     if (insert == false) {
00045       STDAIR_LOG_DEBUG ("Cannot add the FRAT5 curve correponding to the "
00046                         << "given key: " << iKey
00047                         << ", the key may already exist.");
00048       assert (false);
00049     }
00050   }
00051   
00052   // ////////////////////////////////////////////////////////////////////
00053   void FRAT5CurveHolderStruct::toStream (std::ostream& ioOut) const {
00054     ioOut << describe();
00055   }
00056 
00057   // ////////////////////////////////////////////////////////////////////
00058   void FRAT5CurveHolderStruct::fromStream (std::istream& ioIn) {
00059   }
00060   
00061   // ////////////////////////////////////////////////////////////////////
00062   const std::string FRAT5CurveHolderStruct::describe() const {
00063     std::ostringstream oStr;
00064     for (FRAT5CurveHolder_T::const_iterator itCurve = _frat5CurveHolder.begin();
00065          itCurve != _frat5CurveHolder.end(); ++itCurve) {
00066       const std::string& lKey = itCurve->first;
00067       const FRAT5Curve_T& lCurve = itCurve->second;
00068       oStr << lKey << "; ";
00069       for (FRAT5Curve_T::const_reverse_iterator itFRAT5 = lCurve.rbegin();
00070            itFRAT5 != lCurve.rend(); ++itFRAT5) {
00071         const DTD_T& lDTD = itFRAT5->first;
00072         const double& lFRAT5 = itFRAT5->second;
00073         oStr << lDTD << ":" << lFRAT5 << ";";
00074       }
00075       oStr << std::endl;
00076     }
00077     return oStr.str();
00078   }
00079 
00080 }