/* * ColormapManager.hh * * Created on: 8 nov. 2013 * Author: guillaume */ #ifndef COLORMAPMANAGER_HH_ #define COLORMAPMANAGER_HH_ #include #include #include #include #include #include "PlotCommon.hh" namespace plot { typedef std::map ColorFileMap; class ColormapManager { public: static const int DEFAULT_COLORMAP_0; static const int DEFAULT_COLORMAP_1; /** * @brief Gets singleton instance. */ static ColormapManager& getInstance() { std::call_once(_instanceOnceFlag, [] { _instance.reset(new ColormapManager); }); return *_instance.get(); } virtual ~ColormapManager(); /** * @brief Gets color map from index * @param mode : page color mode * @param index : color map index */ std::string get(PlotCommon::Mode& mode, int index); /** * @ brief Gets default color map index * @param mode : page color mode */ int getDefault(PlotCommon::Mode& mode); /** * @brief Get default color map size * @param mode : page color mode */ int getDefaultSize(PlotCommon::Mode& mode); /** * @brief Gets color map for color axis from index * @param index : color map index */ std::string getColorAxis(int index); private: ColormapManager(); /** * @brief Singleton unique instance */ static std::unique_ptr _instance; /** * @brief Flag to guarantee singleton unicity. */ static std::once_flag _instanceOnceFlag; public: /** * @brief Color map files map (index-file) according to page color mode */ std::map _colormap; /** * @brief Default color map indexes according to page color mode */ std::map _defaultColormap; /** * @brief Path to color map files container */ std::string _path; /** * @brief Color map files map (index-file) according to page color mode */ ColorFileMap _coloraxis; /** * @brief Default color map indexes for color axis */ int _defaultColorAxis; /* * @brief Map to store default color map size */ std::map _defaultSize; }; } //plot #endif /* COLORMAPMANAGER_HH_ */