Blame view

src/ParamGetImpl/DDServerInterface/ParamGetDDBase.hh 3.18 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
/*
 * ParamGetDDClient.hh
 *
 *  Created on: 15 oct. 2012
 *      Author: casimir
 */

#ifndef PARAMGETDDCLIENT_HH_
#define PARAMGETDDCLIENT_HH_

#include <set>
#include <string>

#include <boost/shared_ptr.hpp>

#include "ParamGet.hh"
#include "Pusher.hh"

#include "TimeStamp.hh"

namespace AMDA {

	// Needed classes declaration
	namespace DDServerInterface {
		class VirtualInstrument;
		typedef boost::shared_ptr<VirtualInstrument>  VirtualInstrumentSPtr;
		namespace VI {
			class ParamFlow;
			typedef boost::shared_ptr<ParamFlow>  ParamFlowSPtr;
		}
	}

	namespace Parameters {

		//used class
		class ParamData;
		typedef boost::shared_ptr<ParamData> ParamDataSPtr;

		/**
		 * @class ParamGetDDBase
		 * @brief It is a DataWriter for a Parameter get from DDServer.
		 */
		class ParamGetDDBase: public AMDA::Parameters::ParamGet_CRTP<ParamGetDDBase> {
		public:
			typedef std::set<std::string> InfoRequestList;

			ParamGetDDBase(Parameter &parameter);
			ParamGetDDBase(const ParamGetDDBase &pParamGetDDBase, Parameter &parameter);
			virtual ~ParamGetDDBase();

			// Getter methods
			const std::string& getParName() const {
				return _parName;
			}
			const std::string& getViName() const {
				return _viName;
			}
ff482c31   Benjamin Renard   Give the possibil...
58
59
60
61
62
63
			int getDim3Num() {
				return _dim3Num;
			}
			int getDim3CutIndex() {
				return _dim3CutIndex;
			}
fbe3c2bb   Benjamin Renard   First commit
64
65
66
67
68
69
70
71

			// Setter methods
			void setParName(const char* parName) {
				_parName = parName;
			}
			void setViName(const char* viName) {
				_viName = viName;
			}
ff482c31   Benjamin Renard   Give the possibil...
72
73
74
75
76
77
			void setDim3Num(const int dim3Num) {
				_dim3Num = dim3Num;
			}
			void setDim3CutIndex(const int dim3CutIndex) {
				_dim3CutIndex = dim3CutIndex;
			}
fbe3c2bb   Benjamin Renard   First commit
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125

			// Others methods
			/**
			 * Prepares ::fillParamData to retrieve additional Information(s).
			 */
			void createInfoRequest(const char* pParamInfo) {
				_infoRequestList.insert(pParamInfo);
			}

			/**
			 *  Write data in dataParam.
			 */
			unsigned int write();

			TimeStamp init();

			/*
			 * @overload DataWriter::getMinSampling
			 */
			virtual double getMinSampling();

			/**
			 * @override DataWriter::updateInfo update parameter info in relation to the ParamGet
			 */
			virtual void updateInfo(Parameter & parameter);

		protected:

			/**
			 * Get Info if needed see _infoList.
			 */
			void getDDInfo();

		private:

			/**
			 * @brief update time in the ParamData
			 * @details Must be call after createParamData
			 */
			void updateTimeInParamData(DD_data_t *data);

			/**
			 * Create ParamData from getDataTypeInfo.
			 */
			void createParamData();

			std::string _parName; /**< param name for current virtual instrument */
			std::string _viName; /**< virtual instrument name */
ff482c31   Benjamin Renard   Give the possibil...
126
127
			int _dim3Num;
			int _dim3CutIndex;
fbe3c2bb   Benjamin Renard   First commit
128
129
130
131
132
133
134
135
136
137
138
			Base::Pusher* _pusher; /**< Responsible push data into the good container. */
			InfoRequestList _infoRequestList; /**< List of additional information(s) needed. */
			DDServerInterface::VirtualInstrumentSPtr _vi; /**< Virtual Instrument. */
			DDServerInterface::VI::ParamFlowSPtr _paramFlow; /** Parameter data flow.*/
			TimeStamp _timeStamp; /**< time of xml file or 0 */
		};
		typedef boost::shared_ptr<ParamGetDDBase> ParamGetDDBaseSPtr;

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