source: XIOS/dev/branch_yushan_merged/src/filter/source_filter.hpp @ 1205

Last change on this file since 1205 was 1205, checked in by yushan, 7 years ago

branch merged with trunk @1200

File size: 2.4 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 offset the offset applied to the timestamp of all packets
24       * \param manualTrigger whether the output should be triggered manually
25       * \param hasMissingValue whether data has missing value
26       * \param defaultValue missing value to detect
27       */
28      CSourceFilter(CGarbageCollector& gc, CGrid* grid,
29                    const CDuration offset = NoneDu, bool manualTrigger = false,
30                    bool hasMissingValue = false,
31                    double defaultValue = 0.0);
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       *
38       * \param date the date associated to the data
39       * \param data an array containing the data
40       */
41      template <int N>
42      void streamData(CDate date, const CArray<double, N>& data);
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       *
49       * \param date the date associated to the data
50       * \param data an array containing the data
51       */
52      void streamDataFromServer(CDate date, const std::map<int, CArray<double, 1> >& data);
53
54      /*!
55       * Signals the filter graph that the end of stream was reached.
56       *
57       * \param date the date at which the end of stream occurred
58       */
59      void signalEndOfStream(CDate date);
60
61    private:
62      CGrid* grid; //!< The grid attached to the data the filter can accept
63      const CDuration offset; //!< The offset applied to the timestamp of all packets
64      const bool hasMissingValue;
65      const double defaultValue;
66  }; // class CSourceFilter
67} // namespace xios
68
69#endif //__XIOS_CSourceFilter__
Note: See TracBrowser for help on using the repository browser.