ECSTASY
All in the name
Loading...
Searching...
No Matches
ecstasy::ObjectWrapper< T > Class Template Reference

Basic object wrapper as a resource. More...

#include <ObjectWrapper.hpp>

Inheritance diagram for ecstasy::ObjectWrapper< T >:
Collaboration diagram for ecstasy::ObjectWrapper< T >:

Public Member Functions

template<typename... Args>
 ObjectWrapper (Args &&...args)
 Construct a new Object Wrapper.
 
 ~ObjectWrapper ()=default
 Destroy the Object Wrapper.
 
constexpr T & operator* () noexcept
 Access the wrapped object.
 
constexpr const T & operator* () const noexcept
 Access the wrapped object.
 
constexpr T * operator-> () noexcept
 Access the wrapped object pointer.
 
constexpr T const * operator-> () const noexcept
 Access the wrapped object pointer.
 
constexpr T & get () noexcept
 Get a reference to the object.
 
constexpr const T & get () const noexcept
 Get a const reference to the object.
 
- Public Member Functions inherited from ecstasy::IResource
virtual ~IResource ()=default
 Default destructor.
 

Protected Attributes

_object
 Wrapped object.
 

Detailed Description

template<typename T>
class ecstasy::ObjectWrapper< T >

Basic object wrapper as a resource.

Template Parameters
TType of the wrapped object.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-11-16)

Definition at line 28 of file ObjectWrapper.hpp.

Constructor & Destructor Documentation

◆ ObjectWrapper()

template<typename T >
template<typename... Args>
ecstasy::ObjectWrapper< T >::ObjectWrapper ( Args &&...  args)
inline

Construct a new Object Wrapper.

Template Parameters
ArgsArgument types of the object constructor.
Parameters
[in]argsArguments of the object constructor.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-11-16)

Definition at line 41 of file ObjectWrapper.hpp.

41 : _object(std::forward<Args>(args)...)
42 {
43 }
T _object
Wrapped object.

◆ ~ObjectWrapper()

template<typename T >
ecstasy::ObjectWrapper< T >::~ObjectWrapper ( )
default

Destroy the Object Wrapper.

Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-11-16)

Member Function Documentation

◆ get() [1/2]

template<typename T >
constexpr const T & ecstasy::ObjectWrapper< T >::get ( ) const
inlineconstexprnoexcept

Get a const reference to the object.

Returns
const T& Const reference to the object.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-11-16)

Definition at line 125 of file ObjectWrapper.hpp.

126 {
127 return _object;
128 }

◆ get() [2/2]

template<typename T >
constexpr T & ecstasy::ObjectWrapper< T >::get ( )
inlineconstexprnoexcept

Get a reference to the object.

Returns
T& Reference to the object.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-11-16)

Definition at line 112 of file ObjectWrapper.hpp.

113 {
114 return _object;
115 }

◆ operator*() [1/2]

template<typename T >
constexpr const T & ecstasy::ObjectWrapper< T >::operator* ( ) const
inlineconstexprnoexcept

Access the wrapped object.

Returns
const T& Const reference to the wrapped object.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-10-18)

Definition at line 74 of file ObjectWrapper.hpp.

75 {
76 return _object;
77 }

◆ operator*() [2/2]

template<typename T >
constexpr T & ecstasy::ObjectWrapper< T >::operator* ( )
inlineconstexprnoexcept

Access the wrapped object.

Returns
T& Reference to the wrapped object.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-10-18)

Definition at line 61 of file ObjectWrapper.hpp.

62 {
63 return _object;
64 }

◆ operator->() [1/2]

template<typename T >
constexpr T const * ecstasy::ObjectWrapper< T >::operator-> ( ) const
inlineconstexprnoexcept

Access the wrapped object pointer.

Returns
T const* Const pointer to the wrapped object.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-10-18)

Definition at line 99 of file ObjectWrapper.hpp.

100 {
101 return &_object;
102 }

◆ operator->() [2/2]

template<typename T >
constexpr T * ecstasy::ObjectWrapper< T >::operator-> ( )
inlineconstexprnoexcept

Access the wrapped object pointer.

Returns
T* Pointer to the wrapped object.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-10-18)

Definition at line 87 of file ObjectWrapper.hpp.

88 {
89 return &_object;
90 }

Member Data Documentation

◆ _object

template<typename T >
T ecstasy::ObjectWrapper< T >::_object
protected

Wrapped object.

Definition at line 132 of file ObjectWrapper.hpp.


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