Jpp  master_rocky-37-gf0c5bc59d
the software that should make you happy
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
JLANG::JAbstractObjectIterator< T > Class Template Referenceabstract

Abstract object iterator. More...

#include <JAbstractObjectIterator.hh>

Inheritance diagram for JLANG::JAbstractObjectIterator< T >:
JLANG::JObjectIterator< T > JDATABASE::JDatabaseObjectIterator< JTail_t > JDATABASE::JDatabaseObjectIterator< JHead_t > JLANG::JRewindableAbstractObjectIterator< Head > JLANG::JRewindableAbstractObjectIterator< JTriggerParameters > JDATABASE::JDatabaseObjectIterator< T > JIO::JReaderObjectIterator< T > JLANG::JAccessibleAbstractObjectIterator< T > JLANG::JRewindableAbstractObjectIterator< T > JLANG::JStreamObjectIterator< T > JNET::JControlHostObjectIterator< T > JNET::JLigierObjectIterator< T >

Public Types

typedef JObjectIterator< T >::pointer_type pointer_type
 

Public Member Functions

virtual bool setObject (T &object)=0
 Set object. More...
 
virtual bool hasNext () override
 Check availability of next element. More...
 
virtual const pointer_typenext () override
 Get next element. More...
 
virtual skip_type skip (const skip_type ns)
 Skip items. More...
 

Protected Member Functions

 JAbstractObjectIterator ()
 Default constructor. More...
 

Protected Attributes

object
 object More...
 
bool has_next
 status More...
 

Private Attributes

pointer_type ps
 

Detailed Description

template<class T>
class JLANG::JAbstractObjectIterator< T >

Abstract object iterator.

This class implements the JObjectIterator interface via a single interface method setObject().
An internal object is used for which the default constructor should exist.

Definition at line 23 of file JAbstractObjectIterator.hh.

Member Typedef Documentation

◆ pointer_type

Definition at line 39 of file JAbstractObjectIterator.hh.

Constructor & Destructor Documentation

◆ JAbstractObjectIterator()

template<class T >
JLANG::JAbstractObjectIterator< T >::JAbstractObjectIterator ( )
inlineprotected

Default constructor.

Definition at line 30 of file JAbstractObjectIterator.hh.

30  :
31  has_next(false)
32  {}

Member Function Documentation

◆ setObject()

template<class T >
virtual bool JLANG::JAbstractObjectIterator< T >::setObject ( T &  object)
pure virtual

◆ hasNext()

template<class T >
virtual bool JLANG::JAbstractObjectIterator< T >::hasNext ( )
inlineoverridevirtual

Check availability of next element.

Returns
true if the iteration has more elements; else false

Implements JLANG::JObjectIterator< T >.

Definition at line 56 of file JAbstractObjectIterator.hh.

57  {
58  if (!has_next) {
59  has_next = this->setObject(object);
60  }
61 
62  return has_next;
63  }
virtual bool setObject(T &object)=0
Set object.

◆ next()

template<class T >
virtual const pointer_type& JLANG::JAbstractObjectIterator< T >::next ( )
inlineoverridevirtual

Get next element.

Returns
pointer to element

Implements JLANG::JObjectIterator< T >.

Definition at line 71 of file JAbstractObjectIterator.hh.

72  {
73  if (has_next)
74  ps.reset(&this->object);
75  else
76  ps.reset(NULL);
77 
78  has_next = false;
79 
80  return ps;
81  }
virtual void reset() override
Reset pointer.
Definition: JPointer.hh:84

◆ skip()

template<class T >
virtual skip_type JLANG::JObjectIterator< T >::skip ( const skip_type  ns)
inlinevirtualinherited

Skip items.

Parameters
nsnumber of items to skip
Returns
number of items skipped

Reimplemented in JLANG::JSTDObjectIterator< T >, JLANG::JPipe< T >, JLANG::JPipe< JTail_t >, JLANG::JPipe< JHead_t >, and JLANG::JAbstractObjectReader< T >.

Definition at line 90 of file JObjectIterator.hh.

91  {
92  skip_type i = 0;
93 
94  for ( ; i != ns && hasNext(); ++i) {
95  next();
96  }
97 
98  return i;
99  }
virtual const pointer_type & next()=0
Get next element.
virtual bool hasNext()=0
Check availability of next element.
unsigned int skip_type
Type definition for number of objects to skip.
std::vector< size_t > ns

Member Data Documentation

◆ object

template<class T >
T JLANG::JAbstractObjectIterator< T >::object
protected

object

Definition at line 34 of file JAbstractObjectIterator.hh.

◆ has_next

template<class T >
bool JLANG::JAbstractObjectIterator< T >::has_next
protected

status

Definition at line 35 of file JAbstractObjectIterator.hh.

◆ ps

template<class T >
pointer_type JLANG::JAbstractObjectIterator< T >::ps
private

Definition at line 84 of file JAbstractObjectIterator.hh.


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