Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JConversionIterator.hh
Go to the documentation of this file.
1#ifndef __JLANG__JCONVERSIONITERATOR__
2#define __JLANG__JCONVERSIONITERATOR__
3
5
6
7/**
8 * \author mdejong
9 */
10
11namespace JLANG {}
12namespace JPP { using namespace JLANG; }
13
14namespace JLANG {
15
16 /**
17 * Interface for object iteration with type conversion.
18 */
19 template<class JInput_t, class JOutput_t>
21 public JObjectIterator<JOutput_t>
22 {
23 public:
24
26
27
28 /**
29 * Constructor.
30 *
31 * \param input input iterator
32 */
36
37
38 /**
39 * Check availability of next element.
40 *
41 * \return true if the iteration has more elements; else false
42 */
43 virtual bool hasNext() override
44 {
45 return in.hasNext();
46 }
47
48
49 /**
50 * Get next element.
51 *
52 * \return pointer to element
53 */
54 virtual const pointer_type& next() override
55 {
56 const JInput_t* p = in.next();
57
58 if (p != NULL)
59 ps.reset(new JOutput_t(*p)); // type conversion
60 else
61 ps.reset(NULL);
62
63 return ps;
64 }
65
66 protected:
68 private:
70 };
71}
72
73#endif
Interface for object iteration with type conversion.
JObjectIterator< JInput_t > & in
virtual const pointer_type & next() override
Get next element.
virtual bool hasNext() override
Check availability of next element.
JConversionIterator(JObjectIterator< JInput_t > &input)
Constructor.
JObjectIterator< JOutput_t >::pointer_type pointer_type
Interface of object iteration for a single data type.
virtual bool hasNext()=0
Check availability of next element.
virtual const pointer_type & next()=0
Get next element.
virtual void reset() override
Reset pointer.
Definition JPointer.hh:84
Auxiliary classes and methods for language specific functionality.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).