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_)
91 template <
typename TLink>
97 typedef TLink link_type;
107 value.etl_next =
p_top;
121 link_type* p_next =
p_top->etl_next;
133 template <
typename TContainer>
136 link_type* p_link =
p_top;
138 destination.push(*p_link);
147 link_type* current =
p_top;
152 next = current->etl_next;
153 current->etl_next = previous;
220 template <
typename TValue,
typename TLink>
226 typedef typename etl::intrusive_stack_base<TLink>::link_type link_type;
229 typedef TValue value_type;
230 typedef value_type* pointer;
231 typedef const value_type* const_pointer;
232 typedef value_type& reference;
233 typedef const value_type& const_reference;
234 typedef size_t size_type;
253 return *
static_cast<TValue*
>(this->
p_top);
262 const_reference
top()
const
265 return *
static_cast<const TValue*
>(this->
p_top);
Definition intrusive_stack.h:62
Definition intrusive_stack.h:76
ETL_EXCEPTION_CONSTEXPR exception(string_type reason_, string_type, numeric_type)
Constructor.
Definition exception.h:81
Definition exception.h:59
void pop()
Definition intrusive_stack.h:117
size_t size() const
Returns the number of elements.
Definition intrusive_stack.h:185
reference top()
Definition intrusive_stack.h:250
void reverse()
Reverses the stack order.
Definition intrusive_stack.h:144
void clear()
Clears the stack to the empty state.
Definition intrusive_stack.h:164
const_reference top() const
Definition intrusive_stack.h:262
~intrusive_stack_base()
Destructor.
Definition intrusive_stack.h:204
void pop_into(TContainer &destination)
Definition intrusive_stack.h:134
intrusive_stack()
Constructor.
Definition intrusive_stack.h:239
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:177
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:103
intrusive_stack_base()
Constructor.
Definition intrusive_stack.h:195
Definition intrusive_stack.h:222
Definition intrusive_stack.h:93
bitset_ext
Definition absolute.h:40