Factory functions for Executor core classes.
More...
|
| template<typename P > |
| using | BifrostGraph::Executor::DeleterFunc = void(*)(P *p) |
| | The signature for the custom pointer deleter of a pointee p. This is the custom deleter type to use with the constructor Owner(P* p, DeleterFunc d). More...
|
| |
Factory functions for Executor core classes.
◆ EXECUTOR_DECLARE_MAKE_OWNER_FRIENDSHIP
| #define EXECUTOR_DECLARE_MAKE_OWNER_FRIENDSHIP |
( |
| ) |
|
Value: template <typename T, typename... Args> \
template <typename T, typename... Args> \
void (*deleterFunc)(T * p), Args&&... args)
Owner< T > makeOwner(Args &&... args)
Create a new T object, constructed from the given arguments, and validate it with the expression T::i...
The Owner<T> class template represents ownership of an object pointer. It indicates that the pointed ...
Helper macro to declare friend the makeOwner<> factory functions.
Definition at line 115 of file Factory.h.
◆ DeleterFunc
The signature for the custom pointer deleter of a pointee p. This is the custom deleter type to use with the constructor Owner(P* p, DeleterFunc d).
- Template Parameters
-
| P | the storage type used for the owned object. |
- Parameters
-
| [in] | p | a pointer to the owned object to destruct. Can be nullptr. |
Definition at line 73 of file Factory.h.
◆ makeOwner() [1/2]
template<typename T , typename... Args>
| Owner< T > BifrostGraph::Executor::makeOwner |
( |
Args &&... |
args | ) |
|
Create a new T object, constructed from the given arguments, and validate it with the expression T::isValid().
If the object is successfully created and it is valid, then an Owner<T> pointing to the newly created object is returned.
If an exception is thrown during memory allocation or during the object's constructor execution, this exception is propagated to the caller. If after its construction the newly created T object is invalid, it is deleted and an exception is thrown.
Whenever the new T object must be deleted (by this makeOwner function or by the returned Owner object), it will be destructed using the expression delete p, where p is a pointer to the T object.
- Template Parameters
-
| T | the type of object to create |
| Args | the types of the constructor arguments |
- Parameters
-
| [in] | args | the arguments to pass to the constructor of the object |
- Returns
- An Owner containing the object if the construction has succeeded and if the new object is valid; an exception is thrown otherwise.
- Exceptions
-
| std::logic_error | Thrown if the newly created T object is invalid after its construction. This is usually caused by wrong arguments passed to the constructor. |
| <other> | An exception may be thrown during memory allocation or during the object's constructor execution. Such exceptions are not handled by makeOwner but they are propagated to the caller. |
Definition at line 58 of file Factory.h.
◆ makeOwner() [2/2]
template<typename T , typename... Args>
| Owner< T > BifrostGraph::Executor::makeOwner |
( |
DeleterFunc< T > |
d, |
|
|
Args &&... |
args |
|
) |
| |
Create a new T object, constructed from the given arguments, and validate it with the expression T::isValid().
If the object is successfully created and it is valid, then an Owner<T> pointing to the newly created object is returned.
If an exception is thrown during memory allocation or during the object's constructor execution, this exception is propagated to the caller. If after its construction the newly created T object is invalid, it is deleted and an exception is thrown.
Whenever the new T object must be deleted (by this makeOwner function or by the returned Owner object), it will be destructed by calling the given custom deleter d using the expression d(p), where p is a pointer to the T object.
- Template Parameters
-
| T | the type of object to create |
| Args | the types of the constructor arguments |
- Parameters
-
| [in] | d | the deleter to invoke when the new object is destructed. |
| [in] | args | the arguments to pass to the constructor of the object |
- Returns
- An Owner containing the object if the construction has succeeded and if the new object is valid; an exception is thrown otherwise.
- Exceptions
-
| std::logic_error | Thrown if the newly created T object is invalid after its construction. This is usually caused by wrong arguments passed to the constructor. |
| <other> | An exception may be thrown during memory allocation or during the object's constructor execution. Such exceptions are not handled by makeOwner but they are propagated to the caller. |
Definition at line 104 of file Factory.h.