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

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

Introducing the new graph functionality. Attribute build_workflow_graph=.TRUE. is used in the field definition section in the xml file to enable the workflow graph of the field and other fields referecing to it. A more detailed document will be available soon on the graph fuctionality.

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