FuncSketch
Loading...
Searching...
No Matches
func_sketch::expressions::ExpressionMemoryPool Class Reference

Class of memory pools for expressions. More...

#include <func_sketch/expressions/expression_memory_pool.h>

Collaboration diagram for func_sketch::expressions::ExpressionMemoryPool:

Public Member Functions

 ExpressionMemoryPool ()
 Constructor.
template<typename T, typename... Args>
Expressioncreate (Args &&... args)
 Create an expression.
void destroy (Expression *expression) noexcept
 Destroy an expression including its child expressions.

Private Attributes

std::pmr::monotonic_buffer_resource memory_resource_
 Memory resource.
std::pmr::polymorphic_allocator< Expressionallocator_
 Allocator of expressions.

Detailed Description

Class of memory pools for expressions.

Note
This class releases memory when an instance is destroyed.

Definition at line 36 of file expression_memory_pool.h.

Constructor & Destructor Documentation

◆ ExpressionMemoryPool()

func_sketch::expressions::ExpressionMemoryPool::ExpressionMemoryPool ( )
inline

Constructor.

Definition at line 41 of file expression_memory_pool.h.

Member Function Documentation

◆ create()

template<typename T, typename... Args>
Expression * func_sketch::expressions::ExpressionMemoryPool::create ( Args &&... args)
inlinenodiscard

Create an expression.

Template Parameters
TType of the expression.
ArgsTypes of arguments.
Parameters
[in]argsArguments.
Returns
Created expression.

Definition at line 53 of file expression_memory_pool.h.

◆ destroy()

void func_sketch::expressions::ExpressionMemoryPool::destroy ( Expression * expression)
inlinenoexcept

Destroy an expression including its child expressions.

Parameters
[in]expressionExpression to destroy.
Note
This function calls destructors of the expression and its child expressions. Memory is released when the memory pool is destroyed. Use of the expression after calling this function is undefined behavior.
This function does nothing if the argument is nullptr.

Definition at line 68 of file expression_memory_pool.h.

Member Data Documentation

◆ memory_resource_

std::pmr::monotonic_buffer_resource func_sketch::expressions::ExpressionMemoryPool::memory_resource_
private

Memory resource.

Definition at line 97 of file expression_memory_pool.h.

◆ allocator_

std::pmr::polymorphic_allocator<Expression> func_sketch::expressions::ExpressionMemoryPool::allocator_
private

Allocator of expressions.

Definition at line 100 of file expression_memory_pool.h.


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