LCOV - code coverage report
Current view: top level - vset/buffer - provider.hpp (source / functions) Hit Total Coverage
Test: v-set-coverage.info Lines: 12 14 85.7 %
Date: 2019-09-12 Functions: 15 19 78.9 %

          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_BUFFER_PROVIDER_HPP
       8             : #define VSET_BUFFER_PROVIDER_HPP
       9             : 
      10             : #include <vset/buffer/tags.hpp>
      11             : 
      12             : namespace vset { namespace buffer{
      13             : 
      14             : template<typename T>
      15             : class provider
      16             : {
      17             : public:
      18             :   typedef typename T::aspect::template advice_cast<_data_type_>::type data_type;
      19             :   typedef typename T::aspect::template advice_cast<_size_type_>::type size_type;
      20             : 
      21          24 :   explicit provider(T* target)
      22          24 :     : _target(target)
      23             :   {
      24          24 :   }
      25             : 
      26           0 :   size_type size() const
      27             :   {
      28           0 :     return _target->get_aspect().template get<_size_>()(*_target);
      29             :   }
      30             : 
      31             :   size_type capacity() const
      32             :   {
      33             :     return _target->get_aspect().template get<_capacity_>()(*_target);
      34             :   }
      35             : 
      36             :   data_type data()
      37             :   {
      38             :     return _target->get_aspect().template get<_data_>()(*_target);
      39             :   }
      40             : 
      41             :   const data_type data() const
      42             :   {
      43             :     return _target->get_aspect().template get<_data_>()(*_target);
      44             :   }
      45             : 
      46           4 :   void clear()
      47             :   {
      48           4 :     _target->get_aspect().template get<_clear_>()(*_target);
      49           4 :   }
      50             :   
      51             :   void resize(size_type s)
      52             :   {
      53             :     _target->get_aspect().template get<_resize_>()(*_target, s);
      54             :   }
      55             : 
      56           1 :   void truncate(size_type s)
      57             :   {
      58           1 :     _target->get_aspect().template get<_truncate_>()(*_target, s);
      59           1 :   }
      60             : 
      61           2 :   void reserve( size_type s)
      62             :   {
      63           2 :     _target->get_aspect().template get<_reserve_>()(*_target, s);
      64           2 :   }
      65             : 
      66             : protected:
      67             :   
      68             :   T* _target;
      69             : };
      70             : 
      71             : }}
      72             : 
      73             : #endif

Generated by: LCOV version 1.10