DefaultPlotConfiguration.hh
1.99 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
/*
* DefaultPlotConfiguration.hh
*
* Created on: 28 oct. 2013
* Author: CS
*/
#ifndef DEFAULTPLOTCONFIGURATION_HH_
#define DEFAULTPLOTCONFIGURATION_HH_
#include <map>
#include <mutex>
#include "Page.hh"
#include "TimeAxis.hh"
#include "EpochAxis.hh"
#include "DigitalAxis.hh"
#include "ColorAxis.hh"
#include "DrawingProperties.hh"
namespace plot {
class DefaultPlotConfiguration {
public:
static const std::string TIME_DEFAULT_ID;
static const std::string EPOCH_DEFAULT_ID;
static const std::string COLORAXIS_ID;
/**
* Gets singleton instance.
*/
static DefaultPlotConfiguration& getInstance() {
std::call_once(_instanceOnceFlag, [] {
_instance.reset(new DefaultPlotConfiguration);
});
return *_instance.get();
}
virtual ~DefaultPlotConfiguration();
TimeAxis* getDefaultTimeAxis(){
return dynamic_cast<TimeAxis*> (_defaultPanel.getAxis(TIME_DEFAULT_ID).get());
}
EpochAxis* getDefaultEpochAxis(){
return dynamic_cast<EpochAxis*> (_defaultPanel.getAxis(EPOCH_DEFAULT_ID).get());
}
ColorAxis* getDefaultColorAxis(){
return dynamic_cast<ColorAxis*> (_defaultPanel.getAxis(COLORAXIS_ID).get());
}
DigitalAxis* getDefaultXAxis(){
std::string id = "xAxis";
return dynamic_cast<DigitalAxis*> (_defaultPanel.getAxis(id).get());
}
DigitalAxis* getDefaultYAxis(){
std::string id = "yAxis";
return dynamic_cast<DigitalAxis*>(_defaultPanel.getAxis(id).get());
}
void applyDefaultDrawingProperties(const std::string& key_, DrawingProperties& p_);
// ********************* DEFAULT PROPERTIES *************************** //
Page _defaultPage;
Panel _defaultPanel;
Axis _defaultAxis;
std::map<const std::string,DrawingProperties> _defaultDrawingProperties;
private:
DefaultPlotConfiguration();
/**
* Singleton unique instance
*/
static std::unique_ptr<DefaultPlotConfiguration> _instance;
/**
* Flag to guarantee singleton unicity.
*/
static std::once_flag _instanceOnceFlag;
};
} /* namespace plot */
#endif /* DEFAULTPLOTCONFIGURATION_HH_ */