source: XIOS/trunk/src/filter/file_writer_filter.hpp @ 1119

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

Add the ability to check if an output field is active at the current timestep.

The "xios_field_is_active" function can now take an optional logical argument that can be used to enable this new behavior.

File size: 1.2 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       */
23      CFileWriterFilter(CGarbageCollector& gc, CField* field);
24
25      /*!
26       * Tests whether data is expected for the specified date.
27       *
28       * \param date the date associated to the data
29       */
30      bool virtual isDataExpected(const CDate& date) const;
31
32    protected:
33      /*!
34       * Callbacks a field to write a packet to a file.
35       *
36       * \param data a vector of packets corresponding to each slot
37       */
38      void virtual onInputReady(std::vector<CDataPacketPtr> data);
39
40    private:
41      CField* field; //<! The associated field
42      std::map<Time, CDataPacketPtr> packets; //<! The stored packets
43  }; // class CFileWriterFilter
44} // namespace xios
45
46#endif //__XIOS_CFileWriterFilter__
Note: See TracBrowser for help on using the repository browser.