LCOV - code coverage report
Current view: top level - vset/memory/fsb/aspect - ad_next_offset.hpp (source / functions) Hit Total Coverage
Test: v-set-coverage.info Lines: 9 9 100.0 %
Date: 2019-09-12 Functions: 4 7 57.1 %

          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_NEXT_OFFSET_HPP
       8             : #define VSET_VSET_MEMORY_FSB_ASPECT_AD_NEXT_OFFSET_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_next_offset
      16             : {
      17             :   template<typename T>
      18      114060 :   size_t operator()(T& t, size_t offset, size_t count) 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<_chain_type_>::type chain_type;
      24             :     typedef typename T::aspect::template advice_cast<_value_type_>::type value_type;
      25             :     typedef typename T::aspect::template advice_cast<_buffer_data_type_>::type data_type;
      26             : 
      27      114060 :     data_type data = t.get_aspect().template get<_buffer_data_>()(t);
      28      114060 :     chain_type* chn = reinterpret_cast<chain_type*>(data);
      29             : 
      30      218070 :     for (size_t i = 0 ; i < count ; ++i)
      31             :     {
      32      124227 :       if ( value_type* current = chn->next_value( t.get_aspect().template get<_ptr_by_offset_>()(t, offset) ) )
      33             :       {
      34      104010 :         offset = t.get_aspect().template get<_offset_by_ptr_>()(t, current);
      35             :       }
      36             :       else
      37             :       {
      38       20217 :         return static_cast<size_t>(-1);
      39             :       }
      40             :     }
      41       93843 :     return offset;
      42             :   }
      43             : };
      44             : 
      45             : }}}
      46             : 
      47             : #endif

Generated by: LCOV version 1.10