ColormapManager.hh
2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
* ColormapManager.hh
*
* Created on: 8 nov. 2013
* Author: guillaume
*/
#ifndef COLORMAPMANAGER_HH_
#define COLORMAPMANAGER_HH_
#include <mutex>
#include <memory>
#include <map>
#include <tuple>
#include <vector>
#include "PlotCommon.hh"
namespace plot {
typedef std::map<int, std::string> 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<ColormapManager> _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<PlotCommon::Mode, ColorFileMap> _colormap;
/**
* @brief Default color map indexes according to page color mode
*/
std::map<PlotCommon::Mode, int> _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<PlotCommon::Mode, int> _defaultSize;
};
} //plot
#endif /* COLORMAPMANAGER_HH_ */