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

Last change on this file since 196 was 196, 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      this->bpair.sendCurrentBuffer(); 
45   }
46   
47   //---------------------------------------------------------------
48   
49   void CClient::setContext(const StdString & idContext)
50   {
51      this->bpair.prepareRequest(1, 0, &idContext,
52                                       CLinearBuffer::NULL_ARG,
53                                       CLinearBuffer::NULL_ARG,
54                                       CLinearBuffer::NULL_ARG);
55      this->bpair.getCurrentBuffer().appendString(idContext);
56   }
57   
58   //---------------------------------------------------------------
59   
60   void CClient::updateCalendar(long int timestep)
61   {
62      this->bpair.prepareRequest(1, 1, &timestep,
63                                       CLinearBuffer::NULL_ARG,
64                                       CLinearBuffer::NULL_ARG,
65                                       CLinearBuffer::NULL_ARG);
66      this->bpair.getCurrentBuffer().appendInt(timestep);
67   }
68   
69   //---------------------------------------------------------------
70   
71   void CClient::sendData(const StdString & fieldId, const ARRAY(float, 1) dataArray)
72   {
73      this->bpair.prepareRequest(2, 0, &fieldId, &dataArray,
74                                       CLinearBuffer::NULL_ARG,
75                                       CLinearBuffer::NULL_ARG);
76      this->bpair.getCurrentBuffer().appendString(fieldId);
77      this->bpair.getCurrentBuffer().appendFloatArray(dataArray);
78   }
79   
80   //---------------------------------------------------------------
81   
82   void CClient::sendData(const StdString & fieldId, const ARRAY(double, 1) dataArray)
83   {
84      this->bpair.prepareRequest(2, 1, &fieldId, &dataArray,
85                                       CLinearBuffer::NULL_ARG,
86                                       CLinearBuffer::NULL_ARG);
87      this->bpair.getCurrentBuffer().appendString(fieldId);
88      this->bpair.getCurrentBuffer().appendDoubleArray(dataArray);
89   }
90
91   ///--------------------------------------------------------------
92
93} // namespace comm
94} // namespace xmlioserver
Note: See TracBrowser for help on using the repository browser.