MacStd
OS X API using Standard C++
Loading...
Searching...
No Matches
macstd::dplhandle< T, INVAL > Class Template Referenceabstract

Base abstract template class to support object handle keeping for objects that support trivial handle duplication. More...

#include <MacStd/common.hpp>

Inheritance diagram for macstd::dplhandle< T, INVAL >:
macstd::handle< T, INVAL >

Public Member Functions

 dplhandle () noexcept
 Initializes a new class instance with the object handle set to INVAL.
 
 dplhandle (T h) noexcept
 Initializes a new class instance with an already available object handle.
 
 dplhandle (const dplhandle< T, INVAL > &h)
 Copy constructor.
 
 dplhandle (dplhandle< T, INVAL > &&h) noexcept
 Move constructor.
 
dplhandle< T, INVAL > & operator= (T h) noexcept
 Attaches already available object handle.
 
dplhandle< T, INVAL > & operator= (const dplhandle< T, INVAL > &h) noexcept
 Duplicates the object.
 
dplhandle< T, INVAL > & operator= (dplhandle< T, INVAL > &&h) noexcept
 Moves the object.
 
duplicate () const
 Duplicates and returns a new object handle.
 
void attach_duplicated (T h)
 Duplicates an object handle and sets a new object handle.
 
- Public Member Functions inherited from macstd::handle< T, INVAL >
 handle () noexcept
 Initializes a new class instance with the object handle set to INVAL.
 
 handle (T h) noexcept
 Initializes a new class instance with an already available object handle.
 
 handle (handle< T, INVAL > &&h) noexcept
 Move constructor.
 
handle< T, INVAL > & operator= (T h) noexcept
 Attaches already available object handle.
 
handle< T, INVAL > & operator= (handle< T, INVAL > &&h) noexcept
 Move assignment.
 
 operator T () const
 Auto-typecasting operator.
 
T *& operator* () const
 Returns the object handle value when the object handle is a pointer to a value (class, struct, etc.).
 
T * operator& ()
 Returns the object handle reference.
 
operator-> () const
 Provides object handle member access when the object handle is a pointer to a class or struct.
 
bool operator! () const
 Tests if the object handle is invalid.
 
bool operator< (T h) const
 Is handle less than?
 
bool operator<= (T h) const
 Is handle less than or equal to?
 
bool operator>= (T h) const
 Is handle greater than or equal to?
 
bool operator> (T h) const
 Is handle greater than?
 
bool operator!= (T h) const
 Is handle not equal to?
 
bool operator== (T h) const
 Is handle equal to?
 
void attach (T h) noexcept
 Sets a new object handle for the class.
 
detach ()
 Dismisses the object handle from this class.
 
void free ()
 Destroys the object.
 

Protected Member Functions

virtual T duplicate_internal (T h) const =0
 Abstract member function that must be implemented by child classes to do the actual object handle duplication. On failure, it should throw appropriate exception describing the cause, rather than return an invalid handle.
 
- Protected Member Functions inherited from macstd::handle< T, INVAL >
virtual void free_internal () noexcept=0
 Abstract member function that must be implemented by child classes to do the actual object destruction.
 

Additional Inherited Members

- Protected Attributes inherited from macstd::handle< T, INVAL >
m_h
 Object handle.
 

Detailed Description

template<class T, T INVAL>
class macstd::dplhandle< T, INVAL >

Base abstract template class to support object handle keeping for objects that support trivial handle duplication.

Constructor & Destructor Documentation

◆ dplhandle() [1/3]

template<class T , T INVAL>
macstd::dplhandle< T, INVAL >::dplhandle ( T h)
inlinenoexcept

Initializes a new class instance with an already available object handle.

Parameters
[in]hInitial object handle value

◆ dplhandle() [2/3]

template<class T , T INVAL>
macstd::dplhandle< T, INVAL >::dplhandle ( const dplhandle< T, INVAL > & h)
inline

Copy constructor.

Parameters
[in,out]hA reference of another object

◆ dplhandle() [3/3]

template<class T , T INVAL>
macstd::dplhandle< T, INVAL >::dplhandle ( dplhandle< T, INVAL > && h)
inlinenoexcept

Move constructor.

Parameters
[in,out]hA rvalue reference of another object

Member Function Documentation

◆ attach_duplicated()

template<class T , T INVAL>
void macstd::dplhandle< T, INVAL >::attach_duplicated ( T h)
inline

Duplicates an object handle and sets a new object handle.

Parameters
[in]hObject handle of existing object

◆ duplicate()

template<class T , T INVAL>
T macstd::dplhandle< T, INVAL >::duplicate ( ) const
inline

Duplicates and returns a new object handle.

Returns
Duplicated object handle

◆ duplicate_internal()

template<class T , T INVAL>
virtual T macstd::dplhandle< T, INVAL >::duplicate_internal ( T h) const
protectedpure virtual

Abstract member function that must be implemented by child classes to do the actual object handle duplication. On failure, it should throw appropriate exception describing the cause, rather than return an invalid handle.

Parameters
[in]hObject handle of existing object
Returns
Duplicated object handle

◆ operator=() [1/3]

template<class T , T INVAL>
dplhandle< T, INVAL > & macstd::dplhandle< T, INVAL >::operator= ( const dplhandle< T, INVAL > & h)
inlinenoexcept

Duplicates the object.

Parameters
[in]hObject

◆ operator=() [2/3]

template<class T , T INVAL>
dplhandle< T, INVAL > & macstd::dplhandle< T, INVAL >::operator= ( dplhandle< T, INVAL > && h)
inlinenoexcept

Moves the object.

Parameters
[in,out]hA rvalue reference of another object

◆ operator=() [3/3]

template<class T , T INVAL>
dplhandle< T, INVAL > & macstd::dplhandle< T, INVAL >::operator= ( T h)
inlinenoexcept

Attaches already available object handle.

Parameters
[in]hObject handle value

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