ATLAS Offline Software
IndexHolder.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // $Id$
16 #ifndef ATHLINKS_INDEXHOLDER_H
17 #define ATHLINKS_INDEXHOLDER_H
18 
19 
20 namespace SG {
21 
22 
34 template <class T>
36 {
37 public:
39  IndexHolder() : m_index(), m_valid(false) {}
40 
42  IndexHolder (const T& t) : m_index(t), m_valid(true) {}
43 
45  bool isValid() const { return m_valid; }
46 
48  void reset() { m_valid = false; m_index = T(); }
49 
51  operator const T&() const { return m_index; }
52 
53 
54 private:
57 
59  bool m_valid;
60 };
61 
62 
63 } // namespace SG
64 
65 
66 #endif // not ATHLINKS_INDEXHOLDER_H
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SG::IndexHolder::IndexHolder
IndexHolder(const T &t)
Copy constructor.
Definition: IndexHolder.h:42
SG::IndexHolder::m_index
T m_index
The stored index.
Definition: IndexHolder.h:56
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::IndexHolder::reset
void reset()
Reset the index to a null value.
Definition: IndexHolder.h:48
SG::IndexHolder::IndexHolder
IndexHolder()
Constructor.
Definition: IndexHolder.h:39
SG::IndexHolder::m_valid
bool m_valid
True if the index is valid.
Definition: IndexHolder.h:59
SG::IndexHolder
Store an ElementLink index for non-vector containers.
Definition: IndexHolder.h:36
SG::IndexHolder::isValid
bool isValid() const
Return valid flag.
Definition: IndexHolder.h:45