MySQL 8.3.0
Source Code Documentation
Table_columns_view< ExclusionFilter >::iterator Class Reference

Iterator class to allow iterating over the replicatable fields in a TABLE object field set. More...

#include <table_column_iterator.h>

Public Types

using difference_type = std::ptrdiff_t
 
using value_type = Field *
 
using pointer = Field *
 
using reference = Field *
 
using iterator_category = std::bidirectional_iterator_tag
 

Public Member Functions

 iterator (Table_columns_view &parent, long pos, long col)
 Constructor for the iterator. More...
 
 iterator (Table_columns_view &parent, long pos, long col, long translation_offset)
 Constructor for the iterator. More...
 
 iterator (const iterator &rhs)
 Copy constructor. More...
 
virtual ~iterator ()=default
 Default destructor. More...
 
iteratoroperator= (const iterator &rhs)
 
iteratoroperator++ ()
 
reference operator* () const
 
iterator operator++ (int)
 
pointer operator-> () const
 
bool operator== (iterator rhs) const
 
bool operator!= (iterator rhs) const
 
iteratoroperator-- ()
 
iterator operator-- (int)
 
size_t absolute_pos ()
 Returns the position this iterator object is pointing to, within the local table field set. More...
 
size_t filtered_pos ()
 Returns the position this iterator relative to the set of table columns which are not excluded by the associated filters. More...
 
size_t translated_pos ()
 Returns the position this iterator object is pointing to, within the replicated table field set plus the translation_offset. More...
 

Private Attributes

Table_columns_view const * m_parent
 A reference to the instance we wish to iterate over. More...
 
long m_absolute_pos
 The position, relative to the TABLE object, this instance iterator is pointing to. More...
 
long m_filtered_pos
 The position, relative to the set of included fields, this instance iterator is pointing to. More...
 
long m_translation_offset
 Translation unit used on top of the iterator filtered position, so we can adjust the position to another frame of reference. More...
 

Friends

struct TABLE
 
class Table_columns_view
 

Detailed Description

template<typename ExclusionFilter = std::function<bool(TABLE const *, size_t)>>
class Table_columns_view< ExclusionFilter >::iterator

Iterator class to allow iterating over the replicatable fields in a TABLE object field set.

It implements the bidirectional iterator concept.

In order to fully understand this class implementation, please, check the documentation on the Iterator concept requirements within the C++ standard and the STL definition.

Member Typedef Documentation

◆ difference_type

template<typename ExclusionFilter = std::function<bool(TABLE const *, size_t)>>
using Table_columns_view< ExclusionFilter >::iterator::difference_type = std::ptrdiff_t

◆ iterator_category

template<typename ExclusionFilter = std::function<bool(TABLE const *, size_t)>>
using Table_columns_view< ExclusionFilter >::iterator::iterator_category = std::bidirectional_iterator_tag

◆ pointer

template<typename ExclusionFilter = std::function<bool(TABLE const *, size_t)>>
using Table_columns_view< ExclusionFilter >::iterator::pointer = Field *

◆ reference

template<typename ExclusionFilter = std::function<bool(TABLE const *, size_t)>>
using Table_columns_view< ExclusionFilter >::iterator::reference = Field *

◆ value_type

template<typename ExclusionFilter = std::function<bool(TABLE const *, size_t)>>
using Table_columns_view< ExclusionFilter >::iterator::value_type = Field *

Constructor & Destructor Documentation

◆ iterator() [1/3]

template<typename F >
Table_columns_view< F >::iterator::iterator ( Table_columns_view parent,
long  pos,
long  col 
)
explicit

Constructor for the iterator.

It takes the parent Table_columns_view object and the initial positions for the replicated table and for the local table.

Parameters
parentreference to the target Table_columns_view object.
posinitial replicated table field set position.
colinitial local table field set position.

◆ iterator() [2/3]

template<typename F >
Table_columns_view< F >::iterator::iterator ( Table_columns_view parent,
long  pos,
long  col,
long  translation_offset 
)
explicit

Constructor for the iterator.

It takes the parent Table_columns_view object and the initial positions for the replicated table and for the local table. It also includes a translation factor so we can get the iterated position in relation to a different set of columns.

Note
When this iterator is used in the context of a replica that is applying an event, the translation offset represents the number of extra columns that the event has to the left of other columns, which the table does not have (if any). So, for example, when the event has a GIPK column to the left, and the replica does not have that, then the offset is 1.
Parameters
parentreference to the target Table_columns_view object.
posinitial replicated table field set position.
colinitial local table field set position.
translation_offsetthe translation offset for translated_pos()

