ATLAS Offline Software
Loading...
Searching...
No Matches
IDTPM2::GenericAncestorFinder< T, Predicate > Class Template Reference

allow generic predicate types ... More...

#include <AncestorFinder.h>

Inheritance diagram for IDTPM2::GenericAncestorFinder< T, Predicate >:
Collaboration diagram for IDTPM2::GenericAncestorFinder< T, Predicate >:

Public Member Functions

 GenericAncestorFinder (Predicate p)
bool predicate (const T *t) const override
const T * findAncestor (const T *t) const

Private Attributes

Predicate m_predicate

Detailed Description

template<typename T, typename Predicate>
class IDTPM2::GenericAncestorFinder< T, Predicate >

allow generic predicate types ...

Definition at line 62 of file AncestorFinder.h.

Constructor & Destructor Documentation

◆ GenericAncestorFinder()

template<typename T, typename Predicate>
IDTPM2::GenericAncestorFinder< T, Predicate >::GenericAncestorFinder ( Predicate p)
inline

Definition at line 66 of file AncestorFinder.h.

66: m_predicate(p) { }
allow generic predicate types ...

Member Function Documentation

◆ findAncestor()

template<typename T>
const T * IDTPM2::IFinder< T >::findAncestor ( const T * t) const
inlineinherited

successful stopping condition ...

isn't recursion great boys and girls ?

Definition at line 33 of file AncestorFinder.h.

33 {
34
35 // reached the end ...
36 if (!t) return 0;
37
39 if ( predicate(t) ) return t;
40
41 for ( size_t p=0 ; p<t->nParents() ; p++ ) {
42 const T* parent = t->parent(p);
43
44 if ( parent==t ) continue;
45
47 if ( const T* found = findAncestor(parent) ) return found;
48 }
49
50 return 0;
51 }
const T * findAncestor(const T *t) const
virtual bool predicate(const T *t) const =0

◆ predicate()

template<typename T, typename Predicate>
bool IDTPM2::GenericAncestorFinder< T, Predicate >::predicate ( const T * t) const
inlineoverridevirtual

Implements IDTPM2::IFinder< T >.

Definition at line 68 of file AncestorFinder.h.

68{ return m_predicate(t); }

Member Data Documentation

◆ m_predicate

template<typename T, typename Predicate>
Predicate IDTPM2::GenericAncestorFinder< T, Predicate >::m_predicate
private

Definition at line 72 of file AncestorFinder.h.


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