LCOV - code coverage report
Current view: top level - fas/aop/private - aspect_hierarchy.hpp (source / functions) Hit Total Coverage
Test: faslib-coverage.info Lines: 7 7 100.0 %
Date: 2019-12-03 13:22:31 Functions: 117 118 99.2 %

          Line data    Source code
       1             : //
       2             : // Author: Vladimir Migashko <migashko@gmail.com>, (C) 2011, 2012
       3             : //
       4             : // Copyright: See COPYING file that comes with this distribution
       5             : //
       6             : 
       7             : #ifndef FAS_AOP_ASPECT_HIERARCHY_HPP
       8             : #define FAS_AOP_ASPECT_HIERARCHY_HPP
       9             : 
      10             : #include <fas/aop/private/find_advice.hpp>
      11             : #include <fas/aop/private/group_object.hpp>
      12             : #include <fas/aop/private/reverse_group_object.hpp>
      13             : 
      14             : #include <fas/aop/detail/aspect_helper.hpp>
      15             : #include <fas/aop/detail/select_group.hpp>
      16             : #include <fas/aop/detail/has_advice.hpp>
      17             : 
      18             : #include <fas/hierarchy/scatter_hierarchy.hpp>
      19             : #include <fas/hierarchy/field.hpp>
      20             : 
      21             : #include <fas/type_list/reverse.hpp>
      22             : 
      23             : namespace fas{
      24             : 
      25             : template<typename A>
      26          39 : class aspect_hierarchy
      27             :   : public scatter_hierarchy< typename detail::aspect_helper<A>::hierarchy_list >
      28             : {
      29             :   typedef aspect_hierarchy<A> self;
      30             :   typedef detail::aspect_helper<A> helper;
      31             : public:
      32             :   typedef typename helper::hierarchy_list hierarchy_list;
      33             :   typedef typename helper::common_list common_list;
      34             :   typedef typename helper::group_list group_list;
      35             : 
      36             :   typedef scatter_hierarchy< hierarchy_list > super;
      37             : 
      38             :   template<typename Tg>
      39             :   typename find_advice< Tg, common_list>::type::advice_class&
      40         129 :   get()
      41             :   {
      42             :     typedef typename find_advice< Tg, common_list>::type advice_type;
      43         129 :     return field<advice_type>::get( static_cast<super&>(*this) ).get_advice();
      44             :   }
      45             : 
      46             :   template<typename Tg>
      47             :   const typename find_advice< Tg, common_list>::type::advice_class&
      48           2 :   get() const
      49             :   {
      50             :     typedef typename find_advice< Tg, common_list>::type advice_type;
      51           2 :     return field<advice_type>::get_const( static_cast<const super&>(*this) ).get_advice();
      52             :   }
      53             : 
      54             :   template<typename Tg>
      55             :   struct advice_cast
      56             :   {
      57             :     typedef typename find_advice< Tg, common_list>::type::advice_class type;
      58             :   };
      59             : 
      60             :   template<typename Tg>
      61             :   struct has_advice
      62             :   {
      63             :     typedef detail::has_advice_impl<Tg, self > has_helper;
      64             :     typedef typename has_helper::type type;
      65             :     enum { value = has_helper::value};
      66             :   };
      67             : 
      68             :   template<typename Tg>
      69          27 :   group_object<Tg> getg() const
      70             :   {
      71          27 :     return group_object<Tg>();
      72             :   }
      73             : 
      74             :   template<typename Tg>
      75             :   reverse_group_object<Tg> gete() const
      76             :   {
      77             :     return reverse_group_object<Tg>();
      78             :   }
      79             : 
      80             :   template<typename Tg>
      81             :   struct select_group
      82             :   {
      83             :     typedef typename detail::select_group_impl< Tg, self >::type type;
      84             :   };
      85             : 
      86             :   template<typename Tg>
      87             :   struct select_group_reverse
      88             :   {
      89             :     typedef typename reverse<
      90             :       typename detail::select_group_impl< Tg, self >::type
      91             :     >::type type;
      92             :   };
      93             : 
      94             : };
      95             : 
      96             : }
      97             : 
      98             : #endif

Generated by: LCOV version 1.13