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

          Line data    Source code
       1             : //
       2             : // Author: Vladimir Migashko <migashko@gmail.com>, (C) 2013
       3             : //
       4             : // Copyright: See COPYING file that comes with this distribution
       5             : //
       6             : 
       7             : #ifndef VSET_VSET_MEMORY_FSB_ASPECT_AD_CAPACITY_HPP
       8             : #define VSET_VSET_MEMORY_FSB_ASPECT_AD_CAPACITY_HPP
       9             : 
      10             : #include <vset/buffer/tags.hpp>
      11             : #include <vset/memory/fsb/tags.hpp>
      12             : 
      13             : #include <fas/typemanip/type2type.hpp>
      14             : 
      15             : namespace vset { namespace memory{ namespace fsb{
      16             : 
      17          31 : struct ad_capacity
      18             : {
      19             :   template<typename T>
      20           3 :   size_t operator()(T& t ) const
      21             :   {
      22             :     typedef ::vset::buffer::_size_      _buffer_size_;
      23             : 
      24           3 :     if ( t.get_aspect().template get< _buffer_size_ >()(t) == 0 )
      25             :     {
      26           0 :       return 0;
      27             :     }
      28             : 
      29             :     typedef ::vset::buffer::_data_      _buffer_data_;
      30             :     typedef ::vset::buffer::_const_data_type_ _buffer_data_type_;
      31             :     
      32             :     typedef typename T::aspect::template advice_cast<_buffer_data_type_>::type data_type;
      33             : 
      34           3 :     data_type data = t.get_aspect().template get<_buffer_data_>()(t);
      35             : 
      36             :     typedef typename T::aspect::template advice_cast<_chain_type_>::type chain_type;
      37           3 :     const chain_type* chn = reinterpret_cast<const chain_type*>(data);
      38             :     
      39           3 :     return chn->capacity();
      40             :   }
      41             : };
      42             : 
      43             : }}}
      44             : 
      45             : #endif

Generated by: LCOV version 1.10