Jpp
|
Auxiliary class to sample objects from a JRewindableObjectIterator. More...
#include <JObjectSampler.hh>
Public Types | |
typedef JObjectIterator< T > ::pointer_type | pointer_type |
Public Member Functions | |
JObjectSampler (JRewindableObjectIterator< T > &input) | |
Constructor. More... | |
JObjectSampler (JRewindableObjectIterator< T > &input, const JSampler_t< T > &sampler) | |
Constructor. More... | |
virtual bool | hasNext () override |
Check availability of next element. More... | |
virtual const pointer_type & | next () override |
Get next element. More... | |
const JSampler_t< T > & | getSampler () const |
Get sampler. More... | |
JSampler_t< T > & | getSampler () |
Get sampler. More... | |
virtual skip_type | skip (const skip_type ns) |
Skip items. More... | |
Protected Attributes | |
JRewindableObjectIterator< T > & | in |
JSampler_t< T > | sampler |
JPointer< T > | ps |
bool | has_next |
Auxiliary class to sample objects from a JRewindableObjectIterator.
This class can be used for iterations that are different than strict sequential. The first template parameter corresponds to the data type of the iteration and the second to the sampler.
The sampling is defined by the number of objects to be skipped. The number of objects to be skipped is returned by the function object operator of the sampler which takes the actual object as input.
The default JSampler corresponds to zero elements to be skipped, which in turn corresponds to the iteration of all objects in sequential order.
The JObjectSampler class implements the JObjectIterator using a reference to a JRewindableObjectIterator object so that the sampling of objects can continue ad infinitum.
Method JObjectSampler::hasNext normally returns true
, unless
Note that the internal sampler is a copy of the specified sampler and not a reference thereof.
Definition at line 40 of file JObjectSampler.hh.
typedef JObjectIterator<T>::pointer_type JLANG::JObjectSampler< T, JSampler_t >::pointer_type |
Definition at line 45 of file JObjectSampler.hh.
|
inline |
|
inline |
|
inlineoverridevirtual |
Check availability of next element.
Implements JLANG::JObjectIterator< T >.
Definition at line 78 of file JObjectSampler.hh.
|
inlineoverridevirtual |
Get next element.
Implements JLANG::JObjectIterator< T >.
Definition at line 120 of file JObjectSampler.hh.
|
inline |
|
inline |
|
inlinevirtualinherited |
Skip items.
ns | number of items to skip |
Reimplemented in JLANG::JPipe< T >, JLANG::JPipe< JTail_t >, JLANG::JPipe< JHead_t >, JLANG::JSTDObjectIterator< T >, JLANG::JAbstractObjectReader< T >, JLANG::JAbstractObjectReader< JNullType >, JLANG::JAbstractObjectReader< const T >, JLANG::JAbstractObjectReader< JTail_t >, JLANG::JAbstractObjectReader< JHead_t >, JLANG::JAbstractObjectReader< KM3NETDAQ::KM3NETDAQ::JDAQEvent >, JLANG::JAbstractObjectReader< JDAQSummaryslice >, and JLANG::JAbstractObjectReader< JTypeList< JDAQEvent, JTypelist_t > >.
Definition at line 90 of file JObjectIterator.hh.
|
protected |
Definition at line 154 of file JObjectSampler.hh.
|
protected |
Definition at line 155 of file JObjectSampler.hh.
|
protected |
Definition at line 156 of file JObjectSampler.hh.
|
protected |
Definition at line 157 of file JObjectSampler.hh.