|
COMMS
Template library intended to help with implementation of communication protocols.
|
#include "alloc.h"
Dynamic memory allocator.
Uses standard operator "new" to allocate and initialise requested object.
| TInterface | Common interface class for all objects being allocated with this allocator. |
Public Types | |
| using | Ptr = std::unique_ptr< TInterface > |
| Smart pointer (std::unique_ptr) to the allocated object. | |
Static Public Member Functions | |
| template<typename TObj , typename... TArgs> | |
| static Ptr | alloc (TArgs &&... args) |
| Allocation function. | |
| static constexpr bool | canAllocate () |
| Inquiry whether allocation is possible. | |
| template<typename TObj > | |
| static Ptr | wrap (TObj *obj) |
| Function used to wrap raw pointer into a smart one. | |
|
static |
Allocation function.
| TObj | Type of the object being allocated, expected to be the same as or derived from TInterface. |
| TArgs | types of arguments to be passed to the constructor. |
| [in] | args | Extra arguments to be passed to allocated object's constructor. |
|
staticconstexpr |
Inquiry whether allocation is possible.
|
static |
Function used to wrap raw pointer into a smart one.
| Type | of the object, expected to be the same as or derived from TInterface. |
| [in] | obj | Pointer to previously allocated object. |