source: XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/server_to_client_filter.cpp @ 1883

Last change on this file since 1883 was 1883, checked in by ymipsl, 4 years ago

XIOS coupling branch
Adopt infrastructure based on filter for reading data on server side and sending it to the client, in a similar way on what is done for other case.

YM

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.0 KB
Line 
1#include "server_to_client_filter.hpp"
2#include "exception.hpp"
3#include "field.hpp"
4#include "utils.hpp"
5#include "context_client.hpp"
6
7namespace xios
8{
9  CServerToClientFilter::CServerToClientFilter(CGarbageCollector& gc, CField* field, CContextClient* client)
10    : CInputPin(gc, 1)
11    , field_(field), client_(client)
12  {
13    if (!field) ERROR("CServerToClientFilter::CServerToClientFilter(CField* field)", "The field cannot be null.");
14  }
15
16  void CServerToClientFilter::onInputReady(std::vector<CDataPacketPtr> packets)
17  {
18   
19    if (packets[0]->status == CDataPacket::NO_ERROR)
20    {
21      field_->sendUpdateDataServerToClient(false, packets[0]->data, client_) ;
22    }
23    else if (packets[0]->status == CDataPacket::END_OF_STREAM)
24    {
25      field_->sendUpdateDataServerToClient(true, packets[0]->data, client_) ;
26    }
27  }
28
29
30  bool CServerToClientFilter::mustAutoTrigger() const
31  {
32    return true;
33  }
34
35  bool CServerToClientFilter::isDataExpected(const CDate& date) const
36  {
37    return true;
38  }
39} // namespace xios
Note: See TracBrowser for help on using the repository browser.