source: XIOS/trunk/src/filter/unary_arithmetic_filter.cpp @ 642

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

Use the filter infrastructure to handle the expressions

Parse the expressions to get a new tree representation that can be converted to a filter graph based on new arithmetic filters.

Temporal operations are still unsupported.

File size: 599 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->timestamp = data[0]->timestamp;
14    packet->status = data[0]->status;
15
16    if (packet->status == CDataPacket::NO_ERROR)
17      packet->data.reference(op(data[0]->data));
18
19    return packet;
20  }
21} // namespace xios
Note: See TracBrowser for help on using the repository browser.