source: XMLIO_V2/dev/dev_rv/src/xmlio/client.cpp @ 199

Last change on this file since 199 was 199, checked in by hozdoba, 13 years ago
File size: 3.3 KB
Line 
1#include "client.hpp"
2
3#include "linear_buffer_impl.hpp"
4
5namespace xmlioserver {
6namespace comm {
7
8   /// ////////////////////// Définitions ////////////////////// ///
9   
10   CClient::CClient(MPIComm comm_client_server)
11      : bpair(comm_client_server)
12   { 
13      this->initialize();
14   } 
15       
16   CClient::~CClient(void)
17   { 
18      this->finalize();
19   } 
20   
21   ///--------------------------------------------------------------
22   
23   const CBufferPair & CClient::getBufferPair(void) const 
24   {
25      return (this->bpair);
26   }   
27   
28   //---------------------------------------------------------------
29
30   void CClient::initialize(void)
31   {
32      this->bpair.prepareRequest(0, 0, CLinearBuffer::NULL_ARG,
33                                       CLinearBuffer::NULL_ARG,
34                                       CLinearBuffer::NULL_ARG,
35                                       CLinearBuffer::NULL_ARG);
36      // Pas d'argument à ajouter.
37   }
38   
39   //---------------------------------------------------------------
40   
41   void CClient::finalize(void)
42   {
43      this->bpair.prepareRequest(0, 1, CLinearBuffer::NULL_ARG,
44                                       CLinearBuffer::NULL_ARG,
45                                       CLinearBuffer::NULL_ARG,
46                                       CLinearBuffer::NULL_ARG);
47      // Pas d'argument à ajouter.
48      this->bpair.sendCurrentBuffer();
49      comm::CMPIManager::Barrier();
50   }
51   
52   //---------------------------------------------------------------
53   
54   void CClient::setContext(const StdString & idContext)
55   {
56      this->bpair.prepareRequest(1, 0, &idContext,
57                                       CLinearBuffer::NULL_ARG,
58                                       CLinearBuffer::NULL_ARG,
59                                       CLinearBuffer::NULL_ARG);
60      this->bpair.getCurrentBuffer().appendString(idContext);
61   }
62   
63   //---------------------------------------------------------------
64   
65   void CClient::updateCalendar(long int timestep)
66   {
67      this->bpair.prepareRequest(1, 1, &timestep,
68                                       CLinearBuffer::NULL_ARG,
69                                       CLinearBuffer::NULL_ARG,
70                                       CLinearBuffer::NULL_ARG);
71      this->bpair.getCurrentBuffer().appendInt(timestep);
72   }
73   
74   //---------------------------------------------------------------
75   
76   void CClient::sendData(const StdString & fieldId, const ARRAY(float, 1) dataArray)
77   {
78      this->bpair.prepareRequest(2, 0, &fieldId, &dataArray,
79                                       CLinearBuffer::NULL_ARG,
80                                       CLinearBuffer::NULL_ARG);
81      this->bpair.getCurrentBuffer().appendString(fieldId);
82      this->bpair.getCurrentBuffer().appendFloatArray(dataArray);
83   }
84   
85   //---------------------------------------------------------------
86   
87   void CClient::sendData(const StdString & fieldId, const ARRAY(double, 1) dataArray)
88   {
89      this->bpair.prepareRequest(2, 1, &fieldId, &dataArray,
90                                       CLinearBuffer::NULL_ARG,
91                                       CLinearBuffer::NULL_ARG);
92      this->bpair.getCurrentBuffer().appendString(fieldId);
93      this->bpair.getCurrentBuffer().appendDoubleArray(dataArray);
94   }
95
96   ///--------------------------------------------------------------
97
98} // namespace comm
99} // namespace xmlioserver
Note: See TracBrowser for help on using the repository browser.