◆ iterator() [3/3]

template<typename F >
Table_columns_view< F >::iterator::iterator ( const iterator rhs)

Copy constructor.

Parameters
rhsobject instance we pretend to copy from.

◆ ~iterator()

template<typename ExclusionFilter = std::function<bool(TABLE const *, size_t)>>
virtual Table_columns_view< ExclusionFilter >::iterator::~iterator ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ absolute_pos()

template<typename F >
size_t Table_columns_view< F >::iterator::absolute_pos

Returns the position this iterator object is pointing to, within the local table field set.

Returns
the position this object is pointing to, within the local table field set.

◆ filtered_pos()

template<typename F >
size_t Table_columns_view< F >::iterator::filtered_pos

Returns the position this iterator relative to the set of table columns which are not excluded by the associated filters.

Returns
the position this object is pointing to considering the non filtered columns

◆ operator!=()

template<typename ExclusionFilter = std::function<bool(TABLE const *, size_t)>>
bool Table_columns_view< F >::iterator::operator!= ( iterator  rhs) const

◆ operator*()

template<typename F >
Table_columns_view< F >::iterator::reference Table_columns_view< F >::iterator::operator*

◆ operator++() [1/2]

template<typename F >
Table_columns_view< F >::iterator & Table_columns_view< F >::iterator::operator++

◆ operator++() [2/2]

template<typename F >
Table_columns_view< F >::iterator Table_columns_view< F >::iterator::operator++ ( int  )

◆ operator--() [1/2]

template<typename F >
Table_columns_view< F >::iterator & Table_columns_view< F >::iterator::operator--

◆ operator--() [2/2]

template<typename F >
Table_columns_view< F >::iterator Table_columns_view< F >::iterator::operator-- ( int  )

◆ operator->()

template<typename F >
Table_columns_view< F >::iterator::pointer Table_columns_view< F >::iterator::operator->

◆ operator=()

template<typename ExclusionFilter = std::function<bool(TABLE const *, size_t)>>
Table_columns_view< F >::iterator & Table_columns_view< F >::iterator::operator= ( const iterator rhs)

◆ operator==()

template<typename ExclusionFilter = std::function<bool(TABLE const *, size_t)>>
bool Table_columns_view< F >::iterator::operator== ( iterator  rhs) const

◆ translated_pos()

template<typename F >
size_t Table_columns_view< F >::iterator::translated_pos

Returns the position this iterator object is pointing to, within the replicated table field set plus the translation_offset.

Note
When this iterator is used in the context of a replica that is applying an event, use translated_pos to get the position within the event."
Returns
the position this object is pointing to, within the replicated table field set adjusted to another frame of reference.

Friends And Related Function Documentation

◆ TABLE

template<typename ExclusionFilter = std::function<bool(TABLE const *, size_t)>>
friend struct TABLE
friend

◆ Table_columns_view

template<typename ExclusionFilter = std::function<bool(TABLE const *, size_t)>>
friend class Table_columns_view
friend

Member Data Documentation

◆ m_absolute_pos

template<typename ExclusionFilter = std::function<bool(TABLE const *, size_t)>>
long Table_columns_view< ExclusionFilter >::iterator::m_absolute_pos
private

The position, relative to the TABLE object, this instance iterator is pointing to.

◆ m_filtered_pos

template<typename ExclusionFilter = std::function<bool(TABLE const *, size_t)>>
long Table_columns_view< ExclusionFilter >::iterator::m_filtered_pos
private

The position, relative to the set of included fields, this instance iterator is pointing to.

◆ m_parent

template<typename ExclusionFilter = std::function<bool(TABLE const *, size_t)>>
Table_columns_view const* Table_columns_view< ExclusionFilter >::iterator::m_parent
private

A reference to the instance we wish to iterate over.

◆ m_translation_offset

template<typename ExclusionFilter = std::function<bool(TABLE const *, size_t)>>
long Table_columns_view< ExclusionFilter >::iterator::m_translation_offset
private

Translation unit used on top of the iterator filtered position, so we can adjust the position to another frame of reference.

When this iterator is used in the context of a replica that is applying an event, use translated_pos to get the position within the event. This number should be set to N when the event has N extra columns to the left, which do not exist in the replica table.


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