1 | #include "server_from_client_source_filter.hpp" |
---|
2 | #include "grid.hpp" |
---|
3 | #include "exception.hpp" |
---|
4 | #include "calendar_util.hpp" |
---|
5 | #include "context.hpp" |
---|
6 | #include "workflow_graph.hpp" |
---|
7 | |
---|
8 | namespace xios |
---|
9 | { |
---|
10 | extern CLogType logProfile ; |
---|
11 | CServerFromClientSourceFilter::CServerFromClientSourceFilter(CGarbageCollector& gc, CGrid* grid) |
---|
12 | : COutputPin(gc) |
---|
13 | , grid_(grid) |
---|
14 | { |
---|
15 | if (!grid_) |
---|
16 | ERROR("CServerFromClientSourceFilter::CServerFromClientSourceFilter(CGarbageCollector& gc, CGrid* grid)", |
---|
17 | "Impossible to construct a source filter without providing a grid."); |
---|
18 | } |
---|
19 | |
---|
20 | void CServerFromClientSourceFilter::streamData(CEventServer& event) |
---|
21 | { |
---|
22 | Time timeStamp ; |
---|
23 | for (auto& subEvent : event.subEvents) (*subEvent.buffer) >> timeStamp ; |
---|
24 | CDataPacketPtr packet(new CDataPacket); |
---|
25 | packet->date = CContext::getCurrent()->getCalendar()->getTimeOrigin() + timeStamp*Second; // very bad, better to pass directly the date |
---|
26 | packet->timestamp = timeStamp; |
---|
27 | packet->status = CDataPacket::NO_ERROR; |
---|
28 | if (info.isActive(logProfile)) CTimer::get("Server workflow data entry").resume(); |
---|
29 | grid_->getServerFromClientConnector()->transfer(event,packet->data) ; |
---|
30 | if (info.isActive(logProfile)) CTimer::get("Server workflow data entry").suspend(); |
---|
31 | |
---|
32 | if(this->graphEnabled) |
---|
33 | { |
---|
34 | this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); |
---|
35 | packet->graphPackage = new CGraphDataPackage; |
---|
36 | packet->graphPackage->fromFilter = this->graphPackage->filterId; |
---|
37 | packet->graphPackage->currentField = this->graphPackage->inFields[0]; |
---|
38 | CWorkflowGraph::addNode("Server from Client Source filter", 1, false, 0, packet); |
---|
39 | } |
---|
40 | if (info.isActive(logProfile)) CTimer::get("Server workflow").resume(); |
---|
41 | onOutputReady(packet); |
---|
42 | if (info.isActive(logProfile)) CTimer::get("Server workflow").suspend(); |
---|
43 | } |
---|
44 | |
---|
45 | |
---|
46 | |
---|
47 | } // namespace xios |
---|