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_MMAP_AD_RESERVE_HPP
8 : #define VSET_VSET_BUFFER_PERSISTENT_MMAP_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 mmap{
15 :
16 9 : struct ad_reserve
17 : {
18 : template<typename T>
19 21 : void operator()( T& t, size_t size)
20 : {
21 21 : size_t capacity = t.get_aspect().template get<_capacity_>()(t);
22 21 : if ( size <= capacity )
23 21 : return;
24 :
25 21 : t.get_aspect().template get<_truncate_>()(t, size);
26 : }
27 : };
28 :
29 : }}}}
30 :
31 : #endif
|