[2482] | 1 | #ifndef __XIOS_ONLINE_READER_FILTER__ |
---|
| 2 | #define __XIOS_ONLINE_READER_FILTER__ |
---|
| 3 | |
---|
| 4 | #include <map> |
---|
| 5 | |
---|
| 6 | #include "output_pin.hpp" |
---|
| 7 | #include "event_server.hpp" |
---|
| 8 | #include "context_client.hpp" |
---|
| 9 | #include "calendar_util.hpp" |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | namespace xios |
---|
| 13 | { |
---|
| 14 | class CGrid; |
---|
| 15 | class CField; |
---|
| 16 | class CGridRedistributeFilterIn ; |
---|
| 17 | class CFileReaderSourceFilter ; |
---|
| 18 | |
---|
| 19 | /*! |
---|
| 20 | * A source filter is the entry point of the data in the graph of filters. |
---|
| 21 | */ |
---|
| 22 | class CClientOnlineReaderFilter : public CFilter, public IFilterEngine, public std::enable_shared_from_this<CClientOnlineReaderFilter> |
---|
| 23 | { |
---|
| 24 | public: |
---|
| 25 | /*! |
---|
| 26 | * Constructs a source filter accepting data attached to the specified grid. |
---|
| 27 | * |
---|
| 28 | * \param gc the garbage collector associated with this filter |
---|
| 29 | * \param field associated to the filter |
---|
| 30 | */ |
---|
| 31 | CClientOnlineReaderFilter(CGarbageCollector& gc, CField* field); |
---|
| 32 | |
---|
| 33 | /*! |
---|
| 34 | * Transforms the data received from the model into a packet and send it |
---|
| 35 | * in the filter graph. The array containing the data can safely be reused |
---|
| 36 | * immediately after this method returns. |
---|
| 37 | * |
---|
| 38 | * \param event the event coming from server with the associated data |
---|
| 39 | */ |
---|
| 40 | void streamData(CEventServer& event); |
---|
| 41 | bool isDataLate(void) ; |
---|
| 42 | bool isEOF() {return isEOF_ ;} |
---|
| 43 | bool sendReadDataRequest(const CDate& tsDataRequested) ; |
---|
| 44 | CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); |
---|
| 45 | bool sendReadDataRequestIfNeeded(void) ; |
---|
| 46 | void checkForLateData(void) ; |
---|
| 47 | |
---|
| 48 | private: |
---|
| 49 | |
---|
| 50 | CDuration freqOp_ ; |
---|
| 51 | CDuration offset_ ; |
---|
| 52 | CDate lastDateReceived_ ; |
---|
| 53 | bool isFirstDataSent_ = false ; |
---|
| 54 | |
---|
| 55 | CField* field_; |
---|
| 56 | shared_ptr<CGridRedistributeFilterIn> redistributeFilter_ ; |
---|
| 57 | std::shared_ptr<CFileReaderSourceFilter> fileReaderSourceFilter_ ; |
---|
| 58 | |
---|
| 59 | bool isEOF_ = false ; |
---|
| 60 | CDate dateEOF_ ; |
---|
| 61 | }; // class CClientFromServerSourceFilter |
---|
| 62 | } // namespace xios |
---|
| 63 | |
---|
| 64 | #endif // __XIOS_ONLINE_READER_FILTER__ |
---|