dune-fem  2.4.1-rc
bartonnackmaninterface.hh
Go to the documentation of this file.
1 #include <dune/common/bartonnackmanifcheck.hh>
2 
3 #ifndef DUNE_FEM_BARTONNACKMANINTERFACE_HH
4 #define DUNE_FEM_BARTONNACKMANINTERFACE_HH
5 
6 #include <dune/common/typetraits.hh>
7 
8 namespace Dune
9 {
10 
11  namespace Fem
12  {
13 
14  template< class Interface, class Implementation >
16  {
18 
19  public:
21  {
22  static_assert( (Conversion< Interface, ThisType >::exists), "Interface must be derived from BartonNackmanInterface." );
23  //static_assert( (Conversion< Implementation, Interface >::exists), "Implementation must be derived from its interface." );
24  }
25 
26  protected:
27  static const Implementation &asImp ( const ThisType &other )
28  {
29  return static_cast< const Implementation & >( other );
30  }
31 
32  static Implementation &asImp ( ThisType &other )
33  {
34  return static_cast< Implementation & >( other );
35  }
36 
37  const Implementation &asImp () const
38  {
39  return asImp( *this );
40  }
41 
42  Implementation &asImp ()
43  {
44  return asImp( *this );
45  }
46  };
47 
48  } // namespace Fem
49 
50 } // namespace Dune
51 
52 #endif // #ifndef DUNE_FEM_BARTONNACKMANINTERFACE_HH
const Implementation & asImp() const
Definition: bartonnackmaninterface.hh:37
BartonNackmanInterface()
Definition: bartonnackmaninterface.hh:20
static Implementation & asImp(ThisType &other)
Definition: bartonnackmaninterface.hh:32
Definition: coordinate.hh:4
static const Implementation & asImp(const ThisType &other)
Definition: bartonnackmaninterface.hh:27
Implementation & asImp()
Definition: bartonnackmaninterface.hh:42
Definition: bartonnackmaninterface.hh:15