source: XIOS/dev/common/src/linear_buffer_impl.hpp @ 1512

Last change on this file since 1512 was 219, checked in by hozdoba, 13 years ago

Préparation nouvelle arborescence

File size: 2.3 KB
Line 
1#ifndef __XMLIO_CLinearBuffer_impl__
2#define __XMLIO_CLinearBuffer_impl__
3
4#include "buffer_impl.hpp"
5
6namespace xmlioserver
7{
8   namespace comm
9   {
10      /// ////////////////// Définitions (inline) /////////////////// ///
11
12      template <class T>
13         void CLinearBuffer::getLData(T & data, StdSize position) const
14      {
15         if (position >= bdata.size())
16            ERROR("CLinearBuffer::getData(position)",
17                  << " invalid position !");
18         SuperClass::getData(data, this->bdata[position]);
19      }
20
21      template <class T>
22          void CLinearBuffer::getLDataArray(ARRAY(T, 1) data, StdSize position) const
23      {
24         if (position >= bdata.size())
25            ERROR("CLinearBuffer::getDataArray(position)",
26                  << " invalid position !");
27         SuperClass::getDataArray(data, this->bdata[position]);
28      }
29
30      //---------------------------------------------------------------
31
32      template <class T>
33         void CLinearBuffer::appendLData(const T & data)
34      {
35         this->bdata.push_back(this->p_write);
36         SuperClass::setData(data, this->p_write);
37         this->p_write += SuperClass::getRequestedSize(data);
38      }
39
40      template <class T>
41         void CLinearBuffer::appendLDataArray(ARRAY(T, 1) data)
42      {
43         this->bdata.push_back(this->p_write);
44         SuperClass::setDataArray(data, this->p_write);
45         this->p_write += SuperClass::getRequestedSize(data);
46      }
47      //---------------------------------------------------------------
48
49      template <typename A1, typename A2, typename A3, typename A4>
50         StdSize CLinearBuffer::getRequestedSize
51          ( A1 * arg1, A2 * arg2, A3 * arg3, A4 * arg4) const
52      {
53         StdSize retvalue = 0;
54         long int nbarg   = 0;
55         retvalue += 3 * SuperClass::getRequestedSize(nbarg);
56
57         if (arg1 != NULL) retvalue += SuperClass::getRequestedSize(*arg1);
58         if (arg2 != NULL) retvalue += SuperClass::getRequestedSize(*arg2);
59         if (arg3 != NULL) retvalue += SuperClass::getRequestedSize(*arg3);
60         if (arg4 != NULL) retvalue += SuperClass::getRequestedSize(*arg4);
61         return (retvalue);
62      }
63
64      ///----------------------------------------------------------------
65
66   } // namespace comm
67} // namespace xmlioserver
68
69#endif // __XMLIO_CLinearBuffer_impl__
Note: See TracBrowser for help on using the repository browser.