Last change
on this file since 1960 was
1934,
checked in by ymipsl, 4 years ago
|
Big update on on going work related to data distribution and transfer between clients and servers.
Revisite of the source and store filter using "connectors".
-> inputs work again
YM
|
-
Property svn:eol-style set to
native
-
Property svn:executable set to
*
|
File size:
1.6 KB
|
Line | |
---|
1 | #include "server_to_client_store_filter.hpp" |
---|
2 | #include "exception.hpp" |
---|
3 | #include "field.hpp" |
---|
4 | #include "grid.hpp" |
---|
5 | #include "utils.hpp" |
---|
6 | #include "context_client.hpp" |
---|
7 | |
---|
8 | namespace xios |
---|
9 | { |
---|
10 | CServerToClientStoreFilter::CServerToClientStoreFilter(CGarbageCollector& gc, CField* field, CContextClient* client) |
---|
11 | : CInputPin(gc, 1) |
---|
12 | , field_(field), client_(client) |
---|
13 | { |
---|
14 | if (!field) ERROR("CServerToClientFilter::CServerToClientFilter(CField* field)", "The field cannot be null."); |
---|
15 | grid_ = field_ -> getGrid() ; |
---|
16 | } |
---|
17 | |
---|
18 | void CServerToClientStoreFilter::onInputReady(std::vector<CDataPacketPtr> packets) |
---|
19 | { |
---|
20 | bool isEOF ; |
---|
21 | if (packets[0]->status == CDataPacket::NO_ERROR) isEOF = false ; |
---|
22 | else if (packets[0]->status == CDataPacket::END_OF_STREAM) isEOF = true ; |
---|
23 | |
---|
24 | CEventClient event(field_->getType(), CField::EVENT_ID_READ_DATA_READY); |
---|
25 | |
---|
26 | auto connector = grid_->getServerToClientConnector() ; |
---|
27 | CMessage msg ; |
---|
28 | msg<<field_->getId() ; |
---|
29 | |
---|
30 | if (isEOF) |
---|
31 | { |
---|
32 | msg<<(int)(-1) ; |
---|
33 | connector->transfer(client_,event, msg) ; |
---|
34 | info(20)<<"Send Data from server to client: FieldId : "<<field_->getId()<<" step : "<<nStep_<< " -->EOF"<<endl; |
---|
35 | } |
---|
36 | else |
---|
37 | { |
---|
38 | msg<<nStep_ ; |
---|
39 | connector->transfer(packets[0]->data, client_, event, msg) ; |
---|
40 | info(20)<<"Send Data from server to client: FieldId : "<<field_->getId()<<" step : "<<nStep_<<endl; |
---|
41 | } |
---|
42 | |
---|
43 | nStep_++ ; |
---|
44 | } |
---|
45 | |
---|
46 | |
---|
47 | bool CServerToClientStoreFilter::mustAutoTrigger() const |
---|
48 | { |
---|
49 | return true; |
---|
50 | } |
---|
51 | |
---|
52 | bool CServerToClientStoreFilter::isDataExpected(const CDate& date) const |
---|
53 | { |
---|
54 | return true; |
---|
55 | } |
---|
56 | } // namespace xios |
---|
Note: See
TracBrowser
for help on using the repository browser.