source: XIOS/dev/dev_oa/src/filter/source_filter.hpp @ 2034

Last change on this file since 2034 was 2034, checked in by oabramkina, 3 years ago

Adding a possibility of tiled and non-tiled sent on the same domain.

File size: 3.1 KB
Line 
1#ifndef __XIOS_CSourceFilter__
2#define __XIOS_CSourceFilter__
3
4#include <map>
5
6#include "output_pin.hpp"
7
8namespace 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 gc the garbage collector associated with this filter
22       * \param grid the grid to which the data is attached
23       * \param compression
24       * \param mask
25       * \param offset the offset applied to the timestamp of all packets
26       * \param manualTrigger whether the output should be triggered manually
27       * \param hasMissingValue whether data has missing value
28       * \param defaultValue missing value to detect
29       */
30      CSourceFilter(CGarbageCollector& gc, CGrid* grid,
31                    bool compression = true,
32                    bool mask = false,
33                    const CDuration offset = NoneDu, bool manualTrigger = false,
34                    bool hasMissingValue = false,
35                    double defaultValue = 0.0);
36
37      inline StdString GetName(void) {return StdString("Source filter");};
38
39      /*!
40       * Transforms the data received from the model into a packet and send it
41       * in the filter graph. The array containing the data can safely be reused
42       * immediately after this method returns.
43       *
44       * \param date the date associated to the data
45       * \param data an array containing the data
46       */
47      template <int N>
48      void streamData(CDate date, const CArray<double, N>& data, bool isTiled = false);
49
50      template <int N>
51      void streamTile(CDate date, const CArray<double, N>& data, int ntile);
52
53      void virtual buildGraph(CDataPacketPtr packet);
54
55      /*!
56       * Transforms the data received from the server into a packet and send it
57       * in the filter graph. The array containing the data can safely be reused
58       * immediately after this method returns.
59       *
60       * \param date the date associated to the data
61       * \param data an array containing the data
62       */
63      void streamDataFromServer(CDate date, const std::map<int, CArray<double, 1> >& data);
64
65      /*!
66       * Signals the filter graph that the end of stream was reached.
67       *
68       * \param date the date at which the end of stream occurred
69       */
70      void signalEndOfStream(CDate date);
71      int filterID;
72
73    private:
74      CGrid* grid;             //!< The grid attached to the data the filter can accept
75      const CDuration offset;  //!< The offset applied to the timestamp of all packets
76      const bool hasMissingValue;
77      const double defaultValue;
78      const bool compression ; //!< indicates if data need to be compressed : on client side : true, on server side : false
79      const bool mask ;        //!< indicates whether grid mask should be applied (true for clients, false for servers)
80      int ntiles ;
81      CArray<double, 1> storedTileData;
82  }; // class CSourceFilter
83} // namespace xios
84
85#endif //__XIOS_CSourceFilter__
Note: See TracBrowser for help on using the repository browser.