StdAir Logo  0.44.0
C++ Standard Airline IT Object Library
DictionaryManager.cpp
Go to the documentation of this file.
00001 // //////////////////////////////////////////////////////////////////////
00002 // Import section
00003 // //////////////////////////////////////////////////////////////////////
00004 // StdAir
00005 #include <stdair/basic/DictionaryManager.hpp>
00006 #include <stdair/basic/BasConst_General.hpp>
00007 
00008 namespace stdair {
00009 
00010   // ////////////////////////////////////////////////////////////////////
00011   const stdair::Probability_T DictionaryManager::
00012   keyToValue (const DictionaryKey_T iKey) {
00013     const float lValue =
00014       static_cast<float> (iKey) / DEFAULT_NUMBER_OF_SUBDIVISIONS;
00015     const stdair::Probability_T lProbability (lValue);
00016     return lProbability;
00017   }
00018 
00019   // ////////////////////////////////////////////////////////////////////
00020   const DictionaryKey_T DictionaryManager::
00021   valueToKey (const stdair::Probability_T iValue) {
00022     const unsigned short lValueMultipliedByThousand =
00023       static_cast<unsigned short> (iValue) * DEFAULT_NUMBER_OF_SUBDIVISIONS;
00024     const DictionaryKey_T lDictionaryKey (lValueMultipliedByThousand);
00025     return lDictionaryKey;
00026   }
00027 
00028 }