ONNX Runtime
Loading...
Searching...
No Matches
Ort::detail::Base< T > Struct Template Reference

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. More...

#include <onnxruntime_cxx_api.h>

Inheritance diagram for Ort::detail::Base< T >:
Ort::detail::ConstIoBindingImpl< OrtIoBinding > Ort::detail::ConstSessionImpl< OrtSession > Ort::detail::ConstValueImpl< OrtValue > Ort::detail::MapTypeInfoImpl< OrtMapTypeInfo > Ort::detail::MemoryInfoImpl< OrtMemoryInfo > Ort::detail::SequenceTypeInfoImpl< OrtSequenceTypeInfo > Ort::detail::TensorTypeAndShapeInfoImpl< OrtTensorTypeAndShapeInfo > Ort::detail::TypeInfoImpl< OrtTypeInfo > Ort::detail::ConstIoBindingImpl< T > Ort::detail::ConstSessionImpl< T > Ort::detail::ConstValueImpl< T > Ort::detail::MapTypeInfoImpl< T > Ort::detail::MemoryInfoImpl< T > Ort::detail::OptionalTypeInfoImpl< T > Ort::detail::SequenceTypeInfoImpl< T > Ort::detail::TensorTypeAndShapeInfoImpl< T > Ort::detail::TypeInfoImpl< T >

Public Types

using contained_type = T
 

Public Member Functions

constexpr Base ()=default
 
constexpr Base (contained_type *p) noexcept
 
 ~Base ()
 
 Base (const Base &)=delete
 
Baseoperator= (const Base &)=delete
 
 Base (Base &&v) noexcept
 
Baseoperator= (Base &&v) noexcept
 
constexpr operator contained_type * () const noexcept
 
contained_typerelease ()
 Relinquishes ownership of the contained C object pointer The underlying object is not destroyed.
 

Protected Attributes

contained_typep_ {}
 

Detailed Description

template<typename T>
struct Ort::detail::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.

All of the C++ classes a) serve as containers for pointers to objects that are created by the underlying C API. Their size is just a pointer size, no need to dynamically allocate them. Use them by value. b) Each of struct XXXX, XXX instances function as smart pointers to the underlying C API objects. they would release objects owned automatically when going out of scope, they are move-only. c) ConstXXXX and UnownedXXX structs function as non-owning, copyable containers for the above pointers. ConstXXXX allow calling const interfaces only. They give access to objects that are owned by somebody else such as Onnxruntime or instances of XXXX classes. d) serve convenient interfaces that return C++ objects and further enhance exception and type safety so they can be used in C++ code.

This is a non-const pointer holder that is move-only. Disposes of the pointer on destruction.

Member Typedef Documentation

◆ contained_type

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

Constructor & Destructor Documentation

◆ Base() [1/4]

template<typename T >
constexpr Ort::detail::Base< T >::Base ( )
constexprdefault

◆ Base() [2/4]

template<typename T >
constexpr Ort::detail::Base< T >::Base ( contained_type p)
inlineexplicitconstexprnoexcept

◆ ~Base()

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

◆ Base() [3/4]

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

◆ Base() [4/4]

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

Member Function Documentation

◆ operator contained_type *()

template<typename T >
constexpr Ort::detail::Base< T >::operator contained_type * ( ) const
inlineconstexprnoexcept

◆ operator=() [1/2]

template<typename T >
Base & Ort::detail::Base< T >::operator= ( Base< T > &&  v)
inlinenoexcept

◆ operator=() [2/2]

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

◆ release()

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

Relinquishes ownership of the contained C object pointer The underlying object is not destroyed.

Member Data Documentation

◆ p_

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