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