source: XIOS/trunk/src/filter/filter.cpp @ 1704

Last change on this file since 1704 was 1704, checked in by yushan, 5 years ago

Introducing the new graph functionality. Attribute build_workflow_graph=.TRUE. is used in the field definition section in the xml file to enable the workflow graph of the field and other fields referecing to it. A more detailed document will be available soon on the graph fuctionality.

File size: 1.3 KB
Line 
1#include "filter.hpp"
2
3namespace xios
4{
5  CFilter::CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine)
6    : CInputPin(gc, inputSlotsCount)
7    , COutputPin(gc, false)
8    , engine(engine)
9    , inputSlotCount(inputSlotCount)
10  { /* Nothing to do */ }
11
12  StdString CFilter::GetName(void)    { return StdString("Filter"); }
13
14  void CFilter::onInputReady(std::vector<CDataPacketPtr> data)
15  {
16    CDataPacketPtr outputPacket = engine->apply(data);
17    if (outputPacket)
18      onOutputReady(outputPacket);
19  }
20
21  void CFilter::setInputTrigger(size_t inputSlot, COutputPin* trigger)
22  {
23    // Was the filter already triggerable? If not, we need to inform
24    // all downstream filters.
25    bool wasTriggerable = canBeTriggered();
26
27    CInputPin::setInputTrigger(inputSlot, trigger);
28
29    if (!wasTriggerable)
30      setOutputTriggers();
31  }
32
33  void CFilter::trigger(Time timestamp)
34  {
35    CInputPin::trigger(timestamp);
36
37    COutputPin::trigger(timestamp);
38  }
39
40  bool CFilter::canBeTriggered() const
41  {
42    return (CInputPin::canBeTriggered() || COutputPin::canBeTriggered());
43  }
44
45  bool CFilter::mustAutoTrigger() const
46  {
47    return COutputPin::mustAutoTrigger();
48  }
49
50  bool CFilter::isDataExpected(const CDate& date) const
51  {
52    return COutputPin::isDataExpected(date);
53  }
54} // namespace xios
Note: See TracBrowser for help on using the repository browser.