source: XIOS/dev/dev_trunk_omp/src/filter/file_writer_filter.hpp @ 1668

Last change on this file since 1668 was 1668, checked in by yushan, 5 years ago

MARK: branch merged with trunk @1663. static graph OK with EP

File size: 1.8 KB
Line 
1#ifndef __XIOS_CFileWriterFilter__
2#define __XIOS_CFileWriterFilter__
3
4#include "input_pin.hpp"
5
6namespace xios
7{
8  class CField;
9
10  /*!
11   * A terminal filter which transmits the packets it receives to a field for writting in a file.
12   */
13  class CFileWriterFilter : public CInputPin
14  {
15    public:
16      /*!
17       * Constructs the filter (with one input slot) associated to the specified field
18       * and a garbage collector.
19       *
20       * \param gc the associated garbage collector
21       * \param field the associated field
22       * \param[in] buildWorkflowGraph indicates whether the workflow will be visualized
23       */
24      CFileWriterFilter(CGarbageCollector& gc, CField* field, bool buildWorkflowGraph = false);
25
26      inline StdString GetName(void) {return StdString("File writer filter");};
27
28      /*!
29       * Tests if the filter must auto-trigger.
30       *
31       * \return true if the filter must auto-trigger
32       */
33      bool virtual mustAutoTrigger() const;
34
35      /*!
36       * Tests whether data is expected for the specified date.
37       *
38       * \param date the date associated to the data
39       */
40      bool virtual isDataExpected(const CDate& date) const;
41
42      /*!
43       * Returns filter's id needed in case of building workflow graph
44       */
45      int getFilterId();
46
47    protected:
48      /*!
49       * Callbacks a field to write a packet to a file.
50       *
51       * \param data a vector of packets corresponding to each slot
52       */
53      void virtual onInputReady(std::vector<CDataPacketPtr> data);
54
55    private:
56      CField* field; //<! The associated field
57      std::map<Time, CDataPacketPtr> packets; //<! The stored packets
58      int filterId;                           //<! Filter's id needed in case of building a workflow
59
60  }; // class CFileWriterFilter
61} // namespace xios
62
63#endif //__XIOS_CFileWriterFilter__
Note: See TracBrowser for help on using the repository browser.