OnnxRuntime
Ort::Base< T > Struct Template Reference

Used internally by the C++ API. C++ wrapper types inherit from this. More...

#include <onnxruntime_cxx_api.h>

Public Types

using contained_type = T
 

Public Member Functions

 Base ()=default
 
 Base (T *p)
 
 ~Base ()
 
 operator T* ()
 
 operator const T * () const
 
T * release ()
 Releases ownership of the contained pointer. More...
 

Protected Member Functions

 Base (const Base &)=delete
 
Baseoperator= (const Base &)=delete
 
 Base (Base &&v) noexcept
 
void operator= (Base &&v) noexcept
 

Protected Attributes

T * p_ {}
 

Friends

template<typename >
struct Unowned
 

Detailed Description

template<typename T>
struct Ort::Base< T >

Used internally by the C++ API. C++ wrapper types inherit from this.

This is a zero cost abstraction to wrap the C API objects and delete them on destruction. There is a secondary class 'Unowned<T>' that is used to prevent deletion on destruction (Used for return types that are not owned by the caller)

Member Typedef Documentation

◆ contained_type

template<typename T >
using Ort::Base< T >::contained_type = T

Constructor & Destructor Documentation

◆ Base() [1/4]

template<typename T >
Ort::Base< T >::Base ( )
default

◆ Base() [2/4]

template<typename T >
Ort::Base< T >::Base ( T *  p)
inline

◆ ~Base()

template<typename T >
Ort::Base< T >::~Base ( )
inline

◆ Base() [3/4]

template<typename T >
Ort::Base< T >::Base ( const Base< T > &  )
protecteddelete

◆ Base() [4/4]

template<typename T >
Ort::Base< T >::Base ( Base< T > &&  v)
inlineprotectednoexcept

Member Function Documentation

◆ operator const T *()

template<typename T >
Ort::Base< T >::operator const T * ( ) const
inline

◆ operator T*()

template<typename T >
Ort::Base< T >::operator T* ( )
inline

◆ operator=() [1/2]

template<typename T >
void Ort::Base< T >::operator= ( Base< T > &&  v)
inlineprotectednoexcept

◆ operator=() [2/2]

template<typename T >
Base & Ort::Base< T >::operator= ( const Base< T > &  )
protecteddelete

◆ release()

template<typename T >
T * Ort::Base< T >::release ( )
inline

Releases ownership of the contained pointer.

Friends And Related Function Documentation

◆ Unowned

template<typename T >
template<typename >
friend struct Unowned
friend

Member Data Documentation

◆ p_

template<typename T >
T* Ort::Base< T >::p_ {}
protected