source: XIOS/trunk/src/buffer_out.cpp @ 327

Last change on this file since 327 was 327, checked in by ymipsl, 9 years ago

port to gfortran/g++

YM

  • Property svn:eol-style set to native
File size: 1.2 KB
Line 
1#include "xmlioserver_spl.hpp"
2#include "buffer_out.hpp"
3
4
5namespace xmlioserver
6{
7    CBufferOut::CBufferOut(void* buffer,size_t size)
8    {
9      own=false ;
10      realloc(buffer,size) ;
11    }
12   
13    CBufferOut::CBufferOut(void)
14    {
15      own=false ;
16      realloc(0,0) ;     
17    }
18
19    CBufferOut::CBufferOut(size_t size)
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
59    size_t CBufferOut::size(void)
60    {
61      return size_ ;
62    }
63       
64    CBufferOut::~CBufferOut()
65    {
66      if (own) delete [] begin ;
67    }
68 
69}
70   
71     
72   
Note: See TracBrowser for help on using the repository browser.