Last change
on this file since 1775 was
695,
checked in by ymipsl, 9 years ago
|
Bug fix in buffer_in.cpp
Change attribut "size" by "bufferSize"
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 "xios_spl.hpp" |
---|
2 | #include "buffer_in.hpp" |
---|
3 | |
---|
4 | |
---|
5 | namespace xios |
---|
6 | { |
---|
7 | CBufferIn::CBufferIn(void* buffer,size_t size) |
---|
8 | { |
---|
9 | own=false ; |
---|
10 | size_=0 ; |
---|
11 | this->realloc(buffer,size) ; |
---|
12 | } |
---|
13 | |
---|
14 | CBufferIn::CBufferIn(size_t size) |
---|
15 | { |
---|
16 | own=false ; |
---|
17 | size_=0 ; |
---|
18 | realloc(size) ; |
---|
19 | } |
---|
20 | |
---|
21 | CBufferIn::CBufferIn(void) |
---|
22 | { |
---|
23 | own=false ; |
---|
24 | size_=0 ; |
---|
25 | } |
---|
26 | |
---|
27 | void CBufferIn::realloc(size_t size) |
---|
28 | { |
---|
29 | this->realloc(new char[size],size) ; |
---|
30 | own=true ; |
---|
31 | } |
---|
32 | |
---|
33 | void CBufferIn::realloc(void* buffer,size_t size) |
---|
34 | { |
---|
35 | if (own) delete [] begin ; |
---|
36 | begin=(char*)buffer ; |
---|
37 | size_=size ; |
---|
38 | current=begin ; |
---|
39 | end=begin+size_ ; |
---|
40 | count_=0 ; |
---|
41 | own=false ; |
---|
42 | } |
---|
43 | |
---|
44 | bool CBufferIn::advance(size_t n) { return advance<char>(n); } |
---|
45 | |
---|
46 | size_t CBufferIn::remain(void) |
---|
47 | { |
---|
48 | return size_-count_ ; |
---|
49 | } |
---|
50 | |
---|
51 | size_t CBufferIn::count(void) |
---|
52 | { |
---|
53 | return count_ ; |
---|
54 | } |
---|
55 | |
---|
56 | size_t CBufferIn::bufferSize(void) |
---|
57 | { |
---|
58 | return size_ ; |
---|
59 | } |
---|
60 | |
---|
61 | CBufferIn::~CBufferIn() |
---|
62 | { |
---|
63 | if (own) delete [] begin ; |
---|
64 | } |
---|
65 | |
---|
66 | void* CBufferIn::ptr(void) { return current; } |
---|
67 | |
---|
68 | } |
---|
69 | |
---|
70 | |
---|
71 | |
---|
Note: See
TracBrowser
for help on using the repository browser.