29#ifndef __ETL_FACTORY__
30#define __ETL_FACTORY__
41#include "static_assert.h"
42#include "type_lookup.h"
45#if defined(ETL_COMPILER_GCC)
46 #warning THIS CLASS IS DEPRECATED!USE VARIANT_POOL INSTEAD.
47#elif defined(ETL_COMPILER_MICROSOFT)
48 #pragma message ("THIS CLASS IS DEPRECATED! USE VARIANT_POOL INSTEAD.")
111 typedef typename T1::type TT1;
112 typedef typename T2::type TT2;
113 typedef typename T3::type TT3;
114 typedef typename T4::type TT4;
115 typedef typename T5::type TT5;
116 typedef typename T6::type TT6;
117 typedef typename T7::type TT7;
118 typedef typename T8::type TT8;
119 typedef typename T9::type TT9;
120 typedef typename T10::type TT10;
121 typedef typename T11::type TT11;
122 typedef typename T12::type TT12;
123 typedef typename T13::type TT13;
124 typedef typename T14::type TT14;
125 typedef typename T15::type TT15;
126 typedef typename T16::type TT16;
133 static const size_t MAX_SIZE =
MAX_SIZE_;
142#if !ETL_CPP11_SUPPORTED
146 template <
typename T>
149 STATIC_ASSERT((
etl::is_one_of<T, TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9, TT10, TT11, TT12, TT13, TT14, TT15, TT16>::value),
"Unsupported type");
173 template <
typename T,
typename TP1>
176 STATIC_ASSERT((
etl::is_one_of<T, TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9, TT10, TT11, TT12, TT13, TT14, TT15, TT16>::value),
"Unsupported type");
200 template <
typename T,
typename TP1,
typename TP2>
203 STATIC_ASSERT((
etl::is_one_of<T, TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9, TT10, TT11, TT12, TT13, TT14, TT15, TT16>::value),
"Unsupported type");
227 template <
typename T,
typename TP1,
typename TP2,
typename TP3>
230 STATIC_ASSERT((
etl::is_one_of<T, TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9, TT10, TT11, TT12, TT13, TT14, TT15, TT16>::value),
"Unsupported type");
254 template <
typename T,
typename TP1,
typename TP2,
typename TP3,
typename TP4>
257 STATIC_ASSERT((
etl::is_one_of<T, TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9, TT10, TT11, TT12, TT13, TT14, TT15, TT16>::value),
"Unsupported type");
292 template <
size_t ID,
typename TP1>
303 template <
size_t ID,
typename TP1,
typename TP2>
314 template <
size_t ID,
typename TP1,
typename TP2,
typename TP3>
325 template <
size_t ID,
typename TP1,
typename TP2,
typename TP3,
typename TP4>
336 template <
typename T,
typename...
Args>
339 STATIC_ASSERT((
etl::is_one_of<T, TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9, TT10, TT11, TT12, TT13, TT14, TT15, TT16>::value),
"Unsupported type");
349 p = pool.template allocate<T>();
353 new (p) T(std::forward<Args>(args)...);
363 template <
size_t ID,
typename... Args>
368 return create_from_type<type>(std::forward<Args>(args)...);
375 template <
typename T>
378 STATIC_ASSERT((
etl::is_one_of<T, TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9, TT10, TT11, TT12, TT13, TT14, TT15, TT16>::value ||
398 void*
vp =
reinterpret_cast<char*
>(
const_cast<T*
>(p));
460 etl::generic_pool<etl::largest<TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9, TT10, TT11, TT12, TT13, TT14, TT15, TT16>::size,
461 etl::largest<TT1, TT2, TT3, TT4, TT5, TT6, TT7, TT8, TT9, TT10, TT11, TT12, TT13, TT14, TT15, TT16>::alignment,
T * create_from_type(const TP1 &p1, const TP2 &p2, const TP3 &p3, const TP4 &p4)
Creates the object. Four parameter constructor.
Definition factory.h:255
lookup_t::template type_from_id< ID >::type * create_from_id(const TP1 &p1, const TP2 &p2)
Creates the object from an index. Two parameter constructor.
Definition factory.h:304
factory()
Default constructor.
Definition factory.h:138
lookup_t::template type_from_id< ID >::type * create_from_id(const TP1 &p1)
Creates the object from an index. One parameter constructor.
Definition factory.h:293
bool empty() const
Definition factory.h:440
bool full() const
Definition factory.h:449
T * create_from_type(const TP1 &p1)
Creates the object. One parameter constructor.
Definition factory.h:174
T * create_from_type(const TP1 &p1, const TP2 &p2)
Creates the object. Two parameter constructor.
Definition factory.h:201
lookup_t::template type_from_id< ID >::type * create_from_id(const TP1 &p1, const TP2 &p2, const TP3 &p3, const TP4 &p4)
Creates the object from an index. Three parameter constructor.
Definition factory.h:326
size_t available() const
Returns the number of free items in the factory.
Definition factory.h:423
lookup_t::template type_from_id< ID >::type * create_from_id()
Creates the object from an index. Default constructor.
Definition factory.h:282
bool destroy(const T *const p)
Destroys the object.
Definition factory.h:376
T * create_from_type()
Creates the object. Default constructor.
Definition factory.h:147
size_t size() const
Returns the number of allocated items in the factory.
Definition factory.h:431
lookup_t::template type_from_id< ID >::type * create_from_id(const TP1 &p1, const TP2 &p2, const TP3 &p3)
Creates the object from an index. Three parameter constructor.
Definition factory.h:315
T * create_from_type(const TP1 &p1, const TP2 &p2, const TP3 &p3)
Creates the object. Three parameter constructor.
Definition factory.h:228
size_t max_size() const
Returns the maximum number of items in the factory.
Definition factory.h:415
Definition null_type.h:40
#define ETL_ASSERT(b, e)
Definition error_handler.h:356
Definition exception.h:47
size_t size() const
Returns the number of allocated items in the pool.
Definition ipool.h:301
bool empty() const
Definition ipool.h:310
bool full() const
Definition ipool.h:319
bool is_in_pool(const void *const p_object) const
Definition ipool.h:260
size_t available() const
Returns the number of free items in the pool.
Definition ipool.h:293
void release(const U *const p_object)
Definition pool.h:156
is_base_of
Definition type_traits_generator.h:1247
is_same
Definition type_traits_generator.h:1036
bitset_ext
Definition absolute.h:38
pair holds two objects of arbitrary type
Definition utility.h:164
ETL_CONSTEXPR pair()
Default constructor.
Definition utility.h:176
Definition type_lookup.h:238
The type/id pair type to use for type/id lookup template parameters.
Definition type_lookup_generator.h:67