7 static func::CFunctor*
createFunctor(
const std::string& opId,
bool ignoreMissingValue, CArray<double, 1>& tmpData);
11 bool ignoreMissingValue )
14 , isOnceOperation(functor->timeType() == func::CFunctor::once)
15 , isInstantOperation(functor->timeType() == func::CFunctor::instant)
16 , samplingFreq(samplingFreq)
17 , samplingOffset(samplingOffset)
19 , offsetMonth(0, this->samplingOffset.month, 0, 0, 0, 0, 0)
20 , offsetAllButMonth(this->samplingOffset.year, 0 , this->samplingOffset.day,
21 this->samplingOffset.hour, this->samplingOffset.minute,
22 this->samplingOffset.second, this->samplingOffset.timestep)
25 , nextSamplingDate(initDate + offsetMonth + ( offsetAllButMonth + initDate.getRelCalendar().getTimeStep()))
29 , isFirstOperation(true)
39 bool usePacket, outputResult, copyLess;
58 (*functor)(data[0]->data);
72 packet->date = data[0]->date;
73 packet->timestamp = data[0]->timestamp;
74 packet->status = data[0]->status;
75 packet->data.resize(
tmpData.numElements());
104 double defaultValue = std::numeric_limits<double>::quiet_NaN();
106 #define DECLARE_FUNCTOR(MType, mtype) \
107 if (opId.compare(#mtype) == 0) \
109 if (ignoreMissingValue) \
111 functor = new func::C##MType(tmpData, defaultValue); \
115 functor = new func::C##MType(tmpData); \
122 ERROR(
"createFunctor(const std::string& opId, ...)",
123 <<
"\"" << opId <<
"\" is not a valid operation.");
A generic filter with an input pin and an output pin.
static func::CFunctor * createFunctor(const std::string &opId, bool ignoreMissingValue, CArray< double, 1 > &tmpData)
CDate nextSamplingDate
The date of the next sampling.
Last packet of the stream, does not have data.
const CDuration opFreq
The operation frequency, i.e.
std::shared_ptr< CDataPacket > CDataPacketPtr
const CCalendar & getRelCalendar(void) const
int nbOperationDates
The number of times an operation is performed.
const boost::scoped_ptr< func::CFunctor > functor
The functor corresponding to the temporal operation.
const CDuration samplingFreq
The sampling frequency, i.e.
CTemporalFilter(CGarbageCollector &gc, const std::string &opId, const CDate &initDate, const CDuration samplingFreq, const CDuration samplingOffset, const CDuration opFreq, bool ignoreMissingValue=false)
Constructs a temporal filter wrapping the specified temporal operation.
A packet corresponds to a timestamped array of data.
const CDuration offsetMonth
The month duration of samplingOffset.
const bool isOnceOperation
True if the operation should be computed just once.
virtual CDataPacketPtr apply(std::vector< CDataPacketPtr > data)
Applies the temporal operation to the input data and returns the result when it is ready...
bool isFirstOperation
True before the first operation was been computed.
CATCH CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar *scalarDestination, CScalar *scalarSource, CReduceScalarToScalar *algo ERROR)("CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo)",<< "Operation must be defined."<< "Scalar source "<< scalarSource->getId()<< std::endl<< "Scalar destination "<< scalarDestination->getId())
virtual bool mustAutoTrigger() const
Tests if the filter must auto-trigger.
const CDuration & getTimeStep(void) const
Accesseurs ///.
CDuration offsetAllButMonth
All but the month duration of samplingOffset.
CArray< double, 1 > tmpData
The array of data used for temporary storage.
virtual bool isDataExpected(const CDate &date) const
Tests whether data is expected for the specified date.
A basic garbage collector which ensures no old packets linger in the filter graph.
////////////////////// Déclarations ////////////////////// ///
const bool isInstantOperation
True if the operation is instant.