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_MEMORY_FSB_ASPECT_AD_DEALLOCATE_HPP
8 : #define VSET_VSET_MEMORY_FSB_ASPECT_AD_DEALLOCATE_HPP
9 :
10 : #include <vset/buffer/tags.hpp>
11 : #include <vset/memory/fsb/tags.hpp>
12 :
13 : namespace vset { namespace memory{ namespace fsb{
14 :
15 31 : struct ad_deallocate
16 : {
17 : template<typename T, typename Pointer>
18 10008 : void operator()(T& t, Pointer ptr, size_t num = 1) const
19 : {
20 : typedef ::vset::buffer::_data_ _buffer_data_;
21 : typedef ::vset::buffer::_data_type_ _buffer_data_type_;
22 :
23 : //typedef typename T::aspect::template advice_cast<_value_type_>::type value_type;
24 : typedef typename T::aspect::template advice_cast<_chain_type_>::type chain_type;
25 : typedef typename T::aspect::template advice_cast<_buffer_data_type_>::type data_type;
26 :
27 20016 : for (;num!=0; --num)
28 : {
29 10008 : data_type data = t.get_aspect().template get<_buffer_data_>()(t);
30 10008 : chain_type* chn = static_cast<chain_type*>( static_cast<void*>(data) );
31 10008 : chn->free( ptr.get_address() );
32 10008 : --ptr;
33 : }
34 :
35 10008 : }
36 : };
37 :
38 : }}}
39 :
40 : #endif
|