Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JTOOLS::JArrayIterator< 1, T > Struct Template Reference

1D array iterator. More...

#include <JArrayIterator.hh>

Public Member Functions

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

Public Attributes

const JAbstractCollection< T > & collection
 

Private Attributes

int i
 

Detailed Description

template<class T>
struct JTOOLS::JArrayIterator< 1, T >

1D array iterator.

Definition at line 99 of file JArrayIterator.hh.

Constructor & Destructor Documentation

◆ JArrayIterator()

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

Constructor.

Parameters
collectionabscissa values

Definition at line 106 of file JArrayIterator.hh.

106 :
108 {
109 i = 0;
110 }
const JAbstractCollection< T > & collection

Member Function Documentation

◆ operator bool()

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

Check validity of iterator.

Returns
true if valid; else false

Definition at line 118 of file JArrayIterator.hh.

119 {
120 return i != this->collection.getSize();
121 }
virtual int getSize() const =0
Get number of elements.

◆ operator*()

template<class T >
JArray< 1, double > JTOOLS::JArrayIterator< 1, T >::operator* ( ) const
inline

Get current value.

Returns
value

Definition at line 129 of file JArrayIterator.hh.

130 {
131 return JArray<1, double>(this->collection.getX(i));
132 }
virtual abscissa_type getX(int index) const =0
Get abscissa value.

◆ operator++() [1/2]

template<class T >
JArrayIterator & JTOOLS::JArrayIterator< 1, T >::operator++ ( )
inline

Prefix increment.

Returns
this array sampler

Definition at line 140 of file JArrayIterator.hh.

141 {
142 if (i != this->collection.getSize()) {
143 ++i;
144 }
145
146 return *this;
147 }

◆ operator++() [2/2]

template<class T >
JArrayIterator JTOOLS::JArrayIterator< 1, T >::operator++ ( int )
inline

Postfix increment.

Returns
previous array sampler

Definition at line 155 of file JArrayIterator.hh.

156 {
157 const JArrayIterator previous(*this);
158
159 ++(*this);
160
161 return previous;
162 }
JArrayIterator(const JAbstractCollection< T > &collection)
Constructor.

Member Data Documentation

◆ collection

template<class T >
const JAbstractCollection<T>& JTOOLS::JArrayIterator< 1, T >::collection

Definition at line 165 of file JArrayIterator.hh.

◆ i

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

Definition at line 168 of file JArrayIterator.hh.


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