Line data Source code
1 : //
2 : // Author: Vladimir Migashko <migashko@gmail.com>, (C) 2012
3 : //
4 : // Copyright: See COPYING file that comes with this distribution
5 : //
6 :
7 : #ifndef VSET_VSET_BUFFER_PERSISTENT_BUFFER_HPP
8 : #define VSET_VSET_BUFFER_PERSISTENT_BUFFER_HPP
9 :
10 : #include <vset/buffer/persistent/filesync/aspect.hpp>
11 : #include <vset/buffer/persistent_buffer_base.hpp>
12 : #include <fas/aop.hpp>
13 :
14 : namespace vset { namespace buffer{
15 :
16 : template< typename A >
17 8 : class persistent_buffer
18 : : public persistent_buffer_base<A>
19 : {
20 : typedef persistent_buffer_base<A> super;
21 : public:
22 :
23 : typedef typename super::data_type data_type;
24 : typedef typename super::size_type size_type;
25 :
26 18 : size_type size() const
27 : {
28 18 : return super::_size(*this);
29 : }
30 :
31 20 : size_type capacity() const
32 : {
33 20 : return super::_capacity(*this);
34 : }
35 :
36 134 : data_type data()
37 : {
38 134 : return super::_data(*this);
39 : }
40 :
41 : const data_type data() const
42 : {
43 : return super::_data(*this);
44 : }
45 :
46 2 : void clear()
47 : {
48 2 : super::_clear(*this);
49 2 : }
50 :
51 4 : void resize(size_type s)
52 : {
53 4 : super::_resize(*this, s);
54 4 : }
55 :
56 4 : void truncate(size_type s)
57 : {
58 4 : super::_truncate(*this, s);
59 4 : }
60 :
61 4 : void reserve( size_type s)
62 : {
63 4 : super::_reserve(*this, s);
64 4 : }
65 :
66 6 : void close()
67 : {
68 6 : super::_close(*this);
69 6 : }
70 :
71 8 : void open(const char* path)
72 : {
73 8 : super::_open(*this, path);
74 8 : }
75 :
76 2 : size_type sync()
77 : {
78 2 : return super::_sync(*this);
79 : }
80 :
81 : size_type sync(size_type offset, size_type s )
82 : {
83 : return super::_sync(*this, offset, s);
84 : }
85 :
86 : size_type sync(bool syn)
87 : {
88 : return super::_sync(*this, syn);
89 : }
90 :
91 : size_type sync(size_type offset, size_type s, bool syn )
92 : {
93 : return super::_sync(*this, offset, s, syn);
94 : }
95 : };
96 :
97 : }}
98 :
99 : #endif
|