This class wraps an unmanaged object (or reference) which needs to be released after usage.
More...
|
| ScopedObjectCompileTimeT ()=default |
| Default constructor creating an object with invalid object. More...
|
|
| ScopedObjectCompileTimeT (ScopedObjectCompileTimeT< T, TReleaseValue, TReleaseReturn, tReleaseFunction, tExpectedReturnValue, tCheckReturnValue, tInvalidValue > &&scopedObject) noexcept |
| Move constructor. More...
|
|
| ScopedObjectCompileTimeT (T &&object) noexcept |
| Creates a new scoped object. More...
|
|
| ScopedObjectCompileTimeT (T &&object, const bool needsRelease) noexcept |
| Creates a new scoped object. More...
|
|
| ScopedObjectCompileTimeT (const T &object) |
| Creates a new scoped object. More...
|
|
| ScopedObjectCompileTimeT (const T &object, const bool needsRelease) |
| Creates a new scoped object. More...
|
|
| ~ScopedObjectCompileTimeT () |
| Destructs this scoped object and releases the internal wrapped object. More...
|
|
bool | isValid () const |
| Returns whether this scoped object holds a valid object. More...
|
|
const T & | object () const |
| Returns the wrapped object. More...
|
|
const T & | operator-> () const |
| Returns the wrapped object. More...
|
|
const T & | operator* () const |
| De-reference operator returning the wrapped object. More...
|
|
T & | resetObject (const bool needsRelease=true) |
| Releases the current wrapped object and returns a new wrapped object. More...
|
|
void | release () |
| Explicitly releases the wrapped object. More...
|
|
ScopedObjectCompileTimeT< T, TReleaseValue, TReleaseReturn, tReleaseFunction, tExpectedReturnValue, tCheckReturnValue, tInvalidValue > & | operator= (ScopedObjectCompileTimeT< T, TReleaseValue, TReleaseReturn, tReleaseFunction, tExpectedReturnValue, tCheckReturnValue, tInvalidValue > &&scopedObject) noexcept |
| Move operator. More...
|
|
| operator const T & () const |
| Returns the wrapped object. More...
|
|
template<typename T, typename TReleaseValue, typename TReleaseReturn, TReleaseReturn(*)(TReleaseValue) tReleaseFunction, typename NotVoidTyper< TReleaseReturn >::Type tExpectedReturnValue = NotVoidTyper<TReleaseReturn>::defaultValue(), bool tCheckReturnValue = true, T tInvalidValue = T()>
class Ocean::ScopedObjectCompileTimeT< T, TReleaseValue, TReleaseReturn, tReleaseFunction, tExpectedReturnValue, tCheckReturnValue, tInvalidValue >
This class wraps an unmanaged object (or reference) which needs to be released after usage.
The release function needs to be defined at compile time.
- Template Parameters
-
T | The data type of the wrapped object |
TReleaseValue | The optional explicit data type of the object to be released |
TReleaseReturn | The data type of the return value of the release function |
tReleaseFunction | The data type of the release function |
tExpectedReturnValue | The expected return value of the release function |
tCheckReturnValue | True, to check the return value when calling the release function; False, to ignore the return value |
tInvalidValue | The value of an invalid object |
- See also
- ScopedObjectT.
template<typename T , typename TReleaseValue , typename TReleaseReturn , TReleaseReturn(*)(TReleaseValue) tReleaseFunction, typename NotVoidTyper< TReleaseReturn >::Type tExpectedReturnValue = NotVoidTyper<TReleaseReturn>::defaultValue(), bool tCheckReturnValue = true, T tInvalidValue = T()>
Default constructor creating an object with invalid object.
template<typename T , typename TReleaseValue , typename TReleaseReturn , TReleaseReturn(*)(TReleaseValue) tReleaseFunction, typename NotVoidTyper< TReleaseReturn >::Type tExpectedReturnValue, bool tCheckReturnValue, T tInvalidValue>
Creates a new scoped object.
If 'object == tInvalidValue' the object will not be released once this scoped object is disposed.
- Parameters
-
object | The object to be wrapped |
template<typename T , typename TReleaseValue , typename TReleaseReturn , TReleaseReturn(*)(TReleaseValue) tReleaseFunction, typename NotVoidTyper< TReleaseReturn >::Type tExpectedReturnValue, bool tCheckReturnValue, T tInvalidValue>
Creates a new scoped object.
- Parameters
-
object | The object to be wrapped |
needsRelease | True, if the given object needs to be released once the scoped object is disposed; False, if the given object does not need to be released |
template<typename T , typename TReleaseValue , typename TReleaseReturn , TReleaseReturn(*)(TReleaseValue) tReleaseFunction, typename NotVoidTyper< TReleaseReturn >::Type tExpectedReturnValue, bool tCheckReturnValue, T tInvalidValue>
Creates a new scoped object.
If 'object == tInvalidValue' the object will not be released once this scoped object is disposed.
- Parameters
-
object | The object to be wrapped |
template<typename T , typename TReleaseValue , typename TReleaseReturn , TReleaseReturn(*)(TReleaseValue) tReleaseFunction, typename NotVoidTyper< TReleaseReturn >::Type tExpectedReturnValue, bool tCheckReturnValue, T tInvalidValue>
Creates a new scoped object.
- Parameters
-
object | The object to be wrapped |
needsRelease | True, if the given object needs to be released once the scoped object is disposed; False, if the given object does not need to be released |
template<typename T , typename TReleaseValue , typename TReleaseReturn , TReleaseReturn(*)(TReleaseValue) tReleaseFunction, typename NotVoidTyper< TReleaseReturn >::Type tExpectedReturnValue, bool tCheckReturnValue, T tInvalidValue>
Destructs this scoped object and releases the internal wrapped object.
template<typename T , typename TReleaseValue , typename TReleaseReturn , TReleaseReturn(*)(TReleaseValue) tReleaseFunction, typename NotVoidTyper< TReleaseReturn >::Type tExpectedReturnValue = NotVoidTyper<TReleaseReturn>::defaultValue(), bool tCheckReturnValue = true, T tInvalidValue = T()>
Ocean::ScopedObjectCompileTimeT< T, TReleaseValue, TReleaseReturn, tReleaseFunction, tExpectedReturnValue, tCheckReturnValue, tInvalidValue >::ScopedObjectCompileTimeT |
( |
const ScopedObjectCompileTimeT< T, TReleaseValue, TReleaseReturn, tReleaseFunction, tExpectedReturnValue, tCheckReturnValue, tInvalidValue > & |
| ) |
|
|
protecteddelete |
Disabled copy constructor.
template<typename T , typename TReleaseValue , typename TReleaseReturn , TReleaseReturn(*)(TReleaseValue) tReleaseFunction, typename NotVoidTyper< TReleaseReturn >::Type tExpectedReturnValue, bool tCheckReturnValue, T tInvalidValue>
bool Ocean::ScopedObjectCompileTimeT< T, TReleaseValue, TReleaseReturn, tReleaseFunction, tExpectedReturnValue, tCheckReturnValue, tInvalidValue >::isValid |
Returns whether this scoped object holds a valid object.
- Returns
- True, if so
template<typename T , typename TReleaseValue , typename TReleaseReturn , TReleaseReturn(*)(TReleaseValue) tReleaseFunction, typename NotVoidTyper< TReleaseReturn >::Type tExpectedReturnValue, bool tCheckReturnValue, T tInvalidValue>
const T & Ocean::ScopedObjectCompileTimeT< T, TReleaseValue, TReleaseReturn, tReleaseFunction, tExpectedReturnValue, tCheckReturnValue, tInvalidValue >::object |
Returns the wrapped object.
- Returns
- The wrapped object
template<typename T , typename TReleaseValue , typename TReleaseReturn , TReleaseReturn(*)(TReleaseValue) tReleaseFunction, typename NotVoidTyper< TReleaseReturn >::Type tExpectedReturnValue, bool tCheckReturnValue, T tInvalidValue>
Ocean::ScopedObjectCompileTimeT< T, TReleaseValue, TReleaseReturn, tReleaseFunction, tExpectedReturnValue, tCheckReturnValue, tInvalidValue >::operator const T & |
Returns the wrapped object.
- Returns
- The wrapped object
template<typename T , typename TReleaseValue , typename TReleaseReturn , TReleaseReturn(*)(TReleaseValue) tReleaseFunction, typename NotVoidTyper< TReleaseReturn >::Type tExpectedReturnValue, bool tCheckReturnValue, T tInvalidValue>
const T & Ocean::ScopedObjectCompileTimeT< T, TReleaseValue, TReleaseReturn, tReleaseFunction, tExpectedReturnValue, tCheckReturnValue, tInvalidValue >::operator* |
De-reference operator returning the wrapped object.
Ensure that the object is valid before calling this operator.
- Returns
- The wrapped object
- See also
- isValid().
template<typename T , typename TReleaseValue , typename TReleaseReturn , TReleaseReturn(*)(TReleaseValue) tReleaseFunction, typename NotVoidTyper< TReleaseReturn >::Type tExpectedReturnValue, bool tCheckReturnValue, T tInvalidValue>
const T & Ocean::ScopedObjectCompileTimeT< T, TReleaseValue, TReleaseReturn, tReleaseFunction, tExpectedReturnValue, tCheckReturnValue, tInvalidValue >::operator-> |
Returns the wrapped object.
Ensure that the object is valid before calling this operator.
- Returns
- The wrapped object
- See also
- isValid().
template<typename T , typename TReleaseValue , typename TReleaseReturn , TReleaseReturn(*)(TReleaseValue) tReleaseFunction, typename NotVoidTyper< TReleaseReturn >::Type tExpectedReturnValue = NotVoidTyper<TReleaseReturn>::defaultValue(), bool tCheckReturnValue = true, T tInvalidValue = T()>
ScopedObjectCompileTimeT& Ocean::ScopedObjectCompileTimeT< T, TReleaseValue, TReleaseReturn, tReleaseFunction, tExpectedReturnValue, tCheckReturnValue, tInvalidValue >::operator= |
( |
const ScopedObjectCompileTimeT< T, TReleaseValue, TReleaseReturn, tReleaseFunction, tExpectedReturnValue, tCheckReturnValue, tInvalidValue > & |
| ) |
|
|
protecteddelete |
Disabled assign operator.
- Returns
- Reference to this object
template<typename T , typename TReleaseValue , typename TReleaseReturn , TReleaseReturn(*)(TReleaseValue) tReleaseFunction, typename NotVoidTyper< TReleaseReturn >::Type tExpectedReturnValue, bool tCheckReturnValue, T tInvalidValue>
void Ocean::ScopedObjectCompileTimeT< T, TReleaseValue, TReleaseReturn, tReleaseFunction, tExpectedReturnValue, tCheckReturnValue, tInvalidValue >::release |
Explicitly releases the wrapped object.
template<typename T , typename TReleaseValue , typename TReleaseReturn , TReleaseReturn(*)(TReleaseValue) tReleaseFunction, typename NotVoidTyper< TReleaseReturn >::Type tExpectedReturnValue, bool tCheckReturnValue, T tInvalidValue>
T & Ocean::ScopedObjectCompileTimeT< T, TReleaseValue, TReleaseReturn, tReleaseFunction, tExpectedReturnValue, tCheckReturnValue, tInvalidValue >::resetObject |
( |
const bool |
needsRelease = true | ) |
|
Releases the current wrapped object and returns a new wrapped object.
- Parameters
-
needsRelease | True, if the new object needs to be released once the scoped object is disposed; False, if the new object does not need to be released |
- Returns
- The new wrapped object
template<typename T , typename TReleaseValue , typename TReleaseReturn , TReleaseReturn(*)(TReleaseValue) tReleaseFunction, typename NotVoidTyper< TReleaseReturn >::Type tExpectedReturnValue = NotVoidTyper<TReleaseReturn>::defaultValue(), bool tCheckReturnValue = true, T tInvalidValue = T()>
bool Ocean::ScopedObjectCompileTimeT< T, TReleaseValue, TReleaseReturn, tReleaseFunction, tExpectedReturnValue, tCheckReturnValue, tInvalidValue >::needsRelease_ = false |
|
protected |
True, if the wrapped object needs to be released.