|
COMMS
Template library intended to help with implementation of communication protocols.
|
#include "alloc.h"
In-place object pool allocator.
Similar to InPlaceSingle allocator, but allows multiple allocations at the same time, limited by TSize template parameter.
| TInterface | Common interface class for all objects being allocated with this allocator. |
| TSize | Number of objects this allocator is allowed to allocate. |
| TAllTypes | All the possible types that can be allocated with this allocator bundled in std::tuple. |
Public Types | |
| using | Ptr = typename PoolElem::Ptr |
| Smart pointer (std::unique_ptr) to the allocated object. | |
Public Member Functions | |
| template<typename TObj , typename... TArgs> | |
| Ptr | alloc (TArgs &&... args) |
| Allocation function. | |
| template<typename TObj > | |
| Ptr | wrap (TObj *obj) |
| Function used to wrap raw pointer into a smart one. | |
| using comms::util::alloc::InPlacePool< TInterface, TSize, TAllTypes >::Ptr = typename PoolElem::Ptr |
Smart pointer (std::unique_ptr) to the allocated object.
Same as InPlaceSingle::Ptr;
| Ptr comms::util::alloc::InPlacePool< TInterface, TSize, TAllTypes >::alloc | ( | TArgs &&... | args | ) |
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. |
| Ptr comms::util::alloc::InPlacePool< TInterface, TSize, TAllTypes >::wrap | ( | TObj * | obj | ) |
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. |