MySQL 8.0.40
Source Code Documentation
dd::Collection< T > Class Template Reference

#include <collection.h>

Classes

class  Collection_const_iterator
 
class  Collection_iterator
 

Public Types

typedef T value_type
 
typedef std::remove_pointer< T >::type abstract_type
 
typedef abstract_type::Impl impl_type
 
typedef std::vector< impl_type * > Array
 
typedef Collection_iterator iterator
 
typedef Collection_const_iterator const_iterator
 

Public Member Functions

 Collection ()=default
 
 ~Collection ()
 
void clear_removed_items ()
 Remove elements from m_removed_items. More...
 
 Collection (const Collection &)=delete
 
void operator= (Collection &)=delete
 
void push_back (impl_type *item)
 
void push_front (impl_type *item)
 
void insert (iterator it, impl_type *item)
 
void remove (impl_type *item)
 
void remove_all ()
 Remove all items and move it to m_removed_items items. More...
 
iterator find (const impl_type *item)
 Find item and return the position. More...
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
bool empty () const
 
bool has_removed_items () const
 Check if some of collection elements are removed. More...
 
size_t size () const
 
const abstract_typeat (size_t n) const
 
at (size_t n)
 
const abstract_typefront () const
 
front ()
 
const abstract_typeback () const
 
back ()
 
const abstract_typeoperator[] (size_t n) const
 
operator[] (size_t n)
 
template<typename Parent_item >
bool restore_items (Parent_item *parent, Open_dictionary_tables_ctx *otx, Raw_table *table, Object_key *key)
 Populate collection with items read from DD table. More...
 
template<typename Parent_item , typename Compare >
bool restore_items (Parent_item *parent, Open_dictionary_tables_ctx *otx, Raw_table *table, Object_key *key, Compare comp)
 Populate collection with items read from DD table. More...
 
bool store_items (Open_dictionary_tables_ctx *otx)
 store items in collection on to DD table. More...
 
bool drop_items (Open_dictionary_tables_ctx *otx, Raw_table *table, Object_key *key) const
 Remove all items details from DD table. More...
 
template<typename Parent_item >
void deep_copy (const Collection< T > &src, Parent_item *parent)
 Do a deep copy of a given collection. More...
 

Private Member Functions

void clear_all_items ()
 
void renumerate_items ()
 

Private Attributes

Array m_items
 
Array m_removed_items
 

Member Typedef Documentation

◆ abstract_type

template<typename T >
typedef std::remove_pointer<T>::type dd::Collection< T >::abstract_type

◆ Array

template<typename T >
typedef std::vector<impl_type *> dd::Collection< T >::Array

◆ const_iterator

template<typename T >
typedef Collection_const_iterator dd::Collection< T >::const_iterator

◆ impl_type

template<typename T >
typedef abstract_type::Impl dd::Collection< T >::impl_type

◆ iterator

template<typename T >
typedef Collection_iterator dd::Collection< T >::iterator

◆ value_type

template<typename T >
typedef T dd::Collection< T >::value_type

Constructor & Destructor Documentation

◆ Collection() [1/2]

template<typename T >
dd::Collection< T >::Collection ( )
default

◆ ~Collection()

template<typename T >
dd::Collection< T >::~Collection ( )
inline

◆ Collection() [2/2]

template<typename T >
dd::Collection< T >::Collection ( const Collection< T > &  )
delete

Member Function Documentation

◆ at() [1/2]

template<typename T >
T dd::Collection< T >::at ( size_t  n)
inline

◆ at() [2/2]

template<typename T >
const Collection< T >::abstract_type * dd::Collection< T >::at ( size_t  n) const

◆ back() [1/2]

template<typename T >
T dd::Collection< T >::back ( )
inline

◆ back() [2/2]

template<typename T >
const abstract_type * dd::Collection< T >::back ( ) const
inline

◆ begin() [1/2]

template<typename T >
iterator dd::Collection< T >::begin ( void  )
inline

◆ begin() [2/2]

template<typename T >
const_iterator dd::Collection< T >::begin ( void  ) const
inline

◆ cbegin()

template<typename T >
const_iterator dd::Collection< T >::cbegin ( ) const
inline

◆ cend()

template<typename T >
const_iterator dd::Collection< T >::cend ( ) const
inline

◆ clear_all_items()

template<typename T >
void dd::Collection< T >::clear_all_items
private

◆ clear_removed_items()

template<typename T >
void dd::Collection< T >::clear_removed_items

Remove elements from m_removed_items.

This is used only in case of dropping triggers for now. See comments in Table_impl::store_children() for more details.

◆ deep_copy()

