Jpp  master_rocky
the software that should make you happy
JStreamObjectIterator.hh
Go to the documentation of this file.
1 #ifndef __JLANG__JSTREAMOBJECTITERATOR__
2 #define __JLANG__JSTREAMOBJECTITERATOR__
3 
4 #include <istream>
5 
7 
8 
9 /**
10  * \author mdejong
11  */
12 
13 namespace JLANG {}
14 namespace JPP { using namespace JLANG; }
15 
16 namespace JLANG {
17 
18 
19  /**
20  * Stream object iterator.
21  *
22  * This class implements the JAbstractObjectIterator interface.
23  */
24  template<class T>
26  public JAbstractObjectIterator<T>
27  {
28  public:
29  /**
30  * Constructor.
31  *
32  * \param in input stream
33  */
34  JStreamObjectIterator(std::istream& in) :
35  __in(in)
36  {}
37 
38 
39  /**
40  * Set object.
41  *
42  * \param object reference to object to be set
43  * \return true if set; else false
44  */
45  virtual bool setObject(T& object) override
46  {
47  return (bool) (__in && __in >> object);
48  }
49 
50  protected:
51  std::istream& __in;
52  };
53 }
54 
55 #endif
JStreamObjectIterator(std::istream &in)
Constructor.
virtual bool setObject(T &object) override
Set object.
Auxiliary classes and methods for language specific functionality.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).