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 | |
---|
8 | namespace 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 | * \param buildWorkflowGraph indicates whether data will be visualized |
---|
26 | */ |
---|
27 | CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine, bool buildWorkflowGraph = false); |
---|
28 | |
---|
29 | StdString virtual GetName(void); |
---|
30 | |
---|
31 | /*! |
---|
32 | * Sets the trigger for a specific input slot. |
---|
33 | * |
---|
34 | * \param inputSlot the input slot number |
---|
35 | * \param trigger the corresponding trigger |
---|
36 | */ |
---|
37 | void virtual setInputTrigger(size_t inputSlot, COutputPin* trigger); |
---|
38 | |
---|
39 | /*! |
---|
40 | * Triggers the filter for the specified timestamp. |
---|
41 | * |
---|
42 | * \param timestamp the timestamp for which we are triggering the filter |
---|
43 | */ |
---|
44 | void virtual trigger(Time timestamp); |
---|
45 | |
---|
46 | /*! |
---|
47 | * Tests if the filter can be triggered. |
---|
48 | * |
---|
49 | * \return true if the filter can be triggered |
---|
50 | */ |
---|
51 | bool virtual canBeTriggered() const; |
---|
52 | |
---|
53 | /*! |
---|
54 | * Tests if the filter must auto-trigger. |
---|
55 | * |
---|
56 | * \return true if the filter must auto-trigger |
---|
57 | */ |
---|
58 | bool virtual mustAutoTrigger() const; |
---|
59 | |
---|
60 | /*! |
---|
61 | * Tests whether data is expected for the specified date. |
---|
62 | * |
---|
63 | * \param date the date associated to the data |
---|
64 | */ |
---|
65 | bool virtual isDataExpected(const CDate& date) const; |
---|
66 | |
---|
67 | protected: |
---|
68 | IFilterEngine* engine; //!< The filter engine, might be the filter itself |
---|
69 | size_t inputSlotCount; //!< Number of slot on filter |
---|
70 | |
---|
71 | /*! |
---|
72 | * Generic implementation of the input pin notification function, processes |
---|
73 | * the data using the filter engine and passes the resulting packet (if any) |
---|
74 | * to the downstreams filters. |
---|
75 | * |
---|
76 | * \param data a vector of packets corresponding to each slot |
---|
77 | */ |
---|
78 | void virtual onInputReady(std::vector<CDataPacketPtr> data); |
---|
79 | }; // class CFilter |
---|
80 | } // namespace xios |
---|
81 | |
---|
82 | #endif //__XIOS_CFilter__ |
---|