CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
edm::IterWithDictBase Class Reference

#include <IterWithDict.h>

Inheritance diagram for edm::IterWithDictBase:
edm::IterWithDict< T >

Public Member Functions

 IterWithDictBase ()
 
 IterWithDictBase (TList *)
 
bool operator!= (IterWithDictBase const &) const
 

Protected Member Functions

void advance ()
 
TIter const & iter () const
 

Private Attributes

bool atEnd_
 
TIter iter_
 

Detailed Description

Definition at line 14 of file IterWithDict.h.

Constructor & Destructor Documentation

◆ IterWithDictBase() [1/2]

edm::IterWithDictBase::IterWithDictBase ( )

Definition at line 18 of file IterWithDict.cc.

18  : iter_(static_cast<TList*>(nullptr)), atEnd_(true) {
19  // This ctor is used by the framework for the end of a range,
20  // or for any type that does not have a TClass.
21  // An iterator constructed by this ctor must not be used
22  // as the left hand argument of operator!=().
23  }

◆ IterWithDictBase() [2/2]

edm::IterWithDictBase::IterWithDictBase ( TList *  list)
explicit

Definition at line 25 of file IterWithDict.cc.

25  : iter_(list), atEnd_(false) {
26  // With a TIter, you must call Next() once to point to the first element.
27  TObject* obj = iter_.Next();
28  if (obj == nullptr) {
29  atEnd_ = true;
30  }
31  }

References atEnd_, iter_, and getGTfromDQMFile::obj.

Member Function Documentation

◆ advance()

void edm::IterWithDictBase::advance ( )
protected

Definition at line 6 of file IterWithDict.cc.

6  {
7  if (atEnd_) {
8  return;
9  }
10  TObject* obj = iter_.Next();
11  if (obj == nullptr) {
12  atEnd_ = true;
13  }
14  }

References atEnd_, iter_, and getGTfromDQMFile::obj.

Referenced by edm::IterWithDict< T >::operator++().

◆ iter()

TIter const & edm::IterWithDictBase::iter ( ) const
protected

Definition at line 16 of file IterWithDict.cc.

16 { return iter_; }

References iter_.

Referenced by edm::IterWithDict< T >::operator*().

◆ operator!=()

bool edm::IterWithDictBase::operator!= ( IterWithDictBase const &  rhs) const

Definition at line 33 of file IterWithDict.cc.

33  {
34  // The special cases are needed because TIter::operator!=()
35  // dereferences a null pointer (i.e. segfaults) if the left hand TIter
36  // was constucted with a nullptr argument (the first constructor above).
37  if (atEnd_ != rhs.atEnd_) {
38  // one iterator at end, but not both
39  return true;
40  }
41  if (atEnd_) {
42  // both iterators at end
43  return false;
44  }
45  // neither iterator at end
46  return iter_ != rhs.iter_;
47  }

References atEnd_, and iter_.

Member Data Documentation

◆ atEnd_

bool edm::IterWithDictBase::atEnd_
private

Definition at line 17 of file IterWithDict.h.

Referenced by advance(), IterWithDictBase(), and operator!=().

◆ iter_

TIter edm::IterWithDictBase::iter_
private

Definition at line 16 of file IterWithDict.h.

Referenced by advance(), iter(), IterWithDictBase(), and operator!=().

edm::IterWithDictBase::atEnd_
bool atEnd_
Definition: IterWithDict.h:17
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
edm::IterWithDictBase::iter_
TIter iter_
Definition: IterWithDict.h:16