open62541pp 0.17.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
opcua::TypeWrapper< T, Index > Class Template Reference

#include <typewrapper.hpp>

Inheritance diagram for opcua::TypeWrapper< T, Index >:
[legend]

Detailed Description

template<typename T, TypeIndex Index>
class opcua::TypeWrapper< T, Index >

Template base class to wrap UA_* type objects that require manual memory management.

Provides a zero-cost abstraction to wrap C API objects and automatically delete them upon destruction.

Warning
No virtual constructor is defined; do not implement a destructor in derived classes.

Definition at line 24 of file typewrapper.hpp.

Public Member Functions

constexpr TypeWrapper () noexcept=default
 
constexpr TypeWrapper (const T &native)
 
constexpr TypeWrapper (T &&native) noexcept
 
 ~TypeWrapper ()
 
constexpr TypeWrapper (const TypeWrapper &other)
 
constexpr TypeWrapper (TypeWrapper &&other) noexcept
 
constexpr TypeWrapperoperator= (const TypeWrapper &other)
 
constexpr TypeWrapperoperator= (const T &native)
 
constexpr TypeWrapperoperator= (TypeWrapper &&other) noexcept
 
constexpr TypeWrapperoperator= (T &&native) noexcept
 
- Public Member Functions inherited from opcua::Wrapper< T >
constexpr Wrapper () noexcept=default
 
constexpr Wrapper (const T &native) noexcept
 
constexpr Wrapper (T &&native) noexcept
 
constexpr Wrapperoperator= (const T &native) noexcept
 
constexpr Wrapperoperator= (T &&native) noexcept
 
constexpr operator T& () noexcept
 
constexpr operator const T & () const noexcept
 
constexpr T * operator-> () noexcept
 
constexpr const T * operator-> () const noexcept
 
constexpr T * handle () noexcept
 
constexpr const T * handle () const noexcept
 
constexpr void swap (Wrapper &other) noexcept
 
constexpr void swap (T &native) noexcept
 

Static Public Member Functions

static constexpr TypeIndex typeIndex ()
 

Protected Member Functions

constexpr void clear () noexcept
 
- Protected Member Functions inherited from opcua::Wrapper< T >
constexpr const T & native () const noexcept
 
constexpr T & native () noexcept
 

Additional Inherited Members

- Public Types inherited from opcua::Wrapper< T >
using NativeType = T
 

Constructor & Destructor Documentation

◆ TypeWrapper() [1/5]

template<typename T , TypeIndex Index>
opcua::TypeWrapper< T, Index >::TypeWrapper ( )
constexprdefaultnoexcept

◆ TypeWrapper() [2/5]

template<typename T , TypeIndex Index>
opcua::TypeWrapper< T, Index >::TypeWrapper ( const T & native)
inlineexplicitconstexpr

Constructor with native object (deep copy).

Definition at line 31 of file typewrapper.hpp.

◆ TypeWrapper() [3/5]

template<typename T , TypeIndex Index>
opcua::TypeWrapper< T, Index >::TypeWrapper ( T && native)
inlineconstexprnoexcept

Constructor with native object (move rvalue).

Definition at line 35 of file typewrapper.hpp.

◆ ~TypeWrapper()

template<typename T , TypeIndex Index>
opcua::TypeWrapper< T, Index >::~TypeWrapper ( )
inline

Definition at line 38 of file typewrapper.hpp.

◆ TypeWrapper() [4/5]

template<typename T , TypeIndex Index>
opcua::TypeWrapper< T, Index >::TypeWrapper ( const TypeWrapper< T, Index > & other)
inlineconstexpr

Copy constructor (deep copy).

Definition at line 43 of file typewrapper.hpp.

◆ TypeWrapper() [5/5]

template<typename T , TypeIndex Index>
opcua::TypeWrapper< T, Index >::TypeWrapper ( TypeWrapper< T, Index > && other)
inlineconstexprnoexcept

Move constructor.

Definition at line 47 of file typewrapper.hpp.

Member Function Documentation

◆ operator=() [1/4]

template<typename T , TypeIndex Index>
TypeWrapper & opcua::TypeWrapper< T, Index >::operator= ( const TypeWrapper< T, Index > & other)
inlineconstexpr

Copy assignment (deep copy).

Definition at line 51 of file typewrapper.hpp.

◆ operator=() [2/4]

template<typename T , TypeIndex Index>
TypeWrapper & opcua::TypeWrapper< T, Index >::operator= ( const T & native)
inlineconstexpr

Copy assignment with native object (deep copy).

Definition at line 60 of file typewrapper.hpp.

◆ operator=() [3/4]

template<typename T , TypeIndex Index>
TypeWrapper & opcua::TypeWrapper< T, Index >::operator= ( TypeWrapper< T, Index > && other)
inlineconstexprnoexcept

Move assignment.

Definition at line 69 of file typewrapper.hpp.

◆ operator=() [4/4]

template<typename T , TypeIndex Index>
TypeWrapper & opcua::TypeWrapper< T, Index >::operator= ( T && native)
inlineconstexprnoexcept

Move assignment with native object.

Definition at line 78 of file typewrapper.hpp.

◆ typeIndex()

template<typename T , TypeIndex Index>
static constexpr TypeIndex opcua::TypeWrapper< T, Index >::typeIndex ( )
inlinestaticconstexpr

Get type as type index of the UA_TYPES array.

Definition at line 87 of file typewrapper.hpp.

◆ clear()