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

Last change on this file since 191 was 191, 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   { /* Ne rien faire de plus */ } 
13       
14   CClient::~CClient(void)
15   { /* Ne rien faire de plus */ } 
16   
17   ///--------------------------------------------------------------
18   
19   const CBufferPair & CClient::getBufferPair(void) const 
20   {
21      return (this->bpair);
22   }   
23   
24   //---------------------------------------------------------------
25
26   void CClient::initialize(void)
27   {
28      this->bpair.prepareRequest(0, 0, CLinearBuffer::NULL_ARG,
29                                       CLinearBuffer::NULL_ARG,
30                                       CLinearBuffer::NULL_ARG,
31                                       CLinearBuffer::NULL_ARG);
32      // Pas d'argument à ajouter.
33   }
34   
35   //---------------------------------------------------------------
36   
37   void CClient::finalize(void)
38   {
39      this->bpair.prepareRequest(0, 1, CLinearBuffer::NULL_ARG,
40                                       CLinearBuffer::NULL_ARG,
41                                       CLinearBuffer::NULL_ARG,
42                                       CLinearBuffer::NULL_ARG);
43      // Pas d'argument à ajouter.
44   }
45   
46   //---------------------------------------------------------------
47   
48   void CClient::setContext(const StdString & idContext)
49   {
50      this->bpair.prepareRequest(1, 0, &idContext,
51                                       CLinearBuffer::NULL_ARG,
52                                       CLinearBuffer::NULL_ARG,
53                                       CLinearBuffer::NULL_ARG);
54      this->bpair.getCurrentBuffer().appendString(idContext);
55   }
56   
57   //---------------------------------------------------------------
58   
59   void CClient::updateCalendar(long int timestep)
60   {
61      this->bpair.prepareRequest(1, 1, &timestep,
62                                       CLinearBuffer::NULL_ARG,
63                                       CLinearBuffer::NULL_ARG,
64                                       CLinearBuffer::NULL_ARG);
65      this->bpair.getCurrentBuffer().appendInt(timestep);
66   }
67   
68   //---------------------------------------------------------------
69   
70   void CClient::sendData(const StdString & fieldId, const ARRAY(float, 1) dataArray)
71   {
72      this->bpair.prepareRequest(2, 0, &fieldId, &dataArray,
73                                       CLinearBuffer::NULL_ARG,
74                                       CLinearBuffer::NULL_ARG);
75      this->bpair.getCurrentBuffer().appendString(fieldId);
76      this->bpair.getCurrentBuffer().appendFloatArray(dataArray);
77   }
78   
79   //---------------------------------------------------------------
80   
81   void CClient::sendData(const StdString & fieldId, const ARRAY(double, 1) dataArray)
82   {
83      this->bpair.prepareRequest(2, 0, &fieldId, &dataArray,
84                                       CLinearBuffer::NULL_ARG,
85                                       CLinearBuffer::NULL_ARG);
86      this->bpair.getCurrentBuffer().appendString(fieldId);
87      this->bpair.getCurrentBuffer().appendDoubleArray(dataArray);
88   }
89
90   ///--------------------------------------------------------------
91
92} // namespace comm
93} // namespace xmlioserver
Note: See TracBrowser for help on using the repository browser.