MarlinMT  0.1.0
marlinmt::book::Selection Class Reference

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
 
Selectionoperator= (const Selection &)=delete
 
 Selection (Selection &&)=default
 move constructor. Default More...
 
Selectionoperator= (Selection &&)=default
 
 ~Selection ()=default
 
 Selection (const Selection &sel, const Condition &cond, ComposeStrategy strategy=ComposeStrategy::AND)
 construct sub selection. More...
 
const Conditioncondition () 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 WeakEntryget (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...
 

Detailed Description

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.

Member Typedef Documentation

◆ const_iterator

random access const_iterator for Selections.

Definition at line 100 of file Selection.h.

Member Enumeration Documentation

◆ ComposeStrategy

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.

Constructor & Destructor Documentation

◆ Selection() [1/4]

marlinmt::book::Selection::Selection ( )
default

default constructor. Construct empty selection.

Referenced by find().

◆ Selection() [2/4]

marlinmt::book::Selection::Selection ( const Selection )
delete

◆ Selection() [3/4]

marlinmt::book::Selection::Selection ( Selection &&  )
default

move constructor. Default

◆ ~Selection()

marlinmt::book::Selection::~Selection ( )
default

◆ Selection() [4/4]

marlinmt::book::Selection::Selection ( const Selection sel,
const Condition cond,
ComposeStrategy  strategy = ComposeStrategy::AND 
)

construct sub selection.

Parameters
selsuper selection
condcondition for promotion in sub selection
strategyto 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.

Member Function Documentation

◆ begin()

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().

◆ condition()

const Condition & marlinmt::book::Selection::condition ( ) const

getter for Condition which every Entry full fill.

Definition at line 22 of file Selection.cc.

◆ end()

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().

◆ find() [1/2]

template<typename T >
Selection marlinmt::book::Selection::find ( begin,
end,
const Condition cond 
)
static

Construct Selection from range of Entries.

Parameters
begin,endrange of Entries
condCondition to filter Entries.
Template Parameters
Titerator 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().

◆ find() [2/2]

Selection marlinmt::book::Selection::find ( const Condition cond,
ComposeStrategy  strategy = ComposeStrategy::AND 
)

construct sub selection.

Parameters
condcondition for promotion in sub selection.
strategyto compos selection with sub selection condition.

Definition at line 54 of file Selection.cc.

References Selection().

◆ findFirst()

template<typename T >
WeakEntry marlinmt::book::Selection::findFirst ( begin,
end,
const Condition cond 
)
static

Search for first Entry which matches condition.

Parameters
begin,endrange of Entries.
condCondition to search.
Template Parameters
Titerator type

Definition at line 213 of file Selection.h.

References marlinmt::book::WeakEntry::WeakEntry().

◆ get()

const WeakEntry& marlinmt::book::Selection::get ( std::size_t  i)
inline

get WeakEntry at position.

Parameters
iposition of entry of interest.

Definition at line 152 of file Selection.h.

◆ operator=() [1/2]

Selection& marlinmt::book::Selection::operator= ( const Selection )
delete

◆ operator=() [2/2]

Selection& marlinmt::book::Selection::operator= ( Selection &&  )
default

◆ remove() [1/4]

void marlinmt::book::Selection::remove ( std::size_t  i)

remove entry at position.

Parameters
iposition of entry to remove.

Definition at line 61 of file Selection.cc.

References _entries.

◆ remove() [2/4]

void marlinmt::book::Selection::remove ( std::size_t  i,
std::size_t  n 
)

remove entry range.

Parameters
iposition of first entry to remove.
nnumber of entries to remove.

Definition at line 67 of file Selection.cc.

References _entries.

◆ remove() [3/4]

void marlinmt::book::Selection::remove ( const const_iterator itr)

remove entry.

Parameters
itriterator from entry which should be removed.

Definition at line 74 of file Selection.cc.

References _entries.

◆ remove() [4/4]

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.

Parameters
beginfirst entry which should be removed.
endfirst 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 >().

◆ size()

std::size_t marlinmt::book::Selection::size ( ) const
Returns
number of entries included in the selection.

Definition at line 33 of file Selection.cc.

Member Data Documentation

◆ _condition

Condition marlinmt::book::Selection::_condition {}
private

condition which every entry fulfill.

Definition at line 185 of file Selection.h.

Referenced by find(), and Selection().

◆ _entries

std::vector< WeakEntry > marlinmt::book::Selection::_entries {}
private

entries which included in selection.

Definition at line 183 of file Selection.h.

Referenced by remove().


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