Cogs.Core
Public Member Functions | Private Attributes | List of all members
Cogs::Collections::DefaultPage< T > Struct Template Reference

Default page type that maintains storage for elements of type T in the pool page and provides pooled allocations for this type. More...

#include <ConfigurablePagedPool.h>

Public Member Functions

 DefaultPage ()=default
 Default constructor.
 
 DefaultPage (DefaultContext &context, size_t pageSize)
 Construct a new page with the given page size.
 
T * getHead ()
 Retrieve a pointer to the first element of the page.
 

Private Attributes

std::vector< uint8_t > bytes
 Backing storage bytes.
 

Detailed Description

template<typename T>
struct Cogs::Collections::DefaultPage< T >

Default page type that maintains storage for elements of type T in the pool page and provides pooled allocations for this type.

Template Parameters
TType of element to store in the pool page. For each page, sizeof(T) * pageSize bytes will be reserved as backing storage.

Definition at line 31 of file ConfigurablePagedPool.h.

Constructor & Destructor Documentation

◆ DefaultPage()

template<typename T >
Cogs::Collections::DefaultPage< T >::DefaultPage ( DefaultContext context,
size_t  pageSize 
)
inline

Construct a new page with the given page size.

Parameters
contextDefault allocation context (ignored).
pageSizeNumber of elements per page.

Definition at line 42 of file ConfigurablePagedPool.h.

References Cogs::Collections::DefaultPage< T >::bytes, and Cogs::Collections::ItemHeader::next.

Member Function Documentation

◆ getHead()

template<typename T >
T * Cogs::Collections::DefaultPage< T >::getHead ( )
inline

Retrieve a pointer to the first element of the page.

Definition at line 67 of file ConfigurablePagedPool.h.

References Cogs::Collections::DefaultPage< T >::bytes.

Member Data Documentation

◆ bytes

template<typename T >
std::vector<uint8_t> Cogs::Collections::DefaultPage< T >::bytes
private

The documentation for this struct was generated from the following file: