Blame view

src/Parameters/ParamGet.hh 2.25 KB
fbe3c2bb   Benjamin Renard   First commit
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
/*
 * ParamGet.hh
 *
 *  Created on: 15 oct. 2012
 *      Author: casimir
 */

#ifndef PARAMGET_HH_
#define PARAMGET_HH_


#include <boost/shared_ptr.hpp>
#include <log4cxx/logger.h>

#include "AMDA_exception.hh"
#include "DataWriter.hh"


namespace AMDA {
namespace Parameters {

//used class
class Parameter;


/**
 * Exception specific for ParseMainArguments
 */
struct ParamGet_exception: virtual AMDA_exception { };

/**
 * @brief Abstract class to Get parameter value
 * @details must be implemented for get value in a dataBase, file, or any way
 */
class ParamGet : public AMDA::Parameters::DataWriter {
public:
	/**
	 * Constructor
	 */
	ParamGet(Parameter & parameter);

	/**
	 * Constructor by copy
	 */
	ParamGet(const ParamGet &pParamGet, Parameter & parameter);

	/**
	 * Destructor
	 */
	virtual ~ParamGet();

	/*
	 * @overload DataWriter::useNearestValue - to know the resampling strategy to use. If it's true, the nearest value will be use
	 */
	bool useNearestValue();

	/*
	 * @brief set the resampling strategy to use
	 */
	void setUseNearestValue(bool useNearestValue)
	{
		_useNearestValue = useNearestValue;
	}

2f05d991   RENARD Benjamin   Generate param in...
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
        double getGlobalStart() {
            return _globalStart;
        }

        double getGlobalStop() {
            return _globalStop;
        }

        void setGlobalStart(double globalStart) {
            _globalStart = globalStart;
        }

        void setGlobalStop(double globalStop) {
            _globalStop = globalStop;
        }

fbe3c2bb   Benjamin Renard   First commit
81
82
83
84
85
86
protected:

	static log4cxx::LoggerPtr _logger;

private:
	bool _useNearestValue;
2f05d991   RENARD Benjamin   Generate param in...
87
88
89
90

        double _globalStart;

        double _globalStop;
fbe3c2bb   Benjamin Renard   First commit
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
};

typedef boost::shared_ptr<ParamGet> ParamGetSPtr;

// This CRTP class implements clone() for Derived
template <typename Derived>
class ParamGet_CRTP : public ParamGet {
public:
	/**
	 * Default constructor
	 */
	ParamGet_CRTP(Parameter &parameter) : ParamGet(parameter) {}

	/**
	 * constructor by copy
	 */
	ParamGet_CRTP(const ParamGet &pDataWriter, Parameter &parameter) : ParamGet(pDataWriter,parameter) {}

	/**
	 * Clone the future instance
	 */
    virtual DataWriter *clone(Parameter &parameter) const {
        return new Derived(static_cast<Derived const&>(*this),parameter);
    }
};




} /* namespace Parameters */
} /* namespace AMDA */
#endif /* PARAMGET_HH_ */