DataWriter.cc
1.64 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
/**
* 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 ¶meter) :
_parameter(parameter),
_signatureTrigger(""), _timeRestriction(NAN) {
}
DataWriter::DataWriter(const DataWriter &pDataWriter, Parameter &pParameter) :
_parameter(pParameter),
_timeIntervalList(pDataWriter._timeIntervalList),
_paramData(),
_signatureTrigger(pDataWriter._signatureTrigger), _timeRestriction(pDataWriter._timeRestriction) {
//_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
}
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);
}
}
}
} /* namespace Parameters */
} /* namespace AMDA */