#include <VectorIterator.h>
Inheritance diagram for VectorIterator< Row >:
If we have a vector with a row type Row, e.g. vector<FooBar>, then a VectorFloatFun allows to iterate over all elements of the vector and return the value of one data member.
Let's assume we have a class FooBar defined like this:
class FooBar { public: float foo; int bar; float foobar() const { return foo*bar; } };
class DataLoop: public EventLoop { public: DataLoop(); ~DataLoop(); void loop(); private: vector<FooBar> foobarvector; };
void DataLoop::loop() { // fill foobarvector here foobarvector[xxx] = yyy; // Now fill the self-filling histos: EventLoop::loop(); }
void DataLoop::DataLoop() { VectorIterator<FooBar>& foobar_it = *new VectorIterator<FooBar> (foobarvector); FloatFun& foo_fun = foobar_it.Float (&FooBar::foo); FloatFun& bar_fun = foobar_it.Float (&FooBar::bar); FloatFun& foobar_fun = foobar_it.Float (&FooBar::foobar); }
The notation &FooBar::foo is probably unfamiliar. Such a thing is called a member pointer. Essentially it is a kind of offset that describes where within an object a data member is stored. For more information, see any good C++ text book.
Author: Benno List, Jenny Böhme
Definition at line 533 of file VectorIterator.h.
Public Member Functions | |
VectorIterator (const std::vector< Row > &theVector_, const char *name_="?") | |
Constructor. | |
virtual int | operator() () const |
Returns iterator value, starting at 0. | |
virtual bool | next () |
Increments iterator; returns false if iterator cannot be incremented. | |
virtual bool | reset () |
Resets iterator; returns false if iterator value range is empty. | |
virtual bool | isValid () const |
Returns whether current value of iterator is valid. | |
template<class Member> VectorFloatFun< Row, Member > & | Float (Member Row::*p_mem, const char *name_="?") const |
Returns a FloatFun that returns a data member of T. | |
template<class Member> VectorFloatFunFun< Row, Member > & | Float (Member(Row::*p_mem)() const, const char *name_="?") const |
Returns a FloatFun that returns the result of a member method of T. | |
template<class Member, class Arg> VectorFloatFunFunArg< Row, Member, Arg > & | Float (Member(Row::*p_mem)(Arg) const, Arg arg_, const char *name_="?") const |
Returns a FloatFun that returns the result of a member method of T that takes an argument. | |
template<class Member> VectorIntFun< Row, Member > & | Int (Member Row::*p_mem, const char *name_="?") const |
Returns a IntFun that returns a data member of T. | |
template<class Member> VectorIntFunFun< Row, Member > & | Int (Member(Row::*p_mem)() const, const char *name_="?") const |
Returns a IntFun that returns the result of a member method of T. | |
template<class Member, class Arg> VectorIntFunFunArg< Row, Member, Arg > & | Int (Member(Row::*p_mem)(Arg) const, Arg arg_, const char *name_="?") const |
Returns a IntFun that returns the result of a member method of T that takes an argument. | |
template<class Member> VectorBaseCut< Row, Member > & | Bool (Member Row::*p_mem, const char *name_="?") const |
Returns a BaseCut that returns a data member of T. | |
template<class Member> VectorBaseCutFun< Row, Member > & | Bool (Member(Row::*p_mem)() const, const char *name_="?") const |
Returns a BaseCut that returns the result of a member method of T. | |
template<class Member, class Arg> VectorBaseCutFunArg< Row, Member, Arg > & | Bool (Member(Row::*p_mem)(Arg) const, Arg arg_, const char *name_="?") const |
Returns a BaseCut that returns the result of a member method of T with an argument. | |
Protected Member Functions | |
virtual | ~VectorIterator () |
Protected destructor ensures creation on the heap. | |
Protected Attributes | |
const std::vector< Row > & | theVector |
The vector. | |
unsigned int | index |
The iterator index. |
|
Constructor.
Definition at line 536 of file VectorIterator.h. References NamedO::getName(), VectorIterator< Row >::index, and VectorIterator< Row >::theVector. |
|
Returns a FloatFun that returns a data member of T. class Member (Type of Member) must be a type that can be converted to a float, such as float, double, or int. Definition at line 575 of file VectorIterator.h. References VectorIterator< Row >::theVector. |
|
Returns a FloatFun that returns the result of a member method of T. class Member (Type of Member) must be a type that can be converted to a float, such as float, double, or int. The access method itself must be declared as Member foobar() const; (the const is important!). Definition at line 590 of file VectorIterator.h. References VectorIterator< Row >::theVector. |
|
Returns a FloatFun that returns the result of a member method of T that takes an argument. class Member (Type of Member) must be a type that can be converted to a float, such as float, double, or int. The access method itself must be declared as Member foobar(Arg) const; (the const is important!), where A is the type of the argument. A must have a copy constructor! Definition at line 606 of file VectorIterator.h. References VectorIterator< Row >::theVector. |
|
Returns a IntFun that returns a data member of T. class Member (Type of Member) must be a type that can be converted to a int, such as float, double, or int. Definition at line 619 of file VectorIterator.h. References VectorIterator< Row >::theVector. |
|
Returns a IntFun that returns the result of a member method of T. class Member (Type of Member) must be a type that can be converted to a int, such as float, double, or int. The access method itself must be declared as Member foobar() const; (the const is important!). Definition at line 634 of file VectorIterator.h. References VectorIterator< Row >::theVector. |
|
Returns a IntFun that returns the result of a member method of T that takes an argument. class Member (Type of Member) must be a type that can be converted to a int, such as float, double, or int. The access method itself must be declared as Member foobar(Arg) const; (the const is important!), where A is the type of the argument. A must have a copy constructor! Definition at line 650 of file VectorIterator.h. References VectorIterator< Row >::theVector. |
|
Returns a BaseCut that returns a data member of T. class Member (Type of Member) must be a type that can be converted to a bool, such as bool, float, double, or int. Definition at line 663 of file VectorIterator.h. References VectorIterator< Row >::theVector. |
|
Returns a BaseCut that returns the result of a member method of T. class Member (Type of Member) must be a type that can be converted to a bool, such as bool, float, double, or int. The access method itself must be declared as Member foobar() const; (the const is important!). Definition at line 678 of file VectorIterator.h. References VectorIterator< Row >::theVector. |
|
Returns a BaseCut that returns the result of a member method of T with an argument. class Member (Type of Member) must be a type that can be converted to a bool, such as bool, float, double, or int. The access method itself must be declared as Member foobar(Arg) const; (the const is important!)., where A is the type of the argument. A must have a copy constructor! Definition at line 693 of file VectorIterator.h. References VectorIterator< Row >::theVector. |