source: XIOS/trunk/src/filter/source_filter.hpp @ 827

Last change on this file since 827 was 756, checked in by rlacroix, 9 years ago

Support freq_offset for fields in files in read mode.

In theory the first record of a file being read is available at timestep 0, this allows to delay the availability of the data to a later timestep.

Use a temporary solution for now until this can be properly integrated in a temporal filter.

File size: 1.9 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 grid the grid to which the data is attached
22       * \param offset the offset applied to the timestamp of all packets
23       */
24      CSourceFilter(CGrid* grid, const CDuration offset = NoneDu);
25
26      /*!
27       * Transforms the data received from the model into a packet and send it
28       * in the filter graph. The array containing the data can safely be reused
29       * immediately after this method returns.
30       *
31       * \param date the date associated to the data
32       * \param data an array containing the data
33       */
34      template <int N>
35      void streamData(CDate date, const CArray<double, N>& data);
36
37      /*!
38       * Transforms the data received from the server into a packet and send it
39       * in the filter graph. The array containing the data can safely be reused
40       * immediately after this method returns.
41       *
42       * \param date the date associated to the data
43       * \param data an array containing the data
44       */
45      void streamDataFromServer(CDate date, const std::map<int, CArray<double, 1> >& data);
46
47      /*!
48       * Signals the filter graph that the end of stream was reached.
49       *
50       * \param date the date at which the end of stream occurred
51       */
52      void signalEndOfStream(CDate date);
53
54    private:
55      CGrid* grid; //!< The grid attached to the data the filter can accept
56      const CDuration offset; //!< The offset applied to the timestamp of all packets
57  }; // class CSourceFilter
58} // namespace xios
59
60#endif //__XIOS_CSourceFilter__
Note: See TracBrowser for help on using the repository browser.