template<typename T >
template<typename Parent_item >
void dd::Collection< T >::deep_copy ( const Collection< T > &  src,
Parent_item *  parent 
)

Do a deep copy of a given collection.

Calls clone() on the items in the given collection and stores the result in this collection.

Parameters
src- Collection to do a deep copy of.
parent- Object "owning" the items in the collection. E.g. Columns are owned by Table.

◆ drop_items()

template<typename T >
bool dd::Collection< T >::drop_items ( Open_dictionary_tables_ctx otx,
Raw_table table,
Object_key key 
) const

Remove all items details from DD table.

Iterate through the collection and remove respective rows from DD tables.

Parameters
otx- Context with information about open tables.
table- The DD table from which rows are removed.
key- The search key to use to find rows.
Returns
true - on failure and error is reported.
false - on success.

◆ empty()

template<typename T >
bool dd::Collection< T >::empty ( ) const
inline

◆ end() [1/2]

template<typename T >
iterator dd::Collection< T >::end ( void  )
inline

◆ end() [2/2]

template<typename T >
const_iterator dd::Collection< T >::end ( void  ) const
inline

◆ find()

template<typename T >
iterator dd::Collection< T >::find ( const impl_type item)

Find item and return the position.

Returns
iterator pointing to found element.

◆ front() [1/2]

template<typename T >
T dd::Collection< T >::front ( )
inline

◆ front() [2/2]

template<typename T >
const abstract_type * dd::Collection< T >::front ( ) const
inline

◆ has_removed_items()

template<typename T >
bool dd::Collection< T >::has_removed_items ( ) const
inline

Check if some of collection elements are removed.

Returns
void.

◆ insert()

template<typename T >
void dd::Collection< T >::insert ( iterator  it,
impl_type item 
)
inline

◆ operator=()

template<typename T >
void dd::Collection< T >::operator= ( Collection< T > &  )
delete

◆ operator[]() [1/2]

template<typename T >
T dd::Collection< T >::operator[] ( size_t  n)
inline

◆ operator[]() [2/2]

template<typename T >
const abstract_type * dd::Collection< T >::operator[] ( size_t  n) const
inline

◆ push_back()

template<typename T >
void dd::Collection< T >::push_back ( impl_type item)
inline

◆ push_front()

template<typename T >
void dd::Collection< T >::push_front ( impl_type item)
inline

◆ remove()

template<typename T >
void dd::Collection< T >::remove ( impl_type item)

◆ remove_all()

template<typename T >
void dd::Collection< T >::remove_all ( )
inline

Remove all items and move it to m_removed_items items.

◆ renumerate_items()

template<typename T >
void dd::Collection< T >::renumerate_items ( )
inlineprivate

◆ restore_items() [1/2]

template<typename T >
template<typename Parent_item >
bool dd::Collection< T >::restore_items ( Parent_item *  parent,
Open_dictionary_tables_ctx otx,
Raw_table table,
Object_key key 
)

Populate collection with items read from DD table.

Iterate through DD tables to find rows that match the 'Object_key' supplied. Create collection item for each row we find and populate the item with data read from DD. Sort items in collection by their ordinal position property.

Parameters
parent- Object owning the restored object.
otx- Context with information about open tables.
table- The DD table from which read rows for items.
key- The search key to be used to find rows.
Returns
true - on failure and error is reported.
false - on success.

◆ restore_items() [2/2]

template<typename T >
template<typename Parent_item , typename Compare >
bool dd::Collection< T >::restore_items ( Parent_item *  parent,
Open_dictionary_tables_ctx otx,
Raw_table table,
Object_key key,
Compare  comp 
)

Populate collection with items read from DD table.

Iterate through DD tables to find rows that match the 'Object_key' supplied. Create collection item for each row we find and populate the item with data read from DD. Sort items in collection using comparator provided.

Parameters
parentObject owning the restored object.
otxContext with information about open tables.
tableThe DD table from which read rows for items.
keyThe search key to be used to find rows.
compComparator to be used for sorting items.
Return values
Trueon failure and error is reported.
Falseon success.

◆ size()

template<typename T >
size_t dd::Collection< T >::size ( ) const
inline

◆ store_items()

template<typename T >
bool dd::Collection< T >::store_items ( Open_dictionary_tables_ctx otx)

store items in collection on to DD table.

Iterate through collection and stores them in DD tables.

Parameters
otx- Context with information about open tables.
Returns
true - on failure and error is reported.
false - on success.

Member Data Documentation

◆ m_items

template<typename T >
Array dd::Collection< T >::m_items
private

◆ m_removed_items

template<typename T >
Array dd::Collection< T >::m_removed_items
private

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