31 #ifndef ETL_STACK_INCLUDED
32 #define ETL_STACK_INCLUDED
69 stack_exception(string_type reason_, string_type file_name_, numeric_type line_number_)
70 :
exception(reason_, file_name_, line_number_)
83 stack_full(string_type file_name_, numeric_type line_number_)
84 :
stack_exception(ETL_ERROR_TEXT(
"stack:full", ETL_FILE
"A"), file_name_, line_number_)
97 stack_empty(string_type file_name_, numeric_type line_number_)
98 :
stack_exception(ETL_ERROR_TEXT(
"stack:empty", ETL_FILE
"B"), file_name_, line_number_)
182 ETL_INCREMENT_DEBUG_COUNT
192 ETL_DECREMENT_DEBUG_COUNT
202 ETL_RESET_DEBUG_COUNT
208 ETL_DECLARE_DEBUG_COUNT
222 template <
typename T>
230 #if ETL_CPP11_SUPPORTED
231 typedef T&& rvalue_reference;
259 #if defined(ETL_CHECK_PUSH_POP)
266 #if ETL_CPP11_SUPPORTED
272 void push(rvalue_reference value)
274 #if defined(ETL_CHECK_PUSH_POP)
278 ::new (&p_buffer[
top_index]) T(etl::move(value));
282 #if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT
288 template <
typename ... Args>
291 #if defined(ETL_CHECK_PUSH_POP)
295 ::new (&p_buffer[
top_index]) T(etl::forward<Args>(args)...);
303 template <
typename T1>
306 #if defined(ETL_CHECK_PUSH_POP)
318 template <
typename T1,
typename T2>
319 void emplace(
const T1& value1,
const T2& value2)
321 #if defined(ETL_CHECK_PUSH_POP)
325 ::new (&p_buffer[
top_index]) T(value1, value2);
333 template <
typename T1,
typename T2,
typename T3>
334 void emplace(
const T1& value1,
const T2& value2,
const T3& value3)
336 #if defined(ETL_CHECK_PUSH_POP)
340 ::new (&p_buffer[
top_index]) T(value1, value2, value3);
348 template <
typename T1,
typename T2,
typename T3,
typename T4>
349 void emplace(
const T1& value1,
const T2& value2,
const T3& value3,
const T4& value4)
351 #if defined(ETL_CHECK_PUSH_POP)
355 ::new (&p_buffer[
top_index]) T(value1, value2, value3, value4);
392 #if defined(ETL_CHECK_PUSH_POP)
413 template <
typename TContainer>
416 destination.push(
top());
442 #if ETL_CPP11_SUPPORTED
450 clone(etl::move(rhs));
468 for (
size_t i = 0; i < other.
size(); ++i)
470 push(other.p_buffer[index++]);
474 #if ETL_CPP11_SUPPORTED
484 for (
size_t i = 0; i < other.size(); ++i)
486 push(etl::move(other.p_buffer[index++]));
510 #if defined(ETL_POLYMORPHIC_STACK) || defined(ETL_POLYMORPHIC_CONTAINERS)
530 template <
typename T, const
size_t SIZE>
535 static const size_t MAX_SIZE = SIZE;
541 :
etl::
istack<T>(reinterpret_cast<T*>(&buffer[0]), SIZE)
549 :
etl::
istack<T>(reinterpret_cast<T*>(&buffer[0]), SIZE)
554 #if ETL_CPP11_SUPPORTED
559 :
etl::
istack<T>(reinterpret_cast<T*>(&buffer[0]), SIZE)
586 #if ETL_CPP11_SUPPORTED
Definition: alignment.h:116
#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
void del_out()
Decrements the indexes value to record a queue deletion.
Definition: stack.h:188
reference top()
Definition: stack.h:247
bool empty() const
Definition: stack.h:118
~stack_base()
Destructor.
Definition: stack.h:172
stack()
Default constructor.
Definition: stack.h:540
stack_base(size_type max_size_)
The constructor that is called from derived classes.
Definition: stack.h:162
bool full() const
Definition: stack.h:127
const T * const_pointer
A const pointer to the type used in the stack.
Definition: stack.h:234
const size_type CAPACITY
The maximum number of items in the stack.
Definition: stack.h:207
void emplace(const T1 &value1, const T2 &value2, const T3 &value3, const T4 &value4)
Definition: stack.h:349
void index_clear()
Clears all of the indexes.
Definition: stack.h:198
size_type size() const
Returns the current number of items top the stack.
Definition: stack.h:135
istack(T *p_buffer_, size_type max_size_)
The constructor that is called from derived classes.
Definition: stack.h:494
size_type max_size() const
Returns the maximum number of items that can be stacked.
Definition: stack.h:143
size_type current_size
The number of items in the stack.
Definition: stack.h:206
void emplace(const T1 &value1)
Definition: stack.h:304
void emplace(const T1 &value1, const T2 &value2)
Definition: stack.h:319
size_t available() const
Definition: stack.h:152
void push(const_reference value)
Definition: stack.h:257
void pop()
Removes the oldest item from the top of the stack.
Definition: stack.h:390
size_type top_index
The index of the top of the stack.
Definition: stack.h:205
size_t size_type
The type used for determining the size of stack.
Definition: stack.h:112
stack & operator=(const stack &rhs)
Assignment operator.
Definition: stack.h:576
istack & operator=(const istack &rhs)
Assignment operator.
Definition: stack.h:431
T & reference
A reference to the type used in the stack.
Definition: stack.h:228
void emplace(const T1 &value1, const T2 &value2, const T3 &value3)
Definition: stack.h:334
T * pointer
A pointer to the type used in the stack.
Definition: stack.h:233
~stack()
Destructor.
Definition: stack.h:568
stack(const stack &rhs)
Copy constructor.
Definition: stack.h:548
void pop_into(TContainer &destination)
Definition: stack.h:414
void clone(const istack &other)
Make this a clone of the supplied stack.
Definition: stack.h:462
~istack()
Destructor.
Definition: stack.h:517
void pop_into(reference destination)
Removes the oldest item from the top of the stack and puts it in the destination.
Definition: stack.h:402
const T & const_reference
A const reference to the type used in the stack.
Definition: stack.h:229
void add_in()
Increments the indexes value to record a stack addition.
Definition: stack.h:179
void clear()
Clears the stack to the empty state.
Definition: stack.h:371
stack_base::size_type size_type
The type used for determining the size of the stack.
Definition: stack.h:235
T value_type
The type stored in the stack.
Definition: stack.h:227
void reverse()
Reverses the stack.
Definition: stack.h:423
const_reference top() const
Definition: stack.h:363
This is the base for all stacks that contain a particular type.
Definition: stack.h:224
add_rvalue_reference
Definition: type_traits_generator.h:1348
is_trivially_destructible
Definition: type_traits_generator.h:1171
Definition: absolute.h:37