MarlinMT
0.1.0
|
Contains references to entries. More...
#include <Selection.h>
Public Types | |
enum | ComposeStrategy { ComposeStrategy::AND, ComposeStrategy::ONLY_CHILD, ComposeStrategy::ONLY_PARENT } |
Possibilities to compose Conditions when creating sub selections. More... | |
using | const_iterator = typename std::vector< WeakEntry >::const_iterator |
random access const_iterator for Selections. More... | |
Public Member Functions | |
Selection ()=default | |
default constructor. Construct empty selection. More... | |
Selection (const Selection &)=delete | |
Selection & | operator= (const Selection &)=delete |
Selection (Selection &&)=default | |
move constructor. Default More... | |
Selection & | operator= (Selection &&)=default |
~Selection ()=default | |
Selection (const Selection &sel, const Condition &cond, ComposeStrategy strategy=ComposeStrategy::AND) | |
construct sub selection. More... | |
const Condition & | condition () const |
getter for Condition which every Entry full fill. More... | |
const_iterator | begin () const |
begin iterator to iterate through entries. More... | |
const_iterator | end () const |
end iterator for entries. First not valid iterator. More... | |
std::size_t | size () const |
Selection | find (const Condition &cond, ComposeStrategy strategy=ComposeStrategy::AND) |
construct sub selection. More... | |
const WeakEntry & | get (std::size_t i) |
get WeakEntry at position. More... | |
void | remove (std::size_t i) |
remove entry at position. More... | |
void | remove (std::size_t i, std::size_t n) |
remove entry range. More... | |
void | remove (const const_iterator &itr) |
remove entry. More... | |
void | remove (const const_iterator &begin, const const_iterator &end) |
remove entry range. More... | |
Static Public Member Functions | |
template<typename T > | |
static Selection | find (T begin, T end, const Condition &cond) |
Construct Selection from range of Entries. More... | |
template<typename T > | |
static WeakEntry | findFirst (T begin, T end, const Condition &cond) |
Search for first Entry which matches condition. More... | |
Private Attributes | |
std::vector< WeakEntry > | _entries {} |
entries which included in selection. More... | |
Condition | _condition {} |
condition which every entry fulfill. More... | |
Contains references to entries.
Which satisfy the condition. Used to doing action on a range of entries.
Definition at line 75 of file Selection.h.
using marlinmt::book::Selection::const_iterator = typename std::vector< WeakEntry >::const_iterator |
random access const_iterator for Selections.
Definition at line 100 of file Selection.h.
|
strong |
Possibilities to compose Conditions when creating sub selections.
Composed the new condition with the condition from the super selection.
Enumerator | |
---|---|
AND | |
ONLY_CHILD | |
ONLY_PARENT |
Definition at line 105 of file Selection.h.
|
default |
default constructor. Construct empty selection.
Referenced by find().
|
delete |
|
default |
move constructor. Default
|
default |
marlinmt::book::Selection::Selection | ( | const Selection & | sel, |
const Condition & | cond, | ||
ComposeStrategy | strategy = ComposeStrategy::AND |
||
) |
construct sub selection.
sel | super selection |
cond | condition for promotion in sub selection |
strategy | to compose selection with sub selection condition. |
Definition at line 35 of file Selection.cc.
References _condition, AND, begin(), end(), find(), MARLIN_BOOK_THROW, ONLY_CHILD, and ONLY_PARENT.
Selection::const_iterator marlinmt::book::Selection::begin | ( | ) | const |
begin iterator to iterate through entries.
Definition at line 25 of file Selection.cc.
Referenced by remove(), and Selection().
const Condition & marlinmt::book::Selection::condition | ( | ) | const |
getter for Condition which every Entry full fill.
Definition at line 22 of file Selection.cc.
Selection::const_iterator marlinmt::book::Selection::end | ( | ) | const |
end iterator for entries. First not valid iterator.
Definition at line 29 of file Selection.cc.
Referenced by remove(), and Selection().
|
static |
Construct Selection from range of Entries.
begin,end | range of Entries |
cond | Condition to filter Entries. |
T | iterator type |
Definition at line 191 of file Selection.h.
References _condition, marlinmt::book::WeakEntry::key(), and marlinmt::book::WeakEntry::valid().
Referenced by Selection(), and marlinmt::book::BookStore::storeList().
Selection marlinmt::book::Selection::find | ( | const Condition & | cond, |
ComposeStrategy | strategy = ComposeStrategy::AND |
||
) |
construct sub selection.
cond | condition for promotion in sub selection. |
strategy | to compos selection with sub selection condition. |
Definition at line 54 of file Selection.cc.
References Selection().
|
static |
Search for first Entry which matches condition.
begin,end | range of Entries. |
cond | Condition to search. |
T | iterator type |
Definition at line 213 of file Selection.h.
References marlinmt::book::WeakEntry::WeakEntry().
|
inline |
get WeakEntry at position.
i | position of entry of interest. |
Definition at line 152 of file Selection.h.
void marlinmt::book::Selection::remove | ( | std::size_t | i | ) |
remove entry at position.
i | position of entry to remove. |
Definition at line 61 of file Selection.cc.
References _entries.
void marlinmt::book::Selection::remove | ( | std::size_t | i, |
std::size_t | n | ||
) |
remove entry range.
i | position of first entry to remove. |
n | number of entries to remove. |
Definition at line 67 of file Selection.cc.
References _entries.
void marlinmt::book::Selection::remove | ( | const const_iterator & | itr | ) |
remove entry.
itr | iterator from entry which should be removed. |
Definition at line 74 of file Selection.cc.
References _entries.
void marlinmt::book::Selection::remove | ( | const const_iterator & | begin, |
const const_iterator & | end | ||
) |
remove entry range.
remove entries from begin to end, including begin, excluding end.
begin | first entry which should be removed. |
end | first entry which should not be removed. |
Definition at line 80 of file Selection.cc.
References _entries, begin(), end(), and marlinmt::book::Selection::find< Selection::const_iterator >().
std::size_t marlinmt::book::Selection::size | ( | ) | const |
Definition at line 33 of file Selection.cc.
|
private |
condition which every entry fulfill.
Definition at line 185 of file Selection.h.
Referenced by find(), and Selection().
|
private |
entries which included in selection.
Definition at line 183 of file Selection.h.
Referenced by remove().