source: XIOS/dev/XIOS_DEV_CMIP6/src/filter/unary_arithmetic_filter.cpp @ 1358

Last change on this file since 1358 was 643, checked in by rlacroix, 9 years ago

Use the filter infrastructure to handle the temporal operations.

Add a temporal filter to do so.

File size: 633 bytes
Line 
1#include "unary_arithmetic_filter.hpp"
2
3namespace xios
4{
5  CUnaryArithmeticFilter::CUnaryArithmeticFilter(CGarbageCollector& gc, const std::string& op)
6    : CFilter(gc, 1, this)
7    , op(operatorExpr.getOpField(op))
8  { /* Nothing to do */ };
9
10  CDataPacketPtr CUnaryArithmeticFilter::apply(std::vector<CDataPacketPtr> data)
11  {
12    CDataPacketPtr packet(new CDataPacket);
13    packet->date = data[0]->date;
14    packet->timestamp = data[0]->timestamp;
15    packet->status = data[0]->status;
16
17    if (packet->status == CDataPacket::NO_ERROR)
18      packet->data.reference(op(data[0]->data));
19
20    return packet;
21  }
22} // namespace xios
Note: See TracBrowser for help on using the repository browser.