[638] | 1 | #ifndef __XIOS_CFileWriterFilter__ |
---|
| 2 | #define __XIOS_CFileWriterFilter__ |
---|
| 3 | |
---|
| 4 | #include "input_pin.hpp" |
---|
| 5 | |
---|
| 6 | namespace 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 | /*! |
---|
[639] | 17 | * Constructs the filter (with one input slot) associated to the specified field |
---|
| 18 | * and a garbage collector. |
---|
[638] | 19 | * |
---|
[639] | 20 | * \param gc the associated garbage collector |
---|
[638] | 21 | * \param field the associated field |
---|
| 22 | */ |
---|
[639] | 23 | CFileWriterFilter(CGarbageCollector& gc, CField* field); |
---|
[638] | 24 | |
---|
[1653] | 25 | inline StdString GetName(void) {return StdString("File writer filter");}; |
---|
| 26 | |
---|
[1158] | 27 | /*! |
---|
[1358] | 28 | * Tests if the filter must auto-trigger. |
---|
| 29 | * |
---|
| 30 | * \return true if the filter must auto-trigger |
---|
| 31 | */ |
---|
| 32 | bool virtual mustAutoTrigger() const; |
---|
| 33 | |
---|
| 34 | /*! |
---|
[1158] | 35 | * Tests whether data is expected for the specified date. |
---|
| 36 | * |
---|
| 37 | * \param date the date associated to the data |
---|
| 38 | */ |
---|
| 39 | bool virtual isDataExpected(const CDate& date) const; |
---|
| 40 | |
---|
[1653] | 41 | /*! |
---|
| 42 | * Returns filter's id needed in case of building workflow graph |
---|
| 43 | */ |
---|
| 44 | int getFilterId(); |
---|
| 45 | |
---|
[638] | 46 | protected: |
---|
| 47 | /*! |
---|
| 48 | * Callbacks a field to write a packet to a file. |
---|
| 49 | * |
---|
| 50 | * \param data a vector of packets corresponding to each slot |
---|
| 51 | */ |
---|
| 52 | void virtual onInputReady(std::vector<CDataPacketPtr> data); |
---|
| 53 | |
---|
| 54 | private: |
---|
[1653] | 55 | CField* field; //<! The associated field |
---|
[638] | 56 | std::map<Time, CDataPacketPtr> packets; //<! The stored packets |
---|
[1653] | 57 | int filterId; //<! Filter's id needed in case of building a workflow |
---|
| 58 | |
---|
[638] | 59 | }; // class CFileWriterFilter |
---|
| 60 | } // namespace xios |
---|
| 61 | |
---|
| 62 | #endif //__XIOS_CFileWriterFilter__ |
---|