Jpp  18.2.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | List of all members
JTOOLS::JArrayIterator< N, T > Struct Template Reference

ND array iterator. More...

#include <JArrayIterator.hh>

Public Member Functions

 JArrayIterator (const JAbstractCollection< T > &collection)
 Constructor. More...
 
 operator bool () const
 Check validity of iterator. More...
 
JArray< N, double > operator* () const
 Get current value. More...
 
JArrayIteratoroperator++ ()
 Prefix increment. More...
 
JArrayIterator operator++ (int)
 Postfix increment. More...
 

Private Attributes

int i
 

Detailed Description

template<int N, class T>
struct JTOOLS::JArrayIterator< N, T >

ND array iterator.

Definition at line 21 of file JArrayIterator.hh.

Constructor & Destructor Documentation

template<int N, class T >
JTOOLS::JArrayIterator< N, T >::JArrayIterator ( const JAbstractCollection< T > &  collection)
inline

Constructor.

Parameters
collectionabscissa values

Definition at line 29 of file JArrayIterator.hh.

29  :
30  JArrayIterator<N - 1, T>(collection)
31  {
32  i = 0;
33  }
ND array iterator.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
Definition: JMuonPostfit.sh:40

Member Function Documentation

template<int N, class T >
JTOOLS::JArrayIterator< N, T >::operator bool ( ) const
inline

Check validity of iterator.

Returns
true if valid; else false

Definition at line 41 of file JArrayIterator.hh.

42  {
43  return i != this->collection.getSize() && JArrayIterator<N-1, T>::operator bool();
44  }
ND array iterator.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
Definition: JMuonPostfit.sh:40
template<int N, class T >
JArray<N, double> JTOOLS::JArrayIterator< N, T >::operator* ( ) const
inline

Get current value.

Returns
value

Definition at line 52 of file JArrayIterator.hh.

53  {
54  return JArray<N, double>(JArrayIterator<N-1, T>::operator *(), this->collection.getX(i));
55  }
One dimensional array of template objects with fixed length.
Definition: JArray.hh:40
JArray< N, double > operator*() const
Get current value.
template<int N, class T >
JArrayIterator& JTOOLS::JArrayIterator< N, T >::operator++ ( )
inline

Prefix increment.

Returns
this array sampler

Definition at line 63 of file JArrayIterator.hh.

64  {
65  if (++i == this->collection.getSize()) {
66 
67  i = 0; // rewind
68 
70  }
71 
72  return *this;
73  }
JArrayIterator & operator++()
Prefix increment.
template<int N, class T >
JArrayIterator JTOOLS::JArrayIterator< N, T >::operator++ ( int  )
inline

Postfix increment.

Returns
previous array sampler

Definition at line 81 of file JArrayIterator.hh.

82  {
83  const JArrayIterator previous(*this);
84 
85  ++(*this);
86 
87  return previous;
88  }
ND array iterator.

Member Data Documentation

template<int N, class T >
int JTOOLS::JArrayIterator< N, T >::i
private

Definition at line 91 of file JArrayIterator.hh.


The documentation for this struct was generated from the following file: