31#ifndef ETL_INTRUSIVE_STACK_INCLUDED
32#define ETL_INTRUSIVE_STACK_INCLUDED
51 intrusive_stack_exception(string_type reason_, string_type file_name_, numeric_type line_number_)
52 :
exception(reason_, file_name_, line_number_)
61 class intrusive_stack_empty :
public intrusive_stack_exception
65 intrusive_stack_empty(string_type file_name_, numeric_type line_number_)
66 : intrusive_stack_exception(ETL_ERROR_TEXT(
"intrusive_stack:empty", ETL_INTRUSIVE_STACK_FILE_ID
"A"), file_name_, line_number_)
75 class intrusive_stack_value_is_already_linked :
public intrusive_stack_exception
79 intrusive_stack_value_is_already_linked(string_type file_name_, numeric_type line_number_)
80 : intrusive_stack_exception(ETL_ERROR_TEXT(
"intrusive_stack:value is already linked", ETL_INTRUSIVE_STACK_FILE_ID
"B"), file_name_, line_number_)
90 template <
typename TLink>
96 typedef TLink link_type;
106 value.etl_next =
p_top;
120 link_type* p_next =
p_top->etl_next;
131 template <
typename TContainer>
134 link_type* p_link =
p_top;
136 destination.push(*p_link);
145 link_type* current =
p_top;
150 next = current->etl_next;
151 current->etl_next = previous;
219 template <
typename TValue,
typename TLink>
225 typedef typename etl::intrusive_stack_base<TLink>::link_type link_type;
228 typedef TValue value_type;
229 typedef value_type* pointer;
230 typedef const value_type* const_pointer;
231 typedef value_type& reference;
232 typedef const value_type& const_reference;
233 typedef size_t size_type;
250 return *
static_cast<TValue*
>(this->
p_top);
257 const_reference
top()
const
259 return *
static_cast<const TValue*
>(this->
p_top);
Definition intrusive_stack.h:62
Definition intrusive_stack.h:76
ETL_CONSTEXPR exception(string_type reason_, string_type, numeric_type line_)
Constructor.
Definition exception.h:69
Definition exception.h:47
void pop()
Definition intrusive_stack.h:116
size_t size() const
Returns the number of elements.
Definition intrusive_stack.h:183
reference top()
Definition intrusive_stack.h:248
void reverse()
Reverses the stack order.
Definition intrusive_stack.h:142
void clear()
Clears the stack to the empty state.
Definition intrusive_stack.h:162
const_reference top() const
Definition intrusive_stack.h:257
~intrusive_stack_base()
Destructor.
Definition intrusive_stack.h:202
void pop_into(TContainer &destination)
Definition intrusive_stack.h:132
intrusive_stack()
Constructor.
Definition intrusive_stack.h:238
size_t current_size
Definition intrusive_stack.h:209
bool empty() const
Checks if the stack is in the empty state.
Definition intrusive_stack.h:175
link_type * p_top
Definition intrusive_stack.h:206
link_type terminator
Definition intrusive_stack.h:207
void push(link_type &value)
Definition intrusive_stack.h:102
intrusive_stack_base()
Constructor.
Definition intrusive_stack.h:193
Definition intrusive_stack.h:221
Definition intrusive_stack.h:92
bitset_ext
Definition absolute.h:39