LCOV - code coverage report
Current view: top level - vset/vtree - strategy.hpp (source / functions) Hit Total Coverage
Test: v-set-coverage.info Lines: 3 3 100.0 %
Date: 2019-09-12 Functions: 8 8 100.0 %

          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_VTREE_STRATEGY_HPP
       8             : #define VSET_VTREE_STRATEGY_HPP
       9             : 
      10             : #include <vset/vtree/aspect/aspect_tree.hpp>
      11             : #include <vset/vtree/aspect/aspect_memory.hpp>
      12             : #include <vset/vtree/aspect/aspect_basic.hpp>
      13             : #include <vset/vtree/aspect/ad_restore.hpp>
      14             : #include <vset/memory/strategy.hpp>
      15             : #include <vset/sorted_array.hpp>
      16             : #include <fas/mp.hpp>
      17             : 
      18             : namespace vset{ namespace vtree{
      19             : 
      20             : template<typename Class>
      21           5 : struct creator // TODO: base type_advice и анологично для провайдера
      22             : {
      23             :   template<typename>
      24             :   struct apply
      25             :   {
      26             :     typedef Class type;
      27             :   };
      28             : 
      29             :   template<typename T>
      30           5 :   Class operator()(T& ) const
      31             :   {
      32           5 :     return Class();
      33             :   }
      34             : };
      35             :   
      36             : namespace strategy
      37             : {
      38             : 
      39             : template<typename V, typename Compare = std::less<V>, size_t N = 1024, typename OffsetAspect = ::vset::memory::fsb::aspect_offset >
      40             : struct vtree_fsb_mmap: fas::merge_aspect<
      41             :   aspect_tree<V, Compare>,
      42             :   aspect_memory< 
      43             :     sorted_array< V, N, Compare >,  
      44             :     ::fas::lambda< memory::strategy::fsb_mmap<fas::_1, OffsetAspect > >::template  apply
      45             :   >,
      46             :   fas::advice< _restore_, ad_restore >,
      47             :   fas::group< buffer::persistent::_after_open_, _restore_ >,
      48             :   aspect_basic
      49             : >::type {};
      50             : 
      51             : template<typename V, typename Compare = std::less<V>, size_t N = 1024, typename OffsetAspect = ::vset::memory::fsb::aspect_offset >
      52             : struct vtree_fsb_filesync: fas::merge_aspect<
      53             :   aspect_tree<V, Compare>,
      54             :   aspect_memory< 
      55             :     sorted_array< V, N, Compare >, 
      56             :     fas::lambda< memory::strategy::fsb_filesync<fas::_1, OffsetAspect > >::template apply
      57             :   >,
      58             :   fas::advice< _restore_, ad_restore >,
      59             :   fas::group< buffer::persistent::_after_open_, _restore_ >,
      60             :   aspect_basic
      61             : >::type {};
      62             : 
      63             : 
      64             : template<typename V, typename Compare = std::less<V>, size_t N = 1024, typename OffsetAspect = ::vset::memory::fsb::aspect_offset >
      65             : struct vtree_fsb_inmem: fas::merge_aspect<
      66             :   aspect_tree<V, Compare>,
      67             :   aspect_memory< 
      68             :     sorted_array< V, N, Compare >, 
      69             :     fas::lambda< memory::strategy::fsb_inmem<fas::_1, OffsetAspect > >::template apply
      70             :   >,
      71             :   aspect_basic
      72             : >::type {};
      73             : 
      74             : 
      75             : template<typename V, typename Compare = std::less<V>, size_t N = 1024 >
      76             : struct vtree_std_alloc: fas::merge_aspect<
      77             :   aspect_tree<V, Compare>,
      78             :   fas::type<_array_type_, sorted_array< V, N, Compare > >,
      79             :   fas::advice<_allocator_, creator< std::allocator< sorted_array< V, N, Compare > > > >,
      80             :   fas::value< _size_, size_t>,
      81             :   aspect_basic
      82             : >::type {};
      83             : 
      84             : }
      85             : 
      86             : }}
      87             : 
      88             : #endif

Generated by: LCOV version 1.10