1 | #ifndef __XIOS_FILE_WRITER_STORE_FILTER_HPP__ |
---|
2 | #define __XIOS_FILE_WRITER_STORE_FILTER_HPP__ |
---|
3 | |
---|
4 | #include "input_pin.hpp" |
---|
5 | #include "graph_package.hpp" |
---|
6 | |
---|
7 | namespace xios |
---|
8 | { |
---|
9 | class CField; |
---|
10 | class CFile; |
---|
11 | class CGrid; |
---|
12 | |
---|
13 | /*! |
---|
14 | * A terminal filter which writes the packets it receives in a file. |
---|
15 | */ |
---|
16 | class CFileWriterStoreFilter : public CInputPin |
---|
17 | { |
---|
18 | public: |
---|
19 | /*! |
---|
20 | * Constructs the filter (with one input slot) associated to the specified field |
---|
21 | * and a garbage collector. |
---|
22 | * |
---|
23 | * \param gc the associated garbage collector |
---|
24 | * \param field the associated field |
---|
25 | */ |
---|
26 | CFileWriterStoreFilter(CGarbageCollector& gc, CField* field); |
---|
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 | CGraphPackage *graphPackage; |
---|
43 | bool graphEnabled; |
---|
44 | |
---|
45 | protected: |
---|
46 | /*! |
---|
47 | * Callbacks a field to write a packet to a file. |
---|
48 | * |
---|
49 | * \param data a vector of packets corresponding to each slot |
---|
50 | */ |
---|
51 | void virtual onInputReady(std::vector<CDataPacketPtr> data); |
---|
52 | |
---|
53 | private: |
---|
54 | CField* field_; //<! The associated field |
---|
55 | CFile* file_ ; |
---|
56 | CGrid* grid_ ; |
---|
57 | CDate lastWrite_ ; |
---|
58 | CDate lastFileSplit_ ; |
---|
59 | CDuration freqWrite_ ; |
---|
60 | int nstep_ ; |
---|
61 | bool needToWrite_ ; |
---|
62 | double scaleFactor_ = 1.0; |
---|
63 | double addOffset_ = 0.0; |
---|
64 | bool hasScaleFactor_ = false ; |
---|
65 | bool hasAddOffset_ = false ; |
---|
66 | double defaultValue_ ; |
---|
67 | bool hasDefaultValue_=false; |
---|
68 | bool hasRounding_=false ; |
---|
69 | |
---|
70 | }; // class CFileWriterStoreFilter |
---|
71 | } // namespace xios |
---|
72 | |
---|
73 | #endif //__XIOS_FILE_WRITER_STORE_FILTER_HPP__ |
---|