MLIR  14.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 >:
Inheritance graph
[legend]
Collaboration diagram for mlir::detail::Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait >:
Collaboration graph
[legend]

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 >
 

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 , typename 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...
 

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();
}
};
};

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 80 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 76 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 74 of file InterfaceSupport.h.

Constructor & Destructor Documentation

◆ Interface() [1/3]

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())
inline

Construct an interface from an instance of the value type.

Definition at line 92 of file InterfaceSupport.h.

◆ Interface() [2/3]

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 96 of file InterfaceSupport.h.

◆ Interface() [3/3]

template<typename ConcreteType, typename ValueT, typename Traits, typename BaseType, template< typename, template< typename > class > class BaseTrait>
template<typename T , typename 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 102 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 109 of file InterfaceSupport.h.

◆ getImpl() [1/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 116 of file InterfaceSupport.h.

◆ getImpl() [2/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 117 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 112 of file InterfaceSupport.h.


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