![]() |
AliPhysics
8bb951a (8bb951a)
|
Container implementing iterable functionality of the EMCAL containers. More...
#include <AliEmcalIterableContainer.h>
Classes | |
class | iterator |
bidirectional stl iterator over the EMCAL iterable container More... | |
Public Member Functions | |
AliEmcalIterableContainer () | |
AliEmcalIterableContainer (const AliEmcalContainer *cont, bool useAccept) | |
AliEmcalIterableContainer (const AliEmcalIterableContainer &ref) | |
AliEmcalIterableContainer & | operator= (const AliEmcalIterableContainer &cont) |
virtual | ~AliEmcalIterableContainer () |
TObject * | operator[] (int index) const |
operator int () const | |
const AliEmcalContainer * | GetContainer () const |
int | GetEntries () const |
iterator | begin () const |
iterator | end () const |
iterator | rbegin () const |
iterator | rend () const |
Protected Member Functions | |
void | BuildAcceptIndices () |
Private Attributes | |
const AliEmcalContainer * | fkContainer |
Container to be iterated over. More... | |
TArrayI | fAcceptIndices |
Array of accepted indices. More... | |
Bool_t | fUseAccepted |
Switch between accepted and all objects. More... | |
Container implementing iterable functionality of the EMCAL containers.
Providing an interface to iterator functionality for the AliEmcalContainer and inheriting objects, iterating over either all or only accepted objects inside the container. The content is specified in the constructor.
EMCAL iterable containers should not be created by hand. Instead, the EMCAL container provides the functionality to create the interface for both cases:
Once created, EMCAL iterable containers implement the functions begin(), end(), rbegin() and rend() creating stl iterators (type AliEmcalIterableContainer::iterator). These can be used as normal stl iterators
In case c++11 is used this code simplifies to
Definition at line 51 of file AliEmcalIterableContainer.h.
AliEmcalIterableContainer::AliEmcalIterableContainer | ( | ) |
Default (I/O) constructor
Definition at line 25 of file AliEmcalIterableContainer.cxx.
AliEmcalIterableContainer::AliEmcalIterableContainer | ( | const AliEmcalContainer * | cont, |
bool | useAccept | ||
) |
Standard constructor, to be used by the users. Specifying the type of iteration (all vs. accepted). In case the iterator runs over accepted object, an index map is build inside the constructor.
[in] | cont | EMCAL container to iterate over |
[in] | useAccept | If true accepted objects are used in the iteration, otherwise all objects |
Definition at line 40 of file AliEmcalIterableContainer.cxx.
AliEmcalIterableContainer::AliEmcalIterableContainer | ( | const AliEmcalIterableContainer & | ref | ) |
Copy constructor. Initializing all parameters from the reference. As the container is not owner over its input container only pointers are copied.
[in] | ref | Reference for the copy |
Definition at line 54 of file AliEmcalIterableContainer.cxx.
|
inlinevirtual |
Destructor
Definition at line 104 of file AliEmcalIterableContainer.h.
|
inline |
Creating forward iterator at the beginning of the container (first entry).
Definition at line 127 of file AliEmcalIterableContainer.h.
|
protected |
Build list of accepted indices inside the container. For this all objects inside the container are checked for being accepted or not.
Definition at line 114 of file AliEmcalIterableContainer.cxx.
Referenced by AliEmcalIterableContainer().
|
inline |
Creating forward iterator behind the last entry of the container.
Definition at line 134 of file AliEmcalIterableContainer.h.
|
inline |
Access to underlying EMCAL container
Definition at line 118 of file AliEmcalIterableContainer.h.
int AliEmcalIterableContainer::GetEntries | ( | ) | const |
Return the number of objects to iterate over (depending on whether the iterator loops over all or only accepted objects)
Definition at line 84 of file AliEmcalIterableContainer.cxx.
Referenced by end(), operator int(), operator[](), and rbegin().
|
inline |
Integer conversion operator: Returning the size if the container (number of entries)
Definition at line 112 of file AliEmcalIterableContainer.h.
AliEmcalIterableContainer & AliEmcalIterableContainer::operator= | ( | const AliEmcalIterableContainer & | ref | ) |
Assignment operator. As the container is not owner over the input container only pointers are copied
[in] | ref | Reference for assignment |
Definition at line 69 of file AliEmcalIterableContainer.cxx.
TObject * AliEmcalIterableContainer::operator[] | ( | int | index | ) | const |
Array index operator. Returns object of the container at the position provided by the parameter index. The operator distinguishes between all and accepted objects:
[in] | index | Index of the object inside the container to access |
Definition at line 103 of file AliEmcalIterableContainer.cxx.
|
inline |
Creating backward iterator at the end of the container (last entry).
Definition at line 141 of file AliEmcalIterableContainer.h.
|
inline |
Creating backward iterator before the beginning of the container.
Definition at line 148 of file AliEmcalIterableContainer.h.
|
private |
Array of accepted indices.
Definition at line 155 of file AliEmcalIterableContainer.h.
Referenced by BuildAcceptIndices(), GetEntries(), operator=(), and operator[]().
|
private |
Container to be iterated over.
Definition at line 154 of file AliEmcalIterableContainer.h.
Referenced by BuildAcceptIndices(), GetContainer(), GetEntries(), operator=(), and operator[]().
|
private |
Switch between accepted and all objects.
Definition at line 156 of file AliEmcalIterableContainer.h.
Referenced by AliEmcalIterableContainer(), GetEntries(), operator=(), and operator[]().