31#ifndef ETL_STACK_INCLUDED
32#define ETL_STACK_INCLUDED
66 stack_exception(string_type reason_, string_type file_name_, numeric_type line_number_)
67 :
exception(reason_, file_name_, line_number_)
80 stack_full(string_type file_name_, numeric_type line_number_)
81 :
stack_exception(ETL_ERROR_TEXT(
"stack:full", ETL_STACK_FILE_ID
"A"), file_name_, line_number_)
94 stack_empty(string_type file_name_, numeric_type line_number_)
95 :
stack_exception(ETL_ERROR_TEXT(
"stack:empty", ETL_STACK_FILE_ID
"B"), file_name_, line_number_)
179 ETL_INCREMENT_DEBUG_COUNT
189 ETL_DECREMENT_DEBUG_COUNT
199 ETL_RESET_DEBUG_COUNT
205 ETL_DECLARE_DEBUG_COUNT
219 template <
typename T>
228 typedef T&& rvalue_reference;
256#if defined(ETL_CHECK_PUSH_POP)
269 void push(rvalue_reference value)
271#if defined(ETL_CHECK_PUSH_POP)
275 ::new (&p_buffer[
top_index]) T(etl::move(value));
279#if ETL_USING_CPP11 && ETL_NOT_USING_STLPORT
285 template <
typename ... Args>
288#if defined(ETL_CHECK_PUSH_POP)
292 ::new (&p_buffer[
top_index]) T(etl::forward<Args>(args)...);
300 template <
typename T1>
303#if defined(ETL_CHECK_PUSH_POP)
315 template <
typename T1,
typename T2>
316 void emplace(
const T1& value1,
const T2& value2)
318#if defined(ETL_CHECK_PUSH_POP)
322 ::new (&p_buffer[
top_index]) T(value1, value2);
330 template <
typename T1,
typename T2,
typename T3>
331 void emplace(
const T1& value1,
const T2& value2,
const T3& value3)
333#if defined(ETL_CHECK_PUSH_POP)
337 ::new (&p_buffer[
top_index]) T(value1, value2, value3);
345 template <
typename T1,
typename T2,
typename T3,
typename T4>
346 void emplace(
const T1& value1,
const T2& value2,
const T3& value3,
const T4& value4)
348#if defined(ETL_CHECK_PUSH_POP)
352 ::new (&p_buffer[
top_index]) T(value1, value2, value3, value4);
389#if defined(ETL_CHECK_PUSH_POP)
401 destination = ETL_MOVE(
top());
410 template <
typename TContainer>
413 destination.push(ETL_MOVE(
top()));
447 clone(etl::move(rhs));
465 for (
size_t i = 0UL; i < other.
size(); ++i)
467 push(other.p_buffer[index++]);
481 for (
size_t i = 0UL; i < other.size(); ++i)
483 push(etl::move(other.p_buffer[index++]));
507#if defined(ETL_POLYMORPHIC_STACK) || defined(ETL_POLYMORPHIC_CONTAINERS)
527 template <
typename T, const
size_t SIZE>
533 static ETL_CONSTANT
size_t MAX_SIZE = SIZE;
539 :
etl::
istack<T>(reinterpret_cast<T*>(&buffer[0]), SIZE)
547 :
etl::
istack<T>(reinterpret_cast<T*>(&buffer[0]), SIZE)
557 :
etl::
istack<T>(reinterpret_cast<T*>(&buffer[0]), SIZE)
602 container_type buffer[SIZE];
605 template <
typename T, const
size_t SIZE>
606 ETL_CONSTANT
size_t stack<T, SIZE>::MAX_SIZE;
Definition: alignment.h:221
#define ETL_ASSERT(b, e)
Definition: error_handler.h:316
ETL_CONSTEXPR exception(string_type reason_, string_type, numeric_type line_)
Constructor.
Definition: exception.h:69
Definition: exception.h:47
void del_out()
Decrements the indexes value to record a queue deletion.
Definition: stack.h:185
stack & operator=(const stack &rhs)
Assignment operator.
Definition: stack.h:574
reference top()
Definition: stack.h:244
bool empty() const
Definition: stack.h:115
~stack_base()
Destructor.
Definition: stack.h:169
stack()
Default constructor.
Definition: stack.h:538
stack_base(size_type max_size_)
The constructor that is called from derived classes.
Definition: stack.h:159
bool full() const
Definition: stack.h:124
const T * const_pointer
A const pointer to the type used in the stack.
Definition: stack.h:231
const size_type CAPACITY
The maximum number of items in the stack.
Definition: stack.h:204
void emplace(const T1 &value1, const T2 &value2, const T3 &value3, const T4 &value4)
Definition: stack.h:346
void index_clear()
Clears all of the indexes.
Definition: stack.h:195
size_type size() const
Returns the current number of items top the stack.
Definition: stack.h:132
istack(T *p_buffer_, size_type max_size_)
The constructor that is called from derived classes.
Definition: stack.h:491
size_type max_size() const
Returns the maximum number of items that can be stacked.
Definition: stack.h:140
size_type current_size
The number of items in the stack.
Definition: stack.h:203
void emplace(const T1 &value1)
Definition: stack.h:301
void emplace(const T1 &value1, const T2 &value2)
Definition: stack.h:316
size_t available() const
Definition: stack.h:149
void push(const_reference value)
Definition: stack.h:254
void pop()
Removes the oldest item from the top of the stack.
Definition: stack.h:387
istack & operator=(const istack &rhs)
Assignment operator.
Definition: stack.h:428
size_type top_index
The index of the top of the stack.
Definition: stack.h:202
size_t size_type
The type used for determining the size of stack.
Definition: stack.h:109
T & reference
A reference to the type used in the stack.
Definition: stack.h:225
void emplace(const T1 &value1, const T2 &value2, const T3 &value3)
Definition: stack.h:331
T * pointer
A pointer to the type used in the stack.
Definition: stack.h:230
~stack()
Destructor.
Definition: stack.h:566
stack(const stack &rhs)
Copy constructor.
Definition: stack.h:546
void pop_into(TContainer &destination)
Definition: stack.h:411
void clone(const istack &other)
Make this a clone of the supplied stack.
Definition: stack.h:459
~istack()
Destructor.
Definition: stack.h:514
void pop_into(reference destination)
Removes the oldest item from the top of the stack and puts it in the destination.
Definition: stack.h:399
const T & const_reference
A const reference to the type used in the stack.
Definition: stack.h:226
void add_in()
Increments the indexes value to record a stack addition.
Definition: stack.h:176
void clear()
Clears the stack to the empty state.
Definition: stack.h:368
stack_base::size_type size_type
The type used for determining the size of the stack.
Definition: stack.h:232
T value_type
The type stored in the stack.
Definition: stack.h:224
void reverse()
Reverses the stack.
Definition: stack.h:420
const_reference top() const
Definition: stack.h:360
This is the base for all stacks that contain a particular type.
Definition: stack.h:221
add_rvalue_reference
Definition: type_traits_generator.h:1327
bitset_ext
Definition: absolute.h:38
Definition: alignment.h:223
Definition: type_traits_generator.h:2055