|
BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
|
List with Efficient Lookup. More...
#include <fastlist.h>

Public Types | |
| using | FastListIterator = typename std::list< T >::iterator |
| for ease of reading | |
| using | FastListConstIterator = typename std::list< T >::const_iterator |
| using | FastMapIterator = typename std::multimap< std::string, FastListIterator >::iterator |
| using | FastMapConstIterator = typename std::multimap< std::string, FastListIterator >::const_iterator |
| using | FastMapIteratorPair = std::pair< FastMapIterator, FastMapIterator > |
| using | FastMapConstIteratorPair = std::pair< FastMapConstIterator, FastMapConstIterator > |
Public Member Functions | |
| void | insert_before (const std::string &name, const T &val) |
| void | push_back (const T &el, bool unique=false, const std::string &objectName="element") |
| bool | empty () const |
| Whether the list is empty. | |
| int | size () const |
| size of list | |
| void | clear () |
| empty lists | |
| std::vector< T > | getVector () const |
| Get a vector version of this list. | |
| std::map< std::string, T > | getMap () const |
| Get a map of name to object of this list. | |
| FastMapIteratorPair | equal_range (std::string name) |
| FastMapConstIteratorPair | equal_range (std::string name) const |
| void | print (int ident=0) const |
| print method | |
| template<typename FastListInputIterator > | |
| FastListIterator | insert (FastListInputIterator position, const T &val) |
| template definitions need to be in header | |
| template<typename FastListInputIterator > | |
| void | insert (FastListConstIterator position, FastListInputIterator first, const FastListInputIterator last) |
| template definitions need to be in header | |
| void | erase () |
| erase elements | |
| FastListConstIterator | erase (const FastListConstIterator position) |
| erase elements | |
| FastListConstIterator | erase (const FastListConstIterator first, const FastListConstIterator last) |
| erase elements | |
| FastListIterator | begin () |
| FastListIterator | end () |
| FastListConstIterator | begin () const |
| FastListConstIterator | end () const |
| FastListConstIterator | find (std::string name, unsigned int count=1) const |
| FastListIterator | find (std::string name, unsigned int count=1) |
Private Attributes | |
| std::list< T > | itsList |
| std::multimap< std::string, FastListIterator > | itsMap |
| multimap for name lookup | |
List with Efficient Lookup.
This class keeps a list of elements It has efficient lookup on an element's name (log n) by having a multimap between name and list position
Used for beamline
Definition at line 41 of file fastlist.h.
| using GMAD::FastList< T >::FastListConstIterator = typename std::list<T>::const_iterator |
Definition at line 46 of file fastlist.h.
| using GMAD::FastList< T >::FastListIterator = typename std::list<T>::iterator |
for ease of reading
Definition at line 45 of file fastlist.h.
| using GMAD::FastList< T >::FastMapConstIterator = typename std::multimap<std::string, FastListIterator>::const_iterator |
Definition at line 48 of file fastlist.h.
| using GMAD::FastList< T >::FastMapConstIteratorPair = std::pair<FastMapConstIterator,FastMapConstIterator> |
Definition at line 50 of file fastlist.h.
| using GMAD::FastList< T >::FastMapIterator = typename std::multimap<std::string, FastListIterator>::iterator |
Definition at line 47 of file fastlist.h.
| using GMAD::FastList< T >::FastMapIteratorPair = std::pair<FastMapIterator,FastMapIterator> |
Definition at line 49 of file fastlist.h.
| FastList< T >::FastListIterator GMAD::FastList< T >::begin | ( | ) |
non-const begin/end iterator:
Definition at line 217 of file fastlist.h.
Referenced by BDSDetectorConstruction::BuildBeamline(), GMAD::Parser::expand_line(), and GMAD::FastList< T >::getVector().

| FastList< T >::FastListConstIterator GMAD::FastList< T >::begin | ( | ) | const |
const begin/end iterator:
Definition at line 227 of file fastlist.h.
| void GMAD::FastList< T >::clear | ( | ) |
empty lists
Definition at line 171 of file fastlist.h.
Referenced by GMAD::Parser::expand_line().

|
inline |
Whether the list is empty.
Definition at line 67 of file fastlist.h.
References GMAD::FastList< T >::itsList.
Referenced by BDSDetectorConstruction::BuildBeamline(), and BDSDetectorConstruction::BuildPhysicsBias().

