Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JLANG::JAccessibleAbstractObjectIterator< T > Class Template Referenceabstract

Abstract object iterator with named access. More...

#include <JAbstractObjectIterator.hh>

Inheritance diagram for JLANG::JAccessibleAbstractObjectIterator< T >:
JLANG::JAccessibleObjectIterator< T > JLANG::JAbstractObjectIterator< T > JLANG::JObjectIterator< T > JLANG::JAccessible JLANG::JObjectIterator< T > JLANG::JThrow< JAccessible >

Public Types

typedef JObjectIterator< T >::pointer_type pointer_type
 

Public Member Functions

virtual bool setObject (T &object)=0
 Set object.
 
virtual bool hasNext () override
 Check availability of next element.
 
virtual const pointer_typenext () override
 Get next element.
 
virtual skip_type skip (const skip_type ns)
 Skip items.
 
virtual bool is_open () const =0
 Check is device is open.
 
virtual void open (const char *file_name)=0
 Open device.
 
virtual void close ()=0
 Close device.
 

Static Public Member Functions

static void Throw (const bool option)
 Enable/disable throw option.
 
static int Throw (const JException_t &error, const int value=-1)
 Throw exception or return error.
 

Protected Attributes

object
 object
 
bool has_next
 status
 

Static Protected Attributes

static bool do_throw
 throw option
 

Private Attributes

pointer_type ps
 

Detailed Description

template<class T>
class JLANG::JAccessibleAbstractObjectIterator< T >

Abstract object iterator with named access.

Definition at line 102 of file JAbstractObjectIterator.hh.

Member Typedef Documentation

◆ pointer_type

template<class T >
JObjectIterator<T>::pointer_type JLANG::JAbstractObjectIterator< T >::pointer_type
inherited

Definition at line 39 of file JAbstractObjectIterator.hh.

Member Function Documentation

◆ setObject()

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

◆ hasNext()

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

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 ( )
inlineoverridevirtualinherited

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::JAbstractObjectReader< T >, JLANG::JAbstractObjectReader< const event_type >, JLANG::JAbstractObjectReader< Evt >, JLANG::JAbstractObjectReader< JDAQSummaryslice >, JLANG::JAbstractObjectReader< JHead_t >, JLANG::JAbstractObjectReader< JTail_t >, JLANG::JAbstractObjectReader< JTypeList< JDAQEvent, JNullType > >, JLANG::JAbstractObjectReader< KM3NETDAQ::JDAQEvent >, JLANG::JPipe< T >, JLANG::JPipe< JHead_t >, JLANG::JPipe< JTail_t >, JLANG::JSTDObjectIterator< T >, JROOT::JRootFileReader< T, false >, JROOT::JTreeReaderObjectIterator< T >, JSUPPORT::JMultipleFileScanner< T >, JSUPPORT::JMultipleFileScanner< Evt >, JSUPPORT::JMultipleFileScanner< JDAQSummaryslice >, JSUPPORT::JMultipleFileScanner< JHead_t >, JSUPPORT::JMultipleFileScanner< JTail_t >, JSUPPORT::JMultipleFileScanner< JTypeList< JDAQEvent, JNullType > >, JSUPPORT::JMultipleFileScanner< JTypeList< JHead_t, JTail_t > >, JSUPPORT::JMultipleFileScanner< KM3NETDAQ::JDAQEvent >, JSUPPORT::JMultipleFileScanner<>, JSUPPORT::JSingleFileScanner< T >, JSUPPORT::JSingleFileScanner< JHead_t >, JSUPPORT::JSingleFileScanner< JTail_t >, JSUPPORT::JSingleFileScanner< JTypeList< JHead_t, JTail_t > >, and JSUPPORT::JSingleFileScanner<>.

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 bool hasNext()=0
Check availability of next element.
virtual const pointer_type & next()=0
Get next element.
unsigned int skip_type
Type definition for number of objects to skip.

◆ is_open()

◆ open()

◆ close()

◆ Throw() [1/2]

static void JLANG::JThrow< JAccessible >::Throw ( const bool option)
inlinestaticinherited

Enable/disable throw option.

Parameters
optiontrue enable; false disable

Definition at line 37 of file JThrow.hh.

38 {
39 do_throw = option;
40 }

◆ Throw() [2/2]

static int JLANG::JThrow< JAccessible >::Throw ( const JException_t & error,
const int value = -1 )
inlinestaticinherited

Throw exception or return error.

Parameters
errorexception
valuereturn code
Returns
return code

Definition at line 51 of file JThrow.hh.

52 {
53 using namespace std;
54
55 if (do_throw) {
56 throw error;
57 }
58
59 cerr << error.what() << endl;
60
61 return value;
62 }

Member Data Documentation

◆ object

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

object

Definition at line 34 of file JAbstractObjectIterator.hh.

◆ has_next

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

status

Definition at line 35 of file JAbstractObjectIterator.hh.

◆ ps

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

Definition at line 84 of file JAbstractObjectIterator.hh.

◆ do_throw

bool JLANG::JThrow< JAccessible >::do_throw
staticprotectedinherited

throw option

Set default throw option to true.

Definition at line 28 of file JThrow.hh.


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