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_FILESYNC_AD_RESERVE_HPP
8 : #define VSET_VSET_BUFFER_PERSISTENT_FILESYNC_AD_RESERVE_HPP
9 :
10 : #include <vset/buffer/tags.hpp>
11 : #include <vset/buffer/persistent/tags.hpp>
12 :
13 :
14 : namespace vset { namespace buffer { namespace persistent{ namespace filesync{
15 :
16 3 : struct ad_reserve
17 : {
18 : template<typename T>
19 2 : void operator()( T& t, size_t size)
20 : {
21 2 : size_t capacity = t.get_aspect().template get<_capacity_>()(t);
22 2 : if ( size <= capacity )
23 2 : return;
24 :
25 2 : t.get_aspect().template get<_head_>()(t)->set_capacity(size);
26 2 : t.get_aspect().template get<_sync_>()(t);
27 2 : t.get_aspect().template get<_open_>()(t);
28 : }
29 : };
30 :
31 : }}}}
32 :
33 : #endif
|