Bifrost SDK
Bifrost SDK documentation
BifrostGraph Executor Factory

Factory functions for Executor core classes. More...

Macros

#define EXECUTOR_DECLARE_MAKE_OWNER_FRIENDSHIP()
 Helper macro to declare friend the makeOwner<> factory functions. More...
 

Typedefs

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...
 

Functions

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(). More...
 
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(). More...
 

Detailed Description

Factory functions for Executor core classes.

Macro Definition Documentation

◆ 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...
Definition: Factory.h:58
The Owner<T> class template represents ownership of an object pointer. It indicates that the pointed ...
Definition: Owner.h:38

Helper macro to declare friend the makeOwner<> factory functions.

Definition at line 115 of file Factory.h.

Typedef Documentation

◆ DeleterFunc

template<typename P >
using BifrostGraph::Executor::DeleterFunc = typedef 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).

Template Parameters
Pthe storage type used for the owned object.
Parameters
[in]pa pointer to the owned object to destruct. Can be nullptr.

Definition at line 73 of file Factory.h.

Function Documentation

◆ 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
Tthe type of object to create
Argsthe types of the constructor arguments
Parameters
[in]argsthe 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_errorThrown 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
Tthe type of object to create
Argsthe types of the constructor arguments
Parameters
[in]dthe deleter to invoke when the new object is destructed.
[in]argsthe 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_errorThrown 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.