Cerata
A library to generate structural hardware designs
cerata::Pool< T > Class Template Reference

A pool to share ownership of objects. More...

#include <pool.h>

Public Member Functions

void Add (const std::shared_ptr< T > &object)
 Add an object to the pool, taking shared ownership. Object may not already exist in the pool.
 
std::optional< T * > Get (const std::string &name)
 Retrieve a component from the pool by name, if it exists. Returns empty option otherwise.
 
void Clear ()
 Release ownership of all components.
 

Protected Attributes

std::vector< std::shared_ptr< T > > objects_
 A list of objects that this pool owns.
 

Detailed Description

template<typename T>
class cerata::Pool< T >

A pool to share ownership of objects.

Useful if these objects that are often used (e.g. integer literals), to be able to prevent unnecessary duplicates.

Definition at line 39 of file pool.h.


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