Last change
on this file since 2524 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.2 KB
|
Line | |
---|
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 | |
---|
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::bufferSize(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.