XIOS  1.0
Xml I/O Server
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Définitions de type Énumérations Valeurs énumérées Amis Macros
buffer_out.cpp
Aller à la documentation de ce fichier.
1 #include "xios_spl.hpp"
2 #include "buffer_out.hpp"
3 
4 
5 namespace xios
6 {
7  CBufferOut::CBufferOut(void* buffer,size_t size)
8  {
9  own=false ;
10  realloc(buffer,size) ;
11  }
12 
14  {
15  own=false ;
16  realloc(0,0) ;
17  }
18 
20  {
21  own=false ;
22  realloc(size) ;
23  }
24 
25  void CBufferOut::realloc(size_t size)
26  {
27  realloc(new char[size],size) ;
28  own=true ;
29  }
30 
31  void CBufferOut::realloc(void* buffer,size_t size)
32  {
33  if (own) delete [] begin ;
34  begin=(char*)buffer ;
35  size_=size ;
36  end=begin+size_ ;
37  count_=0 ;
38  current=begin ;
39  own=false ;
40  }
41 
42  bool CBufferOut::advance(size_t n) { return advance<char>(n); }
43 
44  void* CBufferOut::ptr(void)
45  {
46  return current ;
47  }
48 
49  size_t CBufferOut::remain(void)
50  {
51  return size_-count_ ;
52  }
53 
54  size_t CBufferOut::count(void)
55  {
56  return count_ ;
57  }
58 
60  {
61  return size_ ;
62  }
63 
65  {
66  if (own) delete [] begin ;
67  }
68 
69 }
70 
71 
72 
size_t count(void)
Definition: buffer_out.cpp:54
#define xios(arg)
size_t bufferSize(void)
Definition: buffer_out.cpp:59
bool advance(size_t n)
Definition: buffer_out.cpp:42
size_t remain(void)
Definition: buffer_out.cpp:49
void * ptr(void)
Definition: buffer_out.cpp:44
void realloc(size_t size)
Definition: buffer_out.cpp:25