34 #error THIS HEADER IS A GENERATOR. DO NOT INCLUDE.
63 #ifndef ETL_VARIANT_POOL_INCLUDED
64 #define ETL_VARIANT_POOL_INCLUDED
74 #include "static_assert.h"
75 #include "type_lookup.h"
91 :
exception(reason_, file_name_, line_number_)
102 :
variant_pool_exception(ETL_ERROR_TEXT(
"variant_pool:cannot create", ETL_FILE
"A"), file_name_, line_number_)
113 :
variant_pool_exception(ETL_ERROR_TEXT(
"variant_pool:did not create", ETL_FILE
"B"), file_name_, line_number_)
135 static const size_t MAX_SIZE = MAX_SIZE_;
144 #if ETL_CPP11_NOT_SUPPORTED || ETL_USING_STLPORT
148 template <
typename T>
171 p = pool.template allocate<T>();
173 if (p != ETL_NULLPTR)
185 template <
typename T,
typename TP1>
208 p = pool.template allocate<T>();
210 if (p != ETL_NULLPTR)
222 template <
typename T,
typename TP1,
typename TP2>
223 T*
create(
const TP1& p1,
const TP2& p2)
245 p = pool.template allocate<T>();
247 if (p != ETL_NULLPTR)
259 template <
typename T,
typename TP1,
typename TP2,
typename TP3>
260 T*
create(
const TP1& p1,
const TP2& p2,
const TP3& p3)
282 p = pool.template allocate<T>();
284 if (p != ETL_NULLPTR)
286 new (p) T(p1, p2, p3);
296 template <
typename T,
typename TP1,
typename TP2,
typename TP3,
typename TP4>
297 T*
create(
const TP1& p1,
const TP2& p2,
const TP3& p3,
const TP4& p4)
319 p = pool.template allocate<T>();
321 if (p != ETL_NULLPTR)
323 new (p) T(p1, p2, p3, p4);
333 template <
typename T,
typename... Args>
356 p =
pool.template allocate<T>();
358 if (p != ETL_NULLPTR)
360 new (p) T(ETL_OR_STD::forward<Args>(args)...);
371 template <
typename T>
393 void* vp =
reinterpret_cast<char*
>(
const_cast<T*
>(p));
Definition: variant_pool_generator.h:98
Definition: variant_pool_generator.h:109
Definition: variant_pool_generator.h:87
Definition: variant_pool_generator.h:132
size_t max_size() const
Returns the maximum number of items in the variant_pool.
Definition: variant_pool_generator.h:410
bool destroy(const T *const p)
Destroys the object.
Definition: variant_pool_generator.h:372
variant_pool()
Default constructor.
Definition: variant_pool_generator.h:140
T * create(Args &&... args)
Creates the object from a type. Variadic parameter constructor.
Definition: variant_pool_generator.h:334
size_t available() const
Returns the number of free items in the variant_pool.
Definition: variant_pool_generator.h:418
size_t size() const
Returns the number of allocated items in the variant_pool.
Definition: variant_pool_generator.h:426
bool empty() const
Checks to see if there are no allocated items in the variant_pool.
Definition: variant_pool_generator.h:435
T * create()
Creates the object. Default constructor.
Definition: variant_pool.h:142
bool full() const
Checks to see if there are no free items in the variant_pool.
Definition: variant_pool_generator.h:444
#define ETL_ASSERT(b, e)
Definition: error_handler.h:290
exception(string_type reason_, string_type file_, numeric_type line_)
Constructor.
Definition: exception.h:67
Definition: exception.h:47
size_t size() const
Returns the number of allocated items in the pool.
Definition: pool.h:309
bool empty() const
Definition: pool.h:318
bool is_in_pool(const void *p_object) const
Definition: pool.h:276
bool full() const
Definition: pool.h:327
void release(const void *const p_object)
Definition: pool.h:255
size_t available() const
Returns the number of free items in the pool.
Definition: pool.h:301
Definition: absolute.h:37