ATLAS Offline Software
Loading...
Searching...
No Matches
PyItPatch< IT > Struct Template Reference

This class provides some pathces for an iterator. More...

#include <PyItPatch.h>

Collaboration diagram for PyItPatch< IT >:

Public Member Functions

 PyItPatch ()
 PyItPatch (IT &it)
virtual ~PyItPatch ()
IT::reference next ()
bool eq (IT &rhs)
bool ne (IT &rhs)

Private Attributes

IT m_it
NonConst< typenameNonPointer< typenameIT::pointer >::Type >::Typem_cache

Detailed Description

template<class IT>
struct PyItPatch< IT >

This class provides some pathces for an iterator.

Some c++ classes have methods to return iterators instead of vectors. In this case people need to use iterators directly. PyKernel addes next() and patches eq()/__ne__() instead. Then one can use the iterator like as a python iterator.

Definition at line 37 of file PyItPatch.h.

Constructor & Destructor Documentation

◆ PyItPatch() [1/2]

template<class IT>
PyItPatch< IT >::PyItPatch ( )
inline

Definition at line 39 of file PyItPatch.h.

39: m_cache(0) {}
NonConst< typenameNonPointer< typenameIT::pointer >::Type >::Type * m_cache
Definition PyItPatch.h:70

◆ PyItPatch() [2/2]

template<class IT>
PyItPatch< IT >::PyItPatch ( IT & it)
inline

Definition at line 40 of file PyItPatch.h.

40 : m_it(it)
41 {
43 }
RootType Type
This class provides some pathces for an iterator.
Definition PyItPatch.h:38

◆ ~PyItPatch()

template<class IT>
virtual PyItPatch< IT >::~PyItPatch ( )
inlinevirtual

Definition at line 44 of file PyItPatch.h.

44{ if (m_cache!=0) delete m_cache; }

Member Function Documentation

◆ eq()

template<class IT>
bool PyItPatch< IT >::eq ( IT & rhs)
inline

Definition at line 57 of file PyItPatch.h.

58 {
59 return rhs == m_it;
60 }

◆ ne()

template<class IT>
bool PyItPatch< IT >::ne ( IT & rhs)
inline

Definition at line 63 of file PyItPatch.h.

64 {
65 return !eq(rhs);
66 }
bool eq(IT &rhs)
Definition PyItPatch.h:57

◆ next()

template<class IT>
IT::reference PyItPatch< IT >::next ( )
inline

Definition at line 47 of file PyItPatch.h.

48 {
49 // this implementation is needed for LCG dict
50 // 'return *m_it++' doesn't compile
51 *m_cache = *m_it;
52 ++m_it;
53 return *m_cache;
54 }

Member Data Documentation

◆ m_cache

template<class IT>
NonConst<typenameNonPointer<typenameIT::pointer>::Type>::Type* PyItPatch< IT >::m_cache
private

Definition at line 70 of file PyItPatch.h.

◆ m_it

template<class IT>
IT PyItPatch< IT >::m_it
private

Definition at line 69 of file PyItPatch.h.


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