MLIR  20.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
mlir::detail::Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait > Class Template Reference

This class represents an abstract interface. More...

#include "mlir/Support/InterfaceSupport.h"

+ Inheritance diagram for mlir::detail::Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait >:

Classes

struct  Trait
 This is a special trait that registers a given interface with an object. More...
 

Public Types

using Concept = typename Traits::Concept
 
template<typename T >
using Model = typename Traits::template Model< T >
 
template<typename T >
using FallbackModel = typename Traits::template FallbackModel< T >
 
using InterfaceBase = Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait >
 
template<typename T , typename U >
using ExternalModel = typename Traits::template ExternalModel< T, U >
 
using ValueType = ValueT
 

Public Member Functions

 Interface (ValueT t=ValueT())
 Construct an interface from an instance of the value type. More...
 
 Interface (std::nullptr_t)
 
template<typename T , std::enable_if_t< std::is_base_of< Trait< T >, T >::value > * = nullptr>
 Interface (T t)
 Construct an interface instance from a type that implements this interface's trait. More...
 
 Interface (ValueT t, const Concept *conceptImpl)
 Constructor for a known concept. More...
 
 Interface (ValueT t, std::nullptr_t)
 Constructor for DenseMapInfo's empty key and tombstone key. More...
 

Static Public Member Functions

static bool classof (ValueT t)
 Support 'classof' by checking if the given object defines the concrete interface. More...
 
static TypeID getInterfaceID ()
 Define an accessor for the ID of this interface. More...
 

Protected Member Functions

const ConceptgetImpl () const
 Get the raw concept in the correct derived concept type. More...
 
ConceptgetImpl ()
 

Detailed Description

template<typename ConcreteType, typename ValueT, typename Traits, typename BaseType, template< typename, template< typename > class > class BaseTrait>
class mlir::detail::Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait >

This class represents an abstract interface.

An interface is a simplified mechanism for attaching concept based polymorphism to a class hierarchy. An interface is comprised of two components:

Derived interfaces types must provide the following template types:

{c++}
struct ExampleInterfaceTraits {
struct Concept {
virtual unsigned getNumInputs(T t) const = 0;
};
template <typename DerivedT> class Model {
unsigned getNumInputs(T t) const final {
return cast<DerivedT>(t).getNumInputs();
}
};
};
typename Traits::template Model< T > Model
typename Traits::Concept Concept

Definition at line 71 of file InterfaceSupport.h.

Member Typedef Documentation

◆ Concept

template<typename ConcreteType , typename ValueT , typename Traits , typename BaseType , template< typename, template< typename > class > class BaseTrait>
using mlir::detail::Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait >::Concept = typename Traits::Concept

Definition at line 73 of file InterfaceSupport.h.

◆ ExternalModel

template<typename ConcreteType , typename ValueT , typename Traits , typename BaseType , template< typename, template< typename > class > class BaseTrait>
template<typename T , typename U >
using mlir::detail::Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait >::ExternalModel = typename Traits::template ExternalModel<T, U>

Definition at line 81 of file InterfaceSupport.h.

◆ FallbackModel

template<typename ConcreteType , typename ValueT , typename Traits , typename BaseType , template< typename, template< typename > class > class BaseTrait>
template<typename T >
using mlir::detail::Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait >::FallbackModel = typename Traits::template FallbackModel<T>

Definition at line 77 of file InterfaceSupport.h.

◆ InterfaceBase

template<typename ConcreteType , typename ValueT , typename Traits , typename BaseType , template< typename, template< typename > class > class BaseTrait>
using mlir::detail::Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait >::InterfaceBase = Interface<ConcreteType, ValueT, Traits, BaseType, BaseTrait>

Definition at line 78 of file InterfaceSupport.h.

◆ Model

template<typename ConcreteType , typename ValueT , typename Traits , typename BaseType , template< typename, template< typename > class > class BaseTrait>
template<typename T >
using mlir::detail::Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait >::Model = typename Traits::template Model<T>

Definition at line 75 of file InterfaceSupport.h.

◆ ValueType

template<typename ConcreteType , typename ValueT , typename Traits , typename BaseType , template< typename, template< typename > class > class BaseTrait>
using mlir::detail::Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait >::ValueType = ValueT

Definition at line 82 of file InterfaceSupport.h.

Constructor & Destructor Documentation

◆ Interface() [1/5]

template<typename ConcreteType , typename ValueT , typename Traits , typename BaseType , template< typename, template< typename > class > class BaseTrait>
mlir::detail::Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait >::Interface ( ValueT  t = ValueT())
inlineexplicit

Construct an interface from an instance of the value type.

Definition at line 94 of file InterfaceSupport.h.

◆ Interface() [2/5]

template<typename ConcreteType , typename ValueT , typename Traits , typename BaseType , template< typename, template< typename > class > class BaseTrait>
mlir::detail::Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait >::Interface ( std::nullptr_t  )
inline

Definition at line 100 of file InterfaceSupport.h.

◆ Interface() [3/5]

template<typename ConcreteType , typename ValueT , typename Traits , typename BaseType , template< typename, template< typename > class > class BaseTrait>
template<typename T , std::enable_if_t< std::is_base_of< Trait< T >, T >::value > * = nullptr>
mlir::detail::Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait >::Interface ( t)
inline

Construct an interface instance from a type that implements this interface's trait.

Definition at line 106 of file InterfaceSupport.h.

◆ Interface() [4/5]

template<typename ConcreteType , typename ValueT , typename Traits , typename BaseType , template< typename, template< typename > class > class BaseTrait>
mlir::detail::Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait >::Interface ( ValueT  t,
const Concept conceptImpl 
)
inline

Constructor for a known concept.

Definition at line 114 of file InterfaceSupport.h.

◆ Interface() [5/5]

template<typename ConcreteType , typename ValueT , typename Traits , typename BaseType , template< typename, template< typename > class > class BaseTrait>
mlir::detail::Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait >::Interface ( ValueT  t,
std::nullptr_t   
)
inline

Constructor for DenseMapInfo's empty key and tombstone key.

Definition at line 120 of file InterfaceSupport.h.

Member Function Documentation

◆ classof()

template<typename ConcreteType , typename ValueT , typename Traits , typename BaseType , template< typename, template< typename > class > class BaseTrait>
static bool mlir::detail::Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait >::classof ( ValueT  t)
inlinestatic

Support 'classof' by checking if the given object defines the concrete interface.

Definition at line 124 of file InterfaceSupport.h.

◆ getImpl() [1/2]

template<typename ConcreteType , typename ValueT , typename Traits , typename BaseType , template< typename, template< typename > class > class BaseTrait>
Concept* mlir::detail::Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait >::getImpl ( )
inlineprotected

Definition at line 132 of file InterfaceSupport.h.

◆ getImpl() [2/2]

template<typename ConcreteType , typename ValueT , typename Traits , typename BaseType , template< typename, template< typename > class > class BaseTrait>
const Concept* mlir::detail::Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait >::getImpl ( ) const
inlineprotected

Get the raw concept in the correct derived concept type.

Definition at line 131 of file InterfaceSupport.h.

◆ getInterfaceID()

template<typename ConcreteType , typename ValueT , typename Traits , typename BaseType , template< typename, template< typename > class > class BaseTrait>
static TypeID mlir::detail::Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait >::getInterfaceID ( )
inlinestatic

Define an accessor for the ID of this interface.

Definition at line 127 of file InterfaceSupport.h.


The documentation for this class was generated from the following file: