MySQL 8.0.40
Source Code Documentation
|
The two-way list base node. More...
#include <ut0lst.h>
Classes | |
class | base_iterator |
class | Removable |
A helper wrapper class for the list, which exposes begin(),end() iterators which let you remove the current item or items after it during the loop, while still having O(1) space and time complexity. More... | |
Public Types | |
using | elem_type = Type |
using | node_type = ut_list_node< elem_type > |
using | iterator = base_iterator< elem_type > |
using | const_iterator = base_iterator< const elem_type > |
Public Member Functions | |
size_t | get_length () const |
Returns number of nodes currently present in the list. More... | |
void | update_length (int diff) |
Updates the length of the list by the amount specified. More... | |
void | clear () |
void | reverse () |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
Removable | removable () |
Returns a wrapper which lets you remove current item or items after it. More... | |
Static Public Member Functions | |
static const node_type & | get_node (const elem_type &e) |
static node_type & | get_node (elem_type &e) |
static const elem_type * | next (const elem_type &e) |
static elem_type * | next (elem_type &e) |
static const elem_type * | prev (const elem_type &e) |
static elem_type * | prev (elem_type &e) |
Public Attributes | |
elem_type * | first_element {nullptr} |
Pointer to list start, NULL if empty. More... | |
elem_type * | last_element {nullptr} |
Pointer to list end, NULL if empty. More... | |
ulint | init {UT_LIST_INITIALISED} |
UT_LIST_INITIALISED if the list was initialised with the constructor. More... | |
Private Attributes | |
std::atomic< size_t > | count {0} |
Number of nodes in list. More... | |
The two-way list base node.
The base node contains pointers to both ends of the list and a count of nodes in the list (excluding the base node from the count). We also store a pointer to the member field so that it doesn't have to be specified when doing list operations.
Type | the type of the list element |
NodeGetter | a class which has a static member ut_list_node<Type> get_node(const Type & e) which knows how to extract a node from an element |
using ut_list_base< Type, NodeGetter >::const_iterator = base_iterator<const elem_type> |
using ut_list_base< Type, NodeGetter >::elem_type = Type |
using ut_list_base< Type, NodeGetter >::iterator = base_iterator<elem_type> |
using ut_list_base< Type, NodeGetter >::node_type = ut_list_node<elem_type> |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Returns number of nodes currently present in the list.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inline |
Returns a wrapper which lets you remove current item or items after it.
It can be used like in this example: for (auto lock : table->locks.removable()) { lock_remove_all_on_table_for_trx(table, lock->trx,..); } Or in general: for (auto item : list.removable()) { remove_items_which_are_similar_to(item); } Basically you can remove any item, except for prev(item).
You can also insert to the list during iteration, keeping in mind that the position you insert the element at has following impact:
|
inline |
|
inline |
Updates the length of the list by the amount specified.
diff | the value by which to increase the length. Can be negative. |
|
private |
Number of nodes in list.
It is atomic to allow unprotected reads. Writes must be protected by some external latch.
elem_type* ut_list_base< Type, NodeGetter >::first_element {nullptr} |
Pointer to list start, NULL if empty.
ulint ut_list_base< Type, NodeGetter >::init {UT_LIST_INITIALISED} |
UT_LIST_INITIALISED if the list was initialised with the constructor.
It is used to detect if the ut_list_base object is used directly after allocating memory from malloc-like calls that do not run constructor.
elem_type* ut_list_base< Type, NodeGetter >::last_element {nullptr} |
Pointer to list end, NULL if empty.