source: XIOS/dev/dev_olga/src/filter/filter.hpp @ 1130

Last change on this file since 1130 was 1021, checked in by oabramkina, 7 years ago

Intermeadiate version for merging with new server functionalities.

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.