source: XIOS/trunk/src/filter/filter.hpp @ 1112

Last change on this file since 1112 was 1006, checked in by rlacroix, 7 years ago

The workflow is now triggered when using xios_recv_field for fields in read mode received from the servers.

Previously the workflow was triggered upon receiving the data which could cause deadlocks since there are no garanties that clients are receiving data at the same time.

File size: 2.0 KB
Line 
1#ifndef __XIOS_CFilter__
2#define __XIOS_CFilter__
3
4#include "input_pin.hpp"
5#include "output_pin.hpp"
6#include "filter_engine.hpp"
7
8namespace xios
9{
10  /*!
11   * A generic filter with an input pin and an output pin.
12   * A filter can delegate the internal work to an engine
13   * which may be shared by multiple filter instances.
14   */
15  class CFilter : public CInputPin, public COutputPin
16  {
17    public:
18      /*!
19       * Constructs a filter with the specified number of input slots
20       * and the specified engine.
21       *
22       * \param gc the associated garbage collector
23       * \param inputSlotsCount the number of input slots
24       * \param engine the filter engine
25       */
26      CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine);
27
28      /*!
29       * Sets the trigger for a specific input slot.
30       *
31       * \param inputSlot the input slot number
32       * \param trigger the corresponding trigger
33       */
34      void virtual setInputTrigger(size_t inputSlot, COutputPin* trigger);
35
36      /*!
37       * Triggers the filter for the specified timestamp.
38       *
39       * \param timestamp the timestamp for which we are triggering the filter
40       */
41      void virtual trigger(Time timestamp);
42
43      /*!
44       * Tests if the filter can be triggered.
45       *
46       * \return true if the filter can be triggered
47       */
48      bool virtual canBeTriggered() const;
49
50    protected:
51      IFilterEngine* engine; //!< The filter engine, might be the filter itself
52      size_t inputSlotCount; //!< Number of slot on filter
53
54      /*!
55       * Generic implementation of the input pin notification function, processes
56       * the data using the filter engine and passes the resulting packet (if any)
57       * to the downstreams filters.
58       *
59       * \param data a vector of packets corresponding to each slot
60       */
61      void virtual onInputReady(std::vector<CDataPacketPtr> data);
62  }; // class CFilter
63} // namespace xios
64
65#endif //__XIOS_CFilter__
Note: See TracBrowser for help on using the repository browser.