MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
base_list Class Reference

Inherits Sql_alloc.

Inherited by List< T >, List< Alter_column >, List< Alter_drop >, List< Backpatch_info >, List< Buffered_log >, List< Cached_item >, List< char >, List< Condition_information_item >, List< const char >, List< context >, List< Create_field >, List< Derived_key >, List< Ed_row >, List< extra >, List< Index_hint >, List< int >, List< Item >, List< Item_equal >, List< Item_field >, List< Item_sum >, List< joinable_ctx >, List< Key >, List< Key_part_spec >, List< LEX >, List< LEX_STRING >, List< MockDiagInfoItem >, List< Mrg_child_def >, List< Natural_join_column >, List< NDB_SHARE >, List< Observer_info >, List< opt_explain_json_namespace::context >, List< part_elem_value >, List< partition_element >, List< Parts_share_refs >, List< QUICK_RANGE >, List< QUICK_RANGE_SELECT >, List< QUICK_SELECT_I >, List< SEL_IMERGE >, List< SELECT_LEX_UNIT >, List< Semijoin_mat_exec >, List< sp_condition_value >, List< sp_label >, List< sp_lex_branch_instr >, List< sp_variable >, List< Sql_condition >, List< Statement_information_item >, List< String >, List< subquery_ctx >, List< TABLE >, List< TABLE_LIST >, List< ulonglong >, and List< XML_TAG >.

Collaboration diagram for base_list:

Public Member Functions

bool operator== (const base_list &rhs) const
void empty ()
 base_list (const base_list &tmp)
 base_list (const base_list &rhs, MEM_ROOT *mem_root)
 base_list (bool error)
bool push_back (void *info)
bool push_back (void *info, MEM_ROOT *mem_root)
bool push_front (void *info)
void remove (list_node **prev)
void concat (base_list *list)
void * pop (void)
void disjoin (base_list *list)
void prepand (base_list *list)
void sort (Node_cmp_func cmp, void *arg)
 Sort the list.
void swap (base_list &rhs)
list_nodelast_node ()
list_nodefirst_node ()
void * head ()
void ** head_ref ()
bool is_empty () const
list_nodelast_ref ()

Public Attributes

uint elements

Protected Member Functions

void after (void *info, list_node *node)

Protected Attributes

list_nodefirst
list_node ** last

Friends

class base_list_iterator
class error_list
class error_list_iterator

Additional Inherited Members

- Static Public Member Functions inherited from Sql_alloc
static void * operator new (size_t size) throw ()
static void * operator new[] (size_t size) throw ()
static void * operator new[] (size_t size, MEM_ROOT *mem_root) throw ()
static void * operator new (size_t size, MEM_ROOT *mem_root) throw ()
static void operator delete (void *ptr, size_t size)
static void operator delete (void *ptr, MEM_ROOT *mem_root)
static void operator delete[] (void *ptr, MEM_ROOT *mem_root)
static void operator delete[] (void *ptr, size_t size)

Detailed Description

Definition at line 144 of file sql_list.h.

Constructor & Destructor Documentation

base_list::base_list ( const base_list tmp)
inline

This is a shallow copy constructor that implicitly passes the ownership from the source list to the new instance. The old instance is not updated, so both objects end up sharing the same nodes. If one of the instances then adds or removes a node, the other becomes out of sync ('last' pointer), while still operational. Some old code uses and relies on this behaviour. This logic is quite tricky: please do not use it in any new code.

Definition at line 171 of file sql_list.h.

base_list::base_list ( const base_list rhs,
MEM_ROOT mem_root 
)

Construct a deep copy of the argument in memory root mem_root. The elements themselves are copied by pointer. If you also need to copy elements by value, you should employ list_copy_and_replace_each_value after creating a copy.

Definition at line 38 of file sql_list.cc.

Member Function Documentation

void base_list::sort ( Node_cmp_func  cmp,
void *  arg 
)
inline

Sort the list.

Parameters
cmpnode comparison function
argadditional info to be passed to comparison function

The function sorts list nodes by an exchange sort algorithm. The order of list nodes isn't changed, values of info fields are swapped instead. Due to this, list iterators that are initialized before sort could be safely used after sort, i.e they wouldn't cause a crash. As this isn't an effective algorithm the list to be sorted is supposed to be short.

Definition at line 285 of file sql_list.h.

Here is the caller graph for this function:

void base_list::swap ( base_list rhs)
inline

Swap two lists.

Definition at line 305 of file sql_list.h.


The documentation for this class was generated from the following files: