Blame view

src/TimeTableCatalog/ParameterDescription.hh 4.85 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
/*
 * ParameterDescription.hh
 *
 *  Created on: 5 nov 2014
 *      Author: AKKA
 */

#ifndef PARAMETERDESCRIPTION_H_
#define PARAMETERDESCRIPTION_H_

#include <iostream>
#include <string>
#include <vector>

namespace TimeTableCatalog {

/**
 * Catalog definition.
 */
class ParameterDescription {
public:
	enum class ParameterType{
68c29629   Benjamin Renard   Fix in TT/Catalog...
23
24
25
26
27
		Unknown = -1,
		Double  = 0,
		Date    = 1,
		String  = 2,
		Integer = 3
fbe3c2bb   Benjamin Renard   First commit
28
29
30
31
32
33
	} ;

	ParameterDescription () :
		_id(""),
		_name(""),
		_size("1"),
68c29629   Benjamin Renard   Fix in TT/Catalog...
34
		_type(ParameterType::Double),
fbe3c2bb   Benjamin Renard   First commit
35
36
		_unit(""),
		_description(""),
0b2d2cab   Erdogan Furkan   Kernel part for c...
37
		_status(""),
fbe3c2bb   Benjamin Renard   First commit
38
39
40
		_ucd(""),
		_utype("")
	{
a1184f24   Hacene SI HADJ MOHAND   HPEvent in progress
41
                            setNull(_type);
fbe3c2bb   Benjamin Renard   First commit
42
43
44
45
46
47
48
49
50
	}

	ParameterDescription (
			const std::string &id,
			const std::string &name,
			const std::string &size,
			ParameterType type,
			const std::string &unit,
			const std::string &description,
0b2d2cab   Erdogan Furkan   Kernel part for c...
51
			const std::string &status,
fbe3c2bb   Benjamin Renard   First commit
52
53
54
55
56
57
58
59
60
			const std::string &ucd,
			const std::string &utype
			) :
			_id(id),
			_name(name),
			_size(size),
			_type(type),
			_unit(unit),
			_description(description),
0b2d2cab   Erdogan Furkan   Kernel part for c...
61
			_status(status),
fbe3c2bb   Benjamin Renard   First commit
62
63
64
			_ucd(ucd),
			_utype(utype)
	{
a1184f24   Hacene SI HADJ MOHAND   HPEvent in progress
65
                           setNull(_type);
fbe3c2bb   Benjamin Renard   First commit
66
67
	}

fbe3c2bb   Benjamin Renard   First commit
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
	/**
	 * Parameter id getter
	 */
	const std::string& getId() const {
		return _id;
	}

	/**
	 * Parameter id setter
	 */
	void setId(const std::string& id) {
		_id = id;
	}

	/**
	 * Parameter name getter
	 */
	const std::string& getName() const {
		return _name;
	}

	/**
	 * Parameter name setter
	 */
	void setName(const std::string& name) {
		_name = name;
	}

	/**
	 * Parameter size getter
	 */
	const std::string& getSize() const {
		return _size;
	}

	/**
	 * Parameter size getter
	 */
	int getSizeAsInt();

	/**
	 * Parameter size setter
	 */
	void setSize(const std::string& size) {
		_size = size;
	}

	/**
	 * Parameter type getter
	 */
	ParameterType getType() const {
		return _type;
	}

	/**
	 * Parameter type setter
	 */
	void setType(ParameterType type) {
		_type = type;
	}

	/**
fbe3c2bb   Benjamin Renard   First commit
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
	 * Parameter units getter
	 */
	const std::string& getUnit() const {
		return _unit;
	}

	/**
	 * Parameter units setter
	 */
	void setUnit(const std::string& units) {
		_unit = units;
	}

	/**
	 * Parameter description getter
	 */
	const std::string& getDescription() const {
		return _description;
	}

	/**
0b2d2cab   Erdogan Furkan   Kernel part for c...
151
152
153
154
155
156
157
	 * Parameter description getter
	 */
	const std::string& getStatus() const {
		return _status;
	}

	/**
fbe3c2bb   Benjamin Renard   First commit
158
159
160
161
162
163
	 * Parameter description setter
	 */
	void setDescription(const std::string& description) {
		_description = description;
	}

0b2d2cab   Erdogan Furkan   Kernel part for c...
164
165
166
167
168
169
170
171

	/**
	 * Parameter description setter
	 */
	void setStatus(const std::string& status) {
		_status = status;
	}

fbe3c2bb   Benjamin Renard   First commit
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
	/**
	 * Parameter ucd getter
	 */
	const std::string& getUcd() const {
		return _ucd;
	}

	/**
	 * Parameter ucd setter
	 */
	void setUcd(const std::string& ucd) {
		_ucd = ucd;
	}

	/**
	 * Parameter utype getter
	 */
	const std::string& getUtype() const {
		return _utype;
	}
a1184f24   Hacene SI HADJ MOHAND   HPEvent in progress
192
193
194
195
196
197
198
        
        	/**
	 * Parameter utype getter
	 */
	const std::string& getNull() const {
		return _null;
	}
fbe3c2bb   Benjamin Renard   First commit
199
200
201
202
203
204
205

	/**
	 * Parameter utype setter
	 */
	void setUtype(const std::string& utype) {
		_utype = utype;
	}
a1184f24   Hacene SI HADJ MOHAND   HPEvent in progress
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
        
                    void setNull(const std::string& null){
                                _null = null;
                    }
                    
                    void setNull(ParameterType type){
                        switch (type){
                            case ParameterType::Double:
                            case ParameterType::Integer:
                                _null = "0";
                                break;
                            case ParameterType::Unknown:
                            case ParameterType::String:
                                _null = "None";
                                        break;
                            case ParameterType::Date:
                                _null = "0001-01-01T00:00:00:00.000Z";
                                break; 
                            default:
                                _null = "0";
                        }
                    }
        
fbe3c2bb   Benjamin Renard   First commit
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262

private:

	/**
	 * Parameter (expected) unique id
	 */
	std::string	_id;

	/**
	 * Parameter name
	 */
	std::string	_name;

	/**
	 * Parameter size ("1"=scalar, "N"=N values array, "NxM"=N x M matrix)
	 */
	std::string	_size;

	/**
	 * Parameter type ("1"=scalar, "2"=vector, "NxM"=N x M matrix)
	 */
	ParameterType	_type;

	/**
	 * Parameter units
	 */
	std::string	_unit;

	/**
	 * Parameter description
	 */
	std::string	_description;

	/**
0b2d2cab   Erdogan Furkan   Kernel part for c...
263
264
265
266
267
	 * Parameter status
	 */
	std::string	_status;

	/**
fbe3c2bb   Benjamin Renard   First commit
268
269
270
271
272
273
274
275
	 * Parameter unified content descriptor
	 */
	std::string	_ucd;

	/**
	 * Parameter utype (VOTable definition)
	 */
	std::string	_utype;
a1184f24   Hacene SI HADJ MOHAND   HPEvent in progress
276
277
278
279
280
        
                    /**
                     *  param field null => 0, None etc
                    */
                    std::string _null;
fbe3c2bb   Benjamin Renard   First commit
281
282
283
284
285
286
287

};

typedef std::vector<ParameterDescription> ParameterDescriptionList;

} /* namespace TimeTableCatalog */
#endif /* PARAMETERDESCRIPTION_H_ */