source: XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/server_from_client_source_filter.cpp @ 1960

Last change on this file since 1960 was 1930, 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".

YM

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.1 KB
Line 
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
7
8namespace xios
9{
10  CServerFromClientSourceFilter::CServerFromClientSourceFilter(CGarbageCollector& gc, CGrid* grid)
11    : COutputPin(gc)
12    , grid_(grid)
13  {
14    if (!grid_)
15      ERROR("CServerFromClientSourceFilter::CServerFromClientSourceFilter(CGarbageCollector& gc, CGrid* grid)",
16            "Impossible to construct a source filter without providing a grid.");
17  }
18
19  void CServerFromClientSourceFilter::streamData(CEventServer& event)
20  {
21    Time timeStamp ;
22    for (auto& subEvent : event.subEvents) (*subEvent.buffer) >> timeStamp  ;
23    CDataPacketPtr packet(new CDataPacket);
24    packet->date = CContext::getCurrent()->getCalendar()->getTimeOrigin() + timeStamp*Second; // very bad, better to pass directly the date
25    packet->timestamp = timeStamp;
26    packet->status = CDataPacket::NO_ERROR;
27    grid_->getServerFromClientConnector()->transfer(event,packet->data) ;
28
29    onOutputReady(packet);
30  }
31
32 
33 
34} // namespace xios
Note: See TracBrowser for help on using the repository browser.