[638] | 1 | #ifndef __XIOS_CSourceFilter__ |
---|
| 2 | #define __XIOS_CSourceFilter__ |
---|
| 3 | |
---|
| 4 | #include <map> |
---|
| 5 | |
---|
| 6 | #include "output_pin.hpp" |
---|
| 7 | |
---|
| 8 | namespace xios |
---|
| 9 | { |
---|
| 10 | class CGrid; |
---|
| 11 | |
---|
| 12 | /*! |
---|
| 13 | * A source filter is the entry point of the data in the graph of filters. |
---|
| 14 | */ |
---|
| 15 | class CSourceFilter : public COutputPin |
---|
| 16 | { |
---|
| 17 | public: |
---|
| 18 | /*! |
---|
| 19 | * Constructs a source filter accepting data attached to the specified grid. |
---|
| 20 | * |
---|
[1021] | 21 | * \param gc the garbage collector associated with this filter |
---|
[638] | 22 | * \param grid the grid to which the data is attached |
---|
[756] | 23 | * \param offset the offset applied to the timestamp of all packets |
---|
[1021] | 24 | * \param manualTrigger whether the output should be triggered manually |
---|
[638] | 25 | */ |
---|
[1021] | 26 | CSourceFilter(CGarbageCollector& gc, CGrid* grid, |
---|
| 27 | const CDuration offset = NoneDu, bool manualTrigger = false); |
---|
[638] | 28 | |
---|
| 29 | /*! |
---|
| 30 | * Transforms the data received from the model into a packet and send it |
---|
| 31 | * in the filter graph. The array containing the data can safely be reused |
---|
| 32 | * immediately after this method returns. |
---|
| 33 | * |
---|
[643] | 34 | * \param date the date associated to the data |
---|
[638] | 35 | * \param data an array containing the data |
---|
| 36 | */ |
---|
| 37 | template <int N> |
---|
[643] | 38 | void streamData(CDate date, const CArray<double, N>& data); |
---|
[638] | 39 | |
---|
| 40 | /*! |
---|
| 41 | * Transforms the data received from the server into a packet and send it |
---|
| 42 | * in the filter graph. The array containing the data can safely be reused |
---|
| 43 | * immediately after this method returns. |
---|
| 44 | * |
---|
[643] | 45 | * \param date the date associated to the data |
---|
[638] | 46 | * \param data an array containing the data |
---|
| 47 | */ |
---|
[643] | 48 | void streamDataFromServer(CDate date, const std::map<int, CArray<double, 1> >& data); |
---|
[638] | 49 | |
---|
| 50 | /*! |
---|
| 51 | * Signals the filter graph that the end of stream was reached. |
---|
| 52 | * |
---|
[643] | 53 | * \param date the date at which the end of stream occurred |
---|
[638] | 54 | */ |
---|
[643] | 55 | void signalEndOfStream(CDate date); |
---|
[638] | 56 | |
---|
| 57 | private: |
---|
| 58 | CGrid* grid; //!< The grid attached to the data the filter can accept |
---|
[756] | 59 | const CDuration offset; //!< The offset applied to the timestamp of all packets |
---|
[638] | 60 | }; // class CSourceFilter |
---|
| 61 | } // namespace xios |
---|
| 62 | |
---|
| 63 | #endif //__XIOS_CSourceFilter__ |
---|