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