[2019] | 1 | #ifndef __XIOS_SERVER_TO_CLIENT_FILTER_HPP__ |
---|
| 2 | #define __XIOS_SERVER_TO_CLIENT_FILTER_HPP__ |
---|
| 3 | |
---|
| 4 | #include "input_pin.hpp" |
---|
| 5 | #include "graph_package.hpp" |
---|
| 6 | |
---|
| 7 | namespace xios |
---|
| 8 | { |
---|
| 9 | class CField; |
---|
| 10 | class CGrid ; |
---|
| 11 | class CContextClient ; |
---|
| 12 | |
---|
| 13 | /*! |
---|
| 14 | * A terminal filter which transmits the packets it receives to a field for writting in a file. |
---|
| 15 | */ |
---|
| 16 | class CServerToClientStoreFilter : 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 | CServerToClientStoreFilter(CGarbageCollector& gc, CField* field, CContextClient* client); |
---|
| 27 | |
---|
| 28 | /*! |
---|
[2137] | 29 | * Get the size of data transfered by call. Needed for context client buffer size evaluation |
---|
| 30 | * |
---|
| 31 | * \param size : map returning the size for each server rank |
---|
| 32 | * \return the associated context client |
---|
| 33 | */ |
---|
| 34 | CContextClient* getTransferedDataSize(map<int,int>& size) ; |
---|
| 35 | |
---|
| 36 | /*! |
---|
[2019] | 37 | * Tests if the filter must auto-trigger. |
---|
| 38 | * |
---|
| 39 | * \return true if the filter must auto-trigger |
---|
| 40 | */ |
---|
| 41 | bool virtual mustAutoTrigger() const; |
---|
| 42 | |
---|
| 43 | /*! |
---|
| 44 | * Tests whether data is expected for the specified date. |
---|
| 45 | * |
---|
| 46 | * \param date the date associated to the data |
---|
| 47 | */ |
---|
| 48 | bool virtual isDataExpected(const CDate& date) const; |
---|
| 49 | CGraphPackage * graphPackage; |
---|
| 50 | bool graphEnabled; |
---|
| 51 | |
---|
| 52 | protected: |
---|
| 53 | /*! |
---|
| 54 | * Callbacks a field to write a packet to a file. |
---|
| 55 | * |
---|
| 56 | * \param data a vector of packets corresponding to each slot |
---|
| 57 | */ |
---|
| 58 | void virtual onInputReady(std::vector<CDataPacketPtr> data); |
---|
| 59 | |
---|
| 60 | private: |
---|
| 61 | CField* field_; //<! The associated field |
---|
| 62 | CGrid* grid_; //<! The associated grid |
---|
| 63 | CContextClient* client_ ; //! the associated context client |
---|
| 64 | std::map<Time, CDataPacketPtr> packets; //<! The stored packets |
---|
| 65 | int nStep_ = 0 ; |
---|
| 66 | }; // class CServerToClientStoreFilter |
---|
| 67 | } // namespace xios |
---|
| 68 | |
---|
| 69 | #endif // XIOS_SERVER_TO_CLIENT_FILTER_HPP |
---|