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

Last change on this file since 1006 was 1006, checked in by rlacroix, 7 years ago

The workflow is now triggered when using xios_recv_field for fields in read mode received from the servers.

Previously the workflow was triggered upon receiving the data which could cause deadlocks since there are no garanties that clients are receiving data at the same time.

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