25#ifndef _table_column_iterator_h
26#define _table_column_iterator_h
108template <
typename ExclusionFilter = std::function<
bool(TABLE const *,
size_t)>>
134 template <
typename U = ExclusionFilter>
137 typename std::enable_if<std::is_same<
138 U, std::function<
bool(
TABLE const *,
size_t)>>::value>::
type * =
149 template <
typename U = ExclusionFilter>
152 typename std::enable_if<std::is_same<
153 U, std::function<
bool(
TABLE const *,
size_t)>>::value>::
type * =
250 long translation_offset);
470 typename std::enable_if<std::is_same<
471 U, std::function<
bool(
TABLE const *,
size_t)>>::value>::
type *)
481 typename std::enable_if<std::is_same<
482 U, std::function<
bool(
TABLE const *,
size_t)>>::value>::
type *)
496 F filtering_predicate,
525 if (this->
m_table ==
nullptr)
return 0;
567 if (this->
m_table ==
nullptr)
return (*
this);
568 if (source.
bitmap ==
nullptr)
return (*
this);
572 for (
auto it =
begin(); it !=
end(); ++it) {
573 size_t source_pos = it.translated_pos();
574 size_t abs_pos = it.absolute_pos();
575 if (source_pos >=
source.n_bits)
break;
594 for (
auto it =
begin(); it !=
end(); ++it) {
595 size_t abs_pos = it.absolute_pos();
596 if (abs_pos == orig_pos)
return it.translated_pos();
603 if (this->
m_table ==
nullptr)
return (*
this);
615 for (
auto fld = this->
m_table->
vfield; *fld !=
nullptr; ++fld) {
616 auto idx = (*fld)->field_index();
643 long absolute_pos,
long filtered_pos)
645 m_absolute_pos{absolute_pos},
646 m_filtered_pos{filtered_pos},
647 m_translation_offset{0} {}
651 long absolute_pos,
long filtered_pos,
652 long translation_offset)
654 m_absolute_pos{absolute_pos},
655 m_filtered_pos{filtered_pos},
656 m_translation_offset{translation_offset} {}
677 if (this->m_parent->m_table !=
nullptr &&
678 this->m_absolute_pos !=
679 static_cast<long>(this->m_parent->absolute_size())) {
681 ++this->m_absolute_pos;
682 }
while (this->m_absolute_pos !=
683 static_cast<long>(this->m_parent->absolute_size()) &&
684 this->m_parent->is_excluded(this->m_absolute_pos));
685 ++this->m_filtered_pos;
693 if (this->m_parent->m_table !=
nullptr &&
694 this->m_absolute_pos !=
695 static_cast<long>(this->m_parent->absolute_size())) {
696 return this->m_parent->m_table->field[this->m_absolute_pos];
712 return this->operator*();
725 return !((*this) == rhs);
731 if (this->m_parent->m_table !=
nullptr && this->m_absolute_pos != 0) {
733 --this->m_absolute_pos;
734 }
while (this->m_absolute_pos != 0 &&
735 this->m_parent->is_excluded(this->m_absolute_pos));
736 --this->m_filtered_pos;
751 return static_cast<size_t>(this->m_absolute_pos);
756 return static_cast<size_t>(this->m_filtered_pos);
761 return static_cast<size_t>(this->m_filtered_pos + this->m_translation_offset);
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
Iterator class to allow iterating over the replicatable fields in a TABLE object field set.
Definition: table_column_iterator.h:215
iterator & operator--()
Definition: table_column_iterator.h:730
reference operator*() const
Definition: table_column_iterator.h:692
std::ptrdiff_t difference_type
Definition: table_column_iterator.h:217
long m_filtered_pos
The position, relative to the set of included fields, this instance iterator is pointing to.
Definition: table_column_iterator.h:329
iterator(Table_columns_view &parent, long pos, long col)
Constructor for the iterator.
Definition: table_column_iterator.h:642
bool operator!=(iterator rhs) const
Definition: table_column_iterator.h:723
size_t absolute_pos()
Returns the position this iterator object is pointing to, within the local table field set.
Definition: table_column_iterator.h:750
iterator & operator++()
Definition: table_column_iterator.h:676
bool operator==(iterator rhs) const
Definition: table_column_iterator.h:716
iterator & operator=(const iterator &rhs)
Definition: table_column_iterator.h:665
Table_columns_view const * m_parent
A reference to the instance we wish to iterate over.
Definition: table_column_iterator.h:319
long m_translation_offset
Translation unit used on top of the iterator filtered position, so we can adjust the position to anot...
Definition: table_column_iterator.h:339
std::bidirectional_iterator_tag iterator_category
Definition: table_column_iterator.h:221
pointer operator->() const
Definition: table_column_iterator.h:711
size_t translated_pos()
Returns the position this iterator object is pointing to, within the replicated table field set plus ...
Definition: table_column_iterator.h:760
virtual ~iterator()=default
Default destructor.
long m_absolute_pos
The position, relative to the TABLE object, this instance iterator is pointing to.
Definition: table_column_iterator.h:324
size_t filtered_pos()
Returns the position this iterator relative to the set of table columns which are not excluded by the...
Definition: table_column_iterator.h:755
This template class acts as a container of table columns and encapsulates and abstracts a TABLE objec...
Definition: table_column_iterator.h:109
static constexpr unsigned long VFIELDS_ONLY
Request the view excluding filter to operate TABLE::vfields instead of the full set.
Definition: table_column_iterator.h:124
Table_columns_view(unsigned long options=0, typename std::enable_if< std::is_same< U, std::function< bool(TABLE const *, size_t)> >::value >::type *=nullptr)
Empty constructor, only available when the predicate type is a lambda function.
Definition: table_column_iterator.h:468
MY_BITMAP & get_included_fields_bitmap()
Returns the bitmap for the columns from the local table set that are to be included in the replicated...
Definition: table_column_iterator.h:555
virtual ~Table_columns_view()
Destructor for the class.
Definition: table_column_iterator.h:504
virtual Table_columns_view & set_table(const TABLE *rhs)
Setter which initializes the internal reference to the TABLE object whose field set will be iterated ...
Definition: table_column_iterator.h:510
ExclusionFilter filter_fn_type
Alias for the predicate type, for readability purposes.
Definition: table_column_iterator.h:114
bool is_excluded(size_t index) const
Returns whether or not the field at index is to be excluded from the field set iteration process.
Definition: table_column_iterator.h:550
virtual iterator end()
Creates an iterator object, pointing at the end of the table field set.
Definition: table_column_iterator.h:542
size_t m_filtered_size
Number of columns to include in iteration.
Definition: table_column_iterator.h:444
virtual iterator begin()
Creates an iterator object, pointing at the beginning of the table field set.
Definition: table_column_iterator.h:535
Table_columns_view & translate_bitmap(MY_BITMAP &source, MY_BITMAP &destination)
Takes a bitmap object, as received from the replication channel and translates it to a bitmap that ma...
Definition: table_column_iterator.h:565
virtual Table_columns_view & set_filter(ExclusionFilter rhs)
Setter which initializes the internal filtering predicate of type ExclusionFilter.
Definition: table_column_iterator.h:517
Table_columns_view(Table_columns_view &&rhs)=delete
MY_BITMAP & get_excluded_fields_bitmap()
Returns the bitmap for the columns from the local table set that are to be excluded from the replicat...
Definition: table_column_iterator.h:560
Table_columns_view(ExclusionFilter filtering_predicate, unsigned long options=0)
Constructor which takes a predicate used to filter this container iteration.
MY_BITMAP m_included_fields_bitmap
Bitmap that holds the information about which columns from the local table are to be included in the ...
Definition: table_column_iterator.h:449
iterator find_by_absolute_pos(size_t absolute_pos)
Returns the iterator for the (absolute) position in the table.
Definition: table_column_iterator.h:586
TABLE const * m_table
The TABLE object reference which contains the field set to be iterated over.
Definition: table_column_iterator.h:437
size_t translate_position(size_t source)
For the absolute position on the table that equals the given position given as a parameter,...
Definition: table_column_iterator.h:593
Table_columns_view & operator=(Table_columns_view &&rhs)=delete
Table_columns_view & operator=(const Table_columns_view &rhs)=delete
Table_columns_view & init_fields_bitmaps()
Initializes the internal included and excluded fields bitmaps.
Definition: table_column_iterator.h:602
static bool default_filter(TABLE const *table, size_t column_index)
Default filtering predicate.
Definition: table_column_iterator.h:637
size_t absolute_size() const
Computes the total number of fields in the table.
Definition: table_column_iterator.h:524
static constexpr unsigned long DEFAULTS
Default set of options.
Definition: table_column_iterator.h:119
ExclusionFilter m_filtering_predicate
ExclusionFiltering predicate to be invoked when determining if a column is to be included in the iter...
Definition: table_column_iterator.h:442
Table_columns_view(TABLE const *table, ExclusionFilter filtering_predicate, unsigned long options=0)
Constructor which takes the TABLE object whose field set will be iterated and a predicate used to fil...
MY_BITMAP m_excluded_fields_bitmap
Bitmap that holds the information about which columns from the local table are to be excluded from th...
Definition: table_column_iterator.h:454
unsigned long m_options
Set of options to apply to view behaviour.
Definition: table_column_iterator.h:458
size_t filtered_size() const
Computes the total number of fields after filtering.
Definition: table_column_iterator.h:530
Table_columns_view(const Table_columns_view &rhs)=delete
int field_index(const char *field_name)
Definition: rules_table_service.cc:152
static void bitmap_set_all(MY_BITMAP *map)
Definition: my_bitmap.h:128
static bool bitmap_is_set(const MY_BITMAP *map, uint bit)
Definition: my_bitmap.h:95
bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits)
Definition: my_bitmap.cc:140
static void bitmap_clear_bit(MY_BITMAP *map, uint bit)
Definition: my_bitmap.h:90
void bitmap_free(MY_BITMAP *map)
Definition: my_bitmap.cc:158
static void bitmap_set_bit(MY_BITMAP *map, uint bit)
Definition: my_bitmap.h:80
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Container::const_iterator find_if(const Container &c, Find_if &&find_if)
Definition: generic.h:54
const char * begin(const char *const c)
Definition: base64.h:44
Definition: options.cc:57
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
repeated Source source
Definition: replication_asynchronous_connection_failover.proto:42
required string type
Definition: replication_group_member_actions.proto:34
Definition: my_bitmap.h:43
my_bitmap_map * bitmap
Definition: my_bitmap.h:44
uint fields
Definition: table.h:846
Field ** vfield
Pointer to generated columns.
Definition: table.h:1509
TABLE_SHARE * s
Definition: table.h:1407