30 #error THIS HEADER IS A GENERATOR. DO NOT INCLUDE.
51 #ifndef ETL_VARIANT_POOL_INCLUDED
52 #define ETL_VARIANT_POOL_INCLUDED
62 #include "static_assert.h"
63 #include "type_lookup.h"
78 variant_pool_exception(string_type reason_, string_type file_name_, numeric_type line_number_)
79 :
exception(reason_, file_name_, line_number_)
89 variant_pool_cannot_create(string_type file_name_, numeric_type line_number_)
90 : variant_pool_exception(ETL_ERROR_TEXT(
"variant_pool:cannot create", ETL_FILE
"A"), file_name_, line_number_)
100 variant_pool_did_not_create(string_type file_name_, numeric_type line_number_)
101 : variant_pool_exception(ETL_ERROR_TEXT(
"variant_pool:did not create", ETL_FILE
"B"), file_name_, line_number_)
107 template <
const size_t MAX_SIZE_,
128 static const size_t MAX_SIZE = MAX_SIZE_;
137 #if ETL_CPP11_NOT_SUPPORTED || ETL_USING_STLPORT
141 template <
typename T>
144 ETL_STATIC_ASSERT((
etl::is_one_of<T, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::value),
"Unsupported type");
154 p =
pool.template allocate<T>();
156 if (p != ETL_NULLPTR)
168 template <
typename T,
typename TP1>
171 ETL_STATIC_ASSERT((
etl::is_one_of<T, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::value),
"Unsupported type");
181 p =
pool.template allocate<T>();
183 if (p != ETL_NULLPTR)
195 template <
typename T,
typename TP1,
typename TP2>
198 ETL_STATIC_ASSERT((
etl::is_one_of<T, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::value),
"Unsupported type");
208 p =
pool.template allocate<T>();
210 if (p != ETL_NULLPTR)
222 template <
typename T,
typename TP1,
typename TP2,
typename TP3>
223 T*
create(
const TP1& p1,
const TP2& p2,
const TP3& p3)
225 ETL_STATIC_ASSERT((
etl::is_one_of<T, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::value),
"Unsupported type");
235 p =
pool.template allocate<T>();
237 if (p != ETL_NULLPTR)
239 new (p) T(p1, p2, p3);
249 template <
typename T,
typename TP1,
typename TP2,
typename TP3,
typename TP4>
250 T*
create(
const TP1& p1,
const TP2& p2,
const TP3& p3,
const TP4& p4)
252 ETL_STATIC_ASSERT((
etl::is_one_of<T, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::value),
"Unsupported type");
262 p =
pool.template allocate<T>();
264 if (p != ETL_NULLPTR)
266 new (p) T(p1, p2, p3, p4);
276 template <
typename T,
typename... Args>
279 ETL_STATIC_ASSERT((
etl::is_one_of<T, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::value),
"Unsupported type");
289 p = pool.template allocate<T>();
291 if (p != ETL_NULLPTR)
293 new (p) T(etl::forward<Args>(args)...);
304 template <
typename T>
307 ETL_STATIC_ASSERT((
etl::is_one_of<T, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::value ||
327 void* vp =
reinterpret_cast<char*
>(
const_cast<T*
>(p));
389 etl::generic_pool<etl::largest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::size,
390 etl::largest<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::alignment,
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.h:344
bool destroy(const T *const p)
Destroys the object.
Definition: variant_pool.h:305
T * create(const TP1 &p1, const TP2 &p2, const TP3 &p3)
Creates the object. Three parameter constructor.
Definition: variant_pool.h:223
T * create(const TP1 &p1, const TP2 &p2)
Creates the object. Two parameter constructor.
Definition: variant_pool.h:196
T * create(const TP1 &p1, const TP2 &p2, const TP3 &p3, const TP4 &p4)
Creates the object. Four parameter constructor.
Definition: variant_pool.h:250
variant_pool()
Default constructor.
Definition: variant_pool.h:133
T * create(const TP1 &p1)
Creates the object. One parameter constructor.
Definition: variant_pool.h:169
size_t available() const
Returns the number of free items in the variant_pool.
Definition: variant_pool.h:352
size_t size() const
Returns the number of allocated items in the variant_pool.
Definition: variant_pool.h:360
bool empty() const
Definition: variant_pool.h:369
T * create()
Creates the object. Default constructor.
Definition: variant_pool.h:142
bool full() const
Definition: variant_pool.h:378
#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
Definition: largest.h:362
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
is_base_of
Definition: type_traits_generator.h:1289
Definition: absolute.h:37
Definition: type_traits.h:1397