[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 | * |
---|
| 21 | * \param grid the grid to which the data is attached |
---|
[756] | 22 | * \param offset the offset applied to the timestamp of all packets |
---|
[638] | 23 | */ |
---|
[756] | 24 | CSourceFilter(CGrid* grid, const CDuration offset = NoneDu); |
---|
[638] | 25 | |
---|
| 26 | /*! |
---|
| 27 | * Transforms the data received from the model into a packet and send it |
---|
| 28 | * in the filter graph. The array containing the data can safely be reused |
---|
| 29 | * immediately after this method returns. |
---|
| 30 | * |
---|
[643] | 31 | * \param date the date associated to the data |
---|
[638] | 32 | * \param data an array containing the data |
---|
| 33 | */ |
---|
| 34 | template <int N> |
---|
[643] | 35 | void streamData(CDate date, const CArray<double, N>& data); |
---|
[638] | 36 | |
---|
| 37 | /*! |
---|
| 38 | * Transforms the data received from the server into a packet and send it |
---|
| 39 | * in the filter graph. The array containing the data can safely be reused |
---|
| 40 | * immediately after this method returns. |
---|
| 41 | * |
---|
[643] | 42 | * \param date the date associated to the data |
---|
[638] | 43 | * \param data an array containing the data |
---|
| 44 | */ |
---|
[643] | 45 | void streamDataFromServer(CDate date, const std::map<int, CArray<double, 1> >& data); |
---|
[638] | 46 | |
---|
| 47 | /*! |
---|
| 48 | * Signals the filter graph that the end of stream was reached. |
---|
| 49 | * |
---|
[643] | 50 | * \param date the date at which the end of stream occurred |
---|
[638] | 51 | */ |
---|
[643] | 52 | void signalEndOfStream(CDate date); |
---|
[638] | 53 | |
---|
| 54 | private: |
---|
| 55 | CGrid* grid; //!< The grid attached to the data the filter can accept |
---|
[756] | 56 | const CDuration offset; //!< The offset applied to the timestamp of all packets |
---|
[638] | 57 | }; // class CSourceFilter |
---|
| 58 | } // namespace xios |
---|
| 59 | |
---|
| 60 | #endif //__XIOS_CSourceFilter__ |
---|