1 | #ifndef __XIOS_CLIENT_FROM_SERVER_SOURCE_FILTER__ |
---|
2 | #define __XIOS_CLIENT_FROM_SERVER_SOURCE_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 | |
---|
17 | /*! |
---|
18 | * A source filter is the entry point of the data in the graph of filters. |
---|
19 | */ |
---|
20 | class CClientFromServerSourceFilter : public COutputPin |
---|
21 | { |
---|
22 | public: |
---|
23 | /*! |
---|
24 | * Constructs a source filter accepting data attached to the specified grid. |
---|
25 | * |
---|
26 | * \param gc the garbage collector associated with this filter |
---|
27 | * \param field associated to the filter |
---|
28 | */ |
---|
29 | CClientFromServerSourceFilter(CGarbageCollector& gc, CField* field); |
---|
30 | |
---|
31 | /*! |
---|
32 | * Transforms the data received from the model into a packet and send it |
---|
33 | * in the filter graph. The array containing the data can safely be reused |
---|
34 | * immediately after this method returns. |
---|
35 | * |
---|
36 | * \param event the event coming from server with the associated data |
---|
37 | */ |
---|
38 | void streamData(CEventServer& event); |
---|
39 | bool isDataLate(void) ; |
---|
40 | bool isEOF() {return isEOF_ ;} |
---|
41 | int sendReadDataRequest(const CDate& tsDataRequested) ; |
---|
42 | bool sendReadDataRequestIfNeeded(void) ; |
---|
43 | void checkForLateData(void) ; |
---|
44 | |
---|
45 | private: |
---|
46 | CField* field_; |
---|
47 | CGrid* grid_; //!< The grid attached to the data the filter can accept |
---|
48 | CDuration freqOp_ ; |
---|
49 | CDuration offset_ ; |
---|
50 | CContextClient* client_ = nullptr ; |
---|
51 | bool wasDataAlreadyReceived_= false ; |
---|
52 | CDate lastDateReceived_ ; |
---|
53 | bool wasDataRequestedFromServer_ = false ; |
---|
54 | CDate lastDataRequestedFromServer_ ; |
---|
55 | |
---|
56 | bool isEOF_ = false ; |
---|
57 | CDate dateEOF_ ; |
---|
58 | }; // class CClientFromServerSourceFilter |
---|
59 | } // namespace xios |
---|
60 | |
---|
61 | #endif //__XIOS_CLIENT_FROM_SERVER_SOURCE_FILTER__ |
---|