Last change
on this file since 1572 was
300,
checked in by ymipsl, 13 years ago
|
nouvelle version de developpement de xios
- nouvelle interface fortran
- recodage complet de la couche de communication
- et bien d'autres choses...
YM
|
-
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 | |
---|
5 | namespace xmlioserver |
---|
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.