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

1D 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< 1, double > operator* () const
 Get current value. More...
 
JArrayIteratoroperator++ ()
 Prefix increment. More...
 
JArrayIterator operator++ (int)
 Postfix increment. More...
 

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

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  :
107  collection(collection)
108  {
109  i = 0;
110  }
const JAbstractCollection< T > & collection

Member Function Documentation

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.
const JAbstractCollection< T > & collection
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.
One dimensional array of template objects with fixed length.
Definition: JArray.hh:40
const JAbstractCollection< T > & collection
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  }
virtual int getSize() const =0
Get number of elements.
const JAbstractCollection< T > & collection
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  }
ND array iterator.

Member Data Documentation

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

Definition at line 165 of file JArrayIterator.hh.

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: