Blame view

src/Parameters/ParamOutput.cc 1.58 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
65
66
67
68
69
/**
 * ParamOutput.cc
 *
 *  Created on: 18 oct. 2012
 *      Author: AKKA IS
 */

#include "ParamOutput.hh"
#include "DicError.hh"

//#include "TimeTableCatalogFactory.hh"
//#include "TimeInterval.hh"

namespace AMDA {
namespace Parameters {

using namespace TimeTableCatalog;

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

ParamOutput::ParamOutput(ParameterManager& pParameterManager) : DataClient(),
		_samplingMode(""),
		_samplingValue(0.0),
		_gapThreshold(0.0),
		_parameterManager(pParameterManager)  {
}

ParamOutput::~ParamOutput() {
}

void ParamOutput::init(TimeIntervalListSPtr pTimeIntervalList) {
	// Separate short time interval.
	if (_samplingValue == 0) {
		LOG4CXX_WARN(_logger, "Sampling time is equal to 0. Time interval too short separation mechanism not taken into account");
	}

	_timeIntervalList.reset (new TimeIntervalList);
	_timeIntervalListTooSmall.reset (new TimeIntervalList);

	for(TimeIntervalList::iterator it = pTimeIntervalList->begin(); it != pTimeIntervalList->end(); ++it) {
		if ( (it->_stopTime - it->_startTime) < _samplingValue ) {
			_timeIntervalListTooSmall->push_back(*it);
		} else {
			_timeIntervalList->push_back(*it);
		}
	}

	_currentTimeInterval = _timeIntervalList->begin();
	init();
}

void ParamOutput::process() {
	apply();
}

void ParamOutput::terminate() {
	applyPostProcessing();
}


/**
 * @brief Search for a sampling time
 */
float getSamplingInTreeParameter (ParameterSPtr pParam) {
	return pParam->getDataWriterTemplate()->getMinSampling();
}

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