source: XIOS/trunk/src/buffer_in.cpp @ 501

Last change on this file since 501 was 501, checked in by ymipsl, 10 years ago

Add licence copyright to all file ond directory src using the command :
svn propset -R copyright -F header_licence src

XIOS is now officialy under CeCILL licence

YM

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1#include "xmlioserver_spl.hpp"
2#include "buffer_in.hpp"
3
4
5namespace xios
6{
7    CBufferIn::CBufferIn(void* buffer,size_t size)
8    {
9      own=false ;
10      realloc(buffer,size) ;
11    }
12   
13    CBufferIn::CBufferIn(size_t size)
14    {
15      own=false ;
16      realloc(size) ;
17    }
18
19    CBufferIn::CBufferIn(void)
20    {
21      own=false ;
22      realloc(0,0) ;     
23    }
24
25    void CBufferIn::realloc(size_t size)
26    {
27      realloc(new char[size_],size) ;
28      own=true ;
29    }
30
31    void CBufferIn::realloc(void* buffer,size_t size)
32    {
33      if (own) delete [] begin ;
34      begin=(char*)buffer ;
35      size_=size ;
36      current=begin ;
37      end=begin+size_ ;
38      count_=0 ;
39      own=false ;
40    }
41
42    bool CBufferIn::advance(size_t n) { return advance<char>(n); }
43
44    size_t CBufferIn::remain(void)
45    {
46      return size_-count_ ;
47    }   
48
49    size_t CBufferIn::count(void)
50    {
51      return count_ ;
52    }
53
54    size_t CBufferIn::size(void)
55    {
56      return size_ ;
57    }
58   
59    CBufferIn::~CBufferIn()
60    {
61      if (own) delete [] begin ;
62    }
63
64    void* CBufferIn::ptr(void) { return current; }
65   
66}
67   
68     
69   
Note: See TracBrowser for help on using the repository browser.