Jpp  18.0.1-rc.2
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 | List of all members
JLANG::JStreamObjectIterator< T > Class Template Reference

Stream object iterator. More...

#include <JStreamObjectIterator.hh>

Inheritance diagram for JLANG::JStreamObjectIterator< T >:
JLANG::JAbstractObjectIterator< T > JLANG::JObjectIterator< T > JLANG::JASCIIFileReader< T > JLANG::JGZFileReader< T >

Public Types

typedef JObjectIterator< T >
::pointer_type 
pointer_type
 

Public Member Functions

 JStreamObjectIterator (std::istream &in)
 Constructor. More...
 
virtual bool setObject (T &object) override
 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 Attributes

std::istream & __in
 
T object
 object More...
 
bool has_next
 status More...
 

Detailed Description

template<class T>
class JLANG::JStreamObjectIterator< T >

Stream object iterator.

This class implements the JAbstractObjectIterator interface.

Definition at line 25 of file JStreamObjectIterator.hh.

Member Typedef Documentation

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

Definition at line 39 of file JAbstractObjectIterator.hh.

Constructor & Destructor Documentation

template<class T >
JLANG::JStreamObjectIterator< T >::JStreamObjectIterator ( std::istream &  in)
inline

Constructor.

Parameters
ininput stream

Definition at line 34 of file JStreamObjectIterator.hh.

34  :
35  __in(in)
36  {}
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46

Member Function Documentation

template<class T >
virtual bool JLANG::JStreamObjectIterator< T >::setObject ( T object)
inlineoverridevirtual

Set object.

Parameters
objectreference to object to be set
Returns
true if set; else false

Implements JLANG::JAbstractObjectIterator< T >.

Definition at line 45 of file JStreamObjectIterator.hh.

46  {
47  return (bool) (__in && __in >> object);
48  }
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.
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
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::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 >, and JLANG::JAbstractObjectReader< JDAQSummaryslice >.

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

Member Data Documentation

template<class T >
std::istream& JLANG::JStreamObjectIterator< T >::__in
protected

Definition at line 51 of file JStreamObjectIterator.hh.

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

object

Definition at line 34 of file JAbstractObjectIterator.hh.

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

status

Definition at line 35 of file JAbstractObjectIterator.hh.


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