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