source: XIOS/dev/dev_olga/src/filter/filter.cpp @ 1654

Last change on this file since 1654 was 1653, checked in by oabramkina, 5 years ago

Developments for visualization of XIOS workflow.

Branch is spawned from trunk r1649.

Boost library is used for producing Graphviz DOT files. Current results: a DOT file representing a static workflow. For a complete proof of concept, DOT files for each timestamp should be generated. The necessary information has been collected by XIOS, it only requires rearranging the information for graphing (changes in classes CWorkflowGraph and CGraphviz).

File size: 1.4 KB
Line 
1#include "filter.hpp"
2
3namespace xios
4{
5  CFilter::CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine, bool buildWorkflowGraph /*= false*/)
6    : CInputPin(gc, inputSlotsCount)
7    , COutputPin(gc, false, buildWorkflowGraph)
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.