tvm
Public Member Functions | List of all members
tvm::With< ContextType > Class Template Reference

RAII wrapper function to enter and exit a context object similar to python's with syntax. More...

#include <with.h>

Collaboration diagram for tvm::With< ContextType >:

Public Member Functions

template<typename... Args>
 With (Args &&... args)
 constructor. Enter the scope of the context. More...
 
 ~With () DMLC_THROW_EXCEPTION
 destructor, leaves the scope of the context. More...
 
 With (const With &other)=delete
 
Withoperator= (const With &other)=delete
 
 With (With &&other)=delete
 
Withoperator= (With &&other)=delete
 
ContextType * get ()
 
const ContextType * get () const
 
ContextType * operator-> ()
 
const ContextType * operator-> () const
 
ContextType & operator* ()
 
const ContextType * operator* () const
 
ContextType operator() ()
 

Detailed Description

template<typename ContextType>
class tvm::With< ContextType >

RAII wrapper function to enter and exit a context object similar to python's with syntax.

// context class
class MyContext {
private:
friend class With<MyContext>;
MyContext(arguments);
void EnterWithScope();
void ExitWithScope();
};
{
With<MyContext> scope(arguments);
// effect take place.
}
With(Args &&... args)
constructor. Enter the scope of the context.
Definition: with.h:65
Template Parameters
ContextTypeType of the context object.

Constructor & Destructor Documentation

◆ With() [1/3]

template<typename ContextType >
template<typename... Args>
tvm::With< ContextType >::With ( Args &&...  args)
inlineexplicit

constructor. Enter the scope of the context.

◆ ~With()

template<typename ContextType >
tvm::With< ContextType >::~With ( )
inline

destructor, leaves the scope of the context.

◆ With() [2/3]

template<typename ContextType >
tvm::With< ContextType >::With ( const With< ContextType > &  other)
delete

◆ With() [3/3]

template<typename ContextType >
tvm::With< ContextType >::With ( With< ContextType > &&  other)
delete

Member Function Documentation

◆ get() [1/2]

template<typename ContextType >
ContextType* tvm::With< ContextType >::get ( )
inline

◆ get() [2/2]

template<typename ContextType >
const ContextType* tvm::With< ContextType >::get ( ) const
inline

◆ operator()()

template<typename ContextType >
ContextType tvm::With< ContextType >::operator() ( )
inline

◆ operator*() [1/2]

template<typename ContextType >
ContextType& tvm::With< ContextType >::operator* ( )
inline

◆ operator*() [2/2]

template<typename ContextType >
const ContextType* tvm::With< ContextType >::operator* ( ) const
inline

◆ operator->() [1/2]

template<typename ContextType >
ContextType* tvm::With< ContextType >::operator-> ( )
inline

◆ operator->() [2/2]

template<typename ContextType >
const ContextType* tvm::With< ContextType >::operator-> ( ) const
inline

◆ operator=() [1/2]

template<typename ContextType >
With& tvm::With< ContextType >::operator= ( const With< ContextType > &  other)
delete

◆ operator=() [2/2]

template<typename ContextType >
With& tvm::With< ContextType >::operator= ( With< ContextType > &&  other)
delete

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