Jpp  16.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 () override
 Rewind. 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) override
 Skip items. More...
 

Protected Attributes

T __begin
 
T __end
 
T __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

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.

Definition at line 31 of file JSTDObjectIterator.hh.

Constructor & Destructor Documentation

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

Default constructor.

Definition at line 36 of file JSTDObjectIterator.hh.

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

Constructor.

Parameters
beginbegin of data
endend of data

Definition at line 46 of file JSTDObjectIterator.hh.

Member Function Documentation

template<class T >
virtual void JLANG::JSTDObjectIterator< T >::rewind ( )
inlineoverridevirtual
template<class T >
virtual bool JLANG::JSTDObjectIterator< T >::hasNext ( )
inlineoverridevirtual

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.

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

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  }
virtual bool hasNext() override
Check availability of next element.
template<class T >
virtual skip_type JLANG::JSTDObjectIterator< T >::skip ( const skip_type  ns)
inlineoverridevirtual

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  }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
unsigned int skip_type
Type definition for number of objects to skip.
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.

Member Data Documentation

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

Definition at line 108 of file JSTDObjectIterator.hh.

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

Definition at line 109 of file JSTDObjectIterator.hh.

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

Definition at line 110 of file JSTDObjectIterator.hh.

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: