Jpp
Public Types | Public Member Functions | Protected Attributes | Private Attributes | List of all members
JLANG::JSTDObjectIterator< T > Struct Template Reference

Implementation of object iteration from STD container. More...

#include <JSTDObjectIterator.hh>

Inheritance diagram for JLANG::JSTDObjectIterator< T >:
JLANG::JRewindableObjectIterator< JCategory< T::value_type, !JClass< T::reference >::is_constant >::value_type > JLANG::JObjectIterator< JCategory< T::value_type, !JClass< T::reference >::is_constant >::value_type > JLANG::JRewindable< JCategory< T::value_type, !JClass< T::reference >::is_constant >::value_type >

Public Types

typedef JCategory< typename T::value_type, !JClass< typename T::reference >::is_constant >::value_type value_type
 
typedef JRewindableObjectIterator< value_type >::pointer_type pointer_type
 

Public Member Functions

 JSTDObjectIterator ()
 Default constructor. More...
 
 JSTDObjectIterator (T begin, T end)
 Constructor. More...
 
virtual void rewind ()
 Rewind. More...
 
virtual bool hasNext ()
 Check availability of next element. More...
 
virtual const pointer_typenext ()
 Get next element. More...
 
virtual skip_type skip (const skip_type ns)
 Skip items. More...
 

Protected Attributes

__begin
 
__end
 
__i
 

Private Attributes

pointer_type ps
 

Detailed Description

template<class T>
struct JLANG::JSTDObjectIterator< T >

Implementation of object iteration from STD container.

Definition at line 25 of file JSTDObjectIterator.hh.

Member Typedef Documentation

◆ value_type

template<class T >
typedef JCategory<typename T::value_type, !JClass<typename T::reference>::is_constant>::value_type JLANG::JSTDObjectIterator< T >::value_type

Definition at line 30 of file JSTDObjectIterator.hh.

◆ pointer_type

Definition at line 31 of file JSTDObjectIterator.hh.

Constructor & Destructor Documentation

◆ JSTDObjectIterator() [1/2]

template<class T >
JLANG::JSTDObjectIterator< T >::JSTDObjectIterator ( )
inline

Default constructor.

Definition at line 36 of file JSTDObjectIterator.hh.

37  {}

◆ JSTDObjectIterator() [2/2]

template<class T >
JLANG::JSTDObjectIterator< T >::JSTDObjectIterator ( begin,
end 
)
inline

Constructor.

Parameters
beginbegin of data
endend of data

Definition at line 46 of file JSTDObjectIterator.hh.

47  :
48  __begin(begin),
49  __end (end),
50  __i (begin)
51  {}

Member Function Documentation

◆ rewind()

template<class T >
virtual void JLANG::JSTDObjectIterator< T >::rewind ( )
inlinevirtual

◆ hasNext()

template<class T >
virtual bool JLANG::JSTDObjectIterator< T >::hasNext ( )
inlinevirtual

Check availability of next element.

Returns
true if the iteration has more elements; else false

Implements JLANG::JObjectIterator< JCategory< T::value_type, !JClass< T::reference >::is_constant >::value_type >.

Definition at line 68 of file JSTDObjectIterator.hh.

69  {
70  return __i != __end;
71  }

◆ next()

template<class T >
virtual const pointer_type& JLANG::JSTDObjectIterator< T >::next ( )
inlinevirtual

Get next element.

Returns
pointer to element

Implements JLANG::JObjectIterator< JCategory< T::value_type, !JClass< T::reference >::is_constant >::value_type >.

Definition at line 79 of file JSTDObjectIterator.hh.

80  {
81  if (hasNext())
82  ps.reset(&(*__i++));
83  else
84  ps.reset(NULL);
85 
86  return ps;
87  }

◆ skip()

template<class T >
virtual skip_type JLANG::JSTDObjectIterator< T >::skip ( const skip_type  ns)
inlinevirtual

Skip items.

Parameters
nsnumber of items to skip
Returns
number of items skipped

Reimplemented from JLANG::JObjectIterator< JCategory< T::value_type, !JClass< T::reference >::is_constant >::value_type >.

Definition at line 96 of file JSTDObjectIterator.hh.

97  {
98  using namespace std;
99 
100  skip_type i = min(ns, (skip_type) distance(__i, __end));
101 
102  advance(__i, i);
103 
104  return i;
105  }

Member Data Documentation

◆ __begin

template<class T >
T JLANG::JSTDObjectIterator< T >::__begin
protected

Definition at line 108 of file JSTDObjectIterator.hh.

◆ __end

template<class T >
T JLANG::JSTDObjectIterator< T >::__end
protected

Definition at line 109 of file JSTDObjectIterator.hh.

◆ __i

template<class T >
T JLANG::JSTDObjectIterator< T >::__i
protected

Definition at line 110 of file JSTDObjectIterator.hh.

◆ ps

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

Definition at line 112 of file JSTDObjectIterator.hh.


The documentation for this struct was generated from the following file:
JLANG::skip_type
unsigned int skip_type
Type definition for number of objects to skip.
Definition: JObjectIterator.hh:25
JROOT::advance
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
Definition: JCounter.hh:35
distance
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Definition: PhysicsEvent.hh:434
JLANG::JSTDObjectIterator::__i
T __i
Definition: JSTDObjectIterator.hh:110
JLANG::JSTDObjectIterator::ps
pointer_type ps
Definition: JSTDObjectIterator.hh:112
JLANG::JSTDObjectIterator::hasNext
virtual bool hasNext()
Check availability of next element.
Definition: JSTDObjectIterator.hh:68
JLANG::JSTDObjectIterator::__begin
T __begin
Definition: JSTDObjectIterator.hh:108
std
Definition: jaanetDictionary.h:36
JLANG::JSTDObjectIterator::__end
T __end
Definition: JSTDObjectIterator.hh:109