Blame view

src/Parameters/DataWriter.cc 1.64 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
/**
 * DataWriter.cc
 *
 *  Created on: Nov 14, 2012
 *      Author: AKKA IS
 */

#include "DataWriter.hh"


#include "Parameter.hh"
#include "ParamData.hh"

namespace AMDA {
namespace Parameters {

log4cxx::LoggerPtr DataWriter::_logger(log4cxx::Logger::getLogger("AMDA-Kernel.DataWriter"));

DataWriter::DataWriter(Parameter &parameter)  :
		_parameter(parameter),
263de286   Benjamin Renard   Apply time restri...
21
		_signatureTrigger(""), _timeRestriction(NAN)  {
fbe3c2bb   Benjamin Renard   First commit
22
23
24
25
26
27
28

}

DataWriter::DataWriter(const DataWriter &pDataWriter, Parameter &pParameter)  :
		_parameter(pParameter),
		_timeIntervalList(pDataWriter._timeIntervalList),
		_paramData(),
263de286   Benjamin Renard   Apply time restri...
29
		_signatureTrigger(pDataWriter._signatureTrigger), _timeRestriction(pDataWriter._timeRestriction) {
fbe3c2bb   Benjamin Renard   First commit
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//_paramData not copied, must a be different instance of pDataWriter
}

DataWriter::~DataWriter() {
}

TimeStamp   DataWriter::init(TimeIntervalListSPtr pTimeIntervalList) {
	LOG4CXX_DEBUG(_logger, "DataWriter => Initialise data writer for parameter: " << _parameter.getId());
	_timeIntervalList = pTimeIntervalList;
	TimeStamp timeStamp = init();
	updateInfo(_parameter);
    return timeStamp;
}

ParameterManager &DataWriter::getParameterManager() {
	return _parameter.getParameterManager();
}

void DataWriter::updateInfo(Parameter & /*parameter*/) {
	//nothing to do - each param getter can override this method to update specific param info
}

263de286   Benjamin Renard   Apply time restri...
52
53
54
55
56
57
58
59
void DataWriter::applyTimeRestriction(unsigned int startIndex, unsigned int nbDataToProcess) {
	for (unsigned int _index = startIndex ; _index < startIndex + nbDataToProcess; ++_index)
	{
		if (_paramData->getTime(_index) >= _timeRestriction) {
			_paramData->setNAN(_index);
		}
	}
}
fbe3c2bb   Benjamin Renard   First commit
60
61
62

} /* namespace Parameters */
} /* namespace AMDA */