| FastList< T >::FastListIterator GMAD::FastList< T >::end | ( | ) |
non-const begin/end iterator:
Definition at line 222 of file fastlist.h.
Referenced by BDSDetectorConstruction::BuildBeamline(), GMAD::Parser::expand_line(), GMAD::Parser::FindAndExtend(), and GMAD::FastList< T >::getVector().

| FastList< T >::FastListConstIterator GMAD::FastList< T >::end | ( | ) | const |
const begin/end iterator:
Definition at line 232 of file fastlist.h.
| FastList< T >::FastMapIteratorPair GMAD::FastList< T >::equal_range | ( | std::string | name | ) |
lookup method, returns pair of iterators of list pointing (similar to std::multimap::equal_range)
Definition at line 237 of file fastlist.h.
| FastList< T >::FastMapConstIteratorPair GMAD::FastList< T >::equal_range | ( | std::string | name | ) | const |
Definition at line 242 of file fastlist.h.
| void GMAD::FastList< T >::erase | ( | ) |
erase elements
Definition at line 177 of file fastlist.h.
Referenced by GMAD::Parser::expand_line(), and GMAD::FastList< T >::find().

| FastList< T >::FastListConstIterator GMAD::FastList< T >::erase | ( | const FastListConstIterator | first, |
| const FastListConstIterator | last | ||
| ) |
erase elements
Definition at line 207 of file fastlist.h.
| FastList< T >::FastListIterator GMAD::FastList< T >::find | ( | std::string | name, |
| unsigned int | count = 1 |
||
| ) |
lookup method, returns iterator of list pointing to element with name second argument is instance number, default first instance both const and non-const version
Definition at line 275 of file fastlist.h.
References GMAD::FastList< T >::erase().

| FastList< T >::FastListConstIterator GMAD::FastList< T >::find | ( | std::string | name, |
| unsigned int | count = 1 |
||
| ) | const |
lookup method, returns iterator of list pointing to element with name second argument is instance number, default first instance both const and non-const version
Definition at line 256 of file fastlist.h.
Referenced by BDSDetectorConstruction::BuildCrossSectionBias(), GMAD::Parser::expand_line(), GMAD::Parser::FindAndExtend(), and GMAD::Parser::get_sequence().

| std::map< std::string, T > GMAD::FastList< T >::getMap | ( | ) | const |
Get a map of name to object of this list.
Definition at line 247 of file fastlist.h.
|
inline |
Get a vector version of this list.
Definition at line 88 of file fastlist.h.
References GMAD::FastList< T >::begin(), and GMAD::FastList< T >::end().

| void GMAD::FastList< T >::insert | ( | FastListConstIterator | position, |
| FastListInputIterator | first, | ||
| const FastListInputIterator | last | ||
| ) |
template definitions need to be in header
insert options (classic list inserts): inputiterator templated to account for reverse iterators
Definition at line 127 of file fastlist.h.
References GMAD::FastList< T >::insert().

| FastList< T >::FastListIterator GMAD::FastList< T >::insert | ( | FastListInputIterator | position, |
| const T & | val | ||
| ) |
template definitions need to be in header
insert options (classic list inserts): inputiterator templated to account for reverse iterators
Definition at line 117 of file fastlist.h.
Referenced by GMAD::Parser::expand_line(), and GMAD::FastList< T >::insert().

| void GMAD::FastList< T >::insert_before | ( | const std::string & | name, |
| const T & | val | ||
| ) |
insert element before all elements with given name exits if no element with name
Definition at line 135 of file fastlist.h.
| void GMAD::FastList< T >::print | ( | int | ident = 0 | ) | const |
print method
Definition at line 298 of file fastlist.h.
| void GMAD::FastList< T >::push_back | ( | const T & | el, |
| bool | unique = false, |
||
| const std::string & | objectName = "element" |
||
| ) |
insert element at end of list option to check for unique element name (exits in case name is not unique), false by default
Definition at line 154 of file fastlist.h.
Referenced by GMAD::Parser::expand_line().

| int GMAD::FastList< T >::size | ( | ) | const |
size of list
Definition at line 166 of file fastlist.h.
Referenced by BDSDetectorConstruction::BuildBeamline(), and GMAD::Parser::expand_line().

|
private |
the element list a list is chosen since insertion is fast and iterators are not invalidated
Definition at line 109 of file fastlist.h.
Referenced by GMAD::FastList< T >::empty().
|
private |
multimap for name lookup
Definition at line 111 of file fastlist.h.