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