ATLAS Offline Software
Loading...
Searching...
No Matches
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 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4*/
11
12
13#ifndef ATHLINKS_INDEXHOLDER_H
14#define ATHLINKS_INDEXHOLDER_H
15
16
17namespace SG {
18
19
31template <class T>
33{
34public:
36 IndexHolder() : m_index(), m_valid(false) {}
37
39 IndexHolder (const T& t) : m_index(t), m_valid(true) {}
40
42 bool isValid() const { return m_valid; }
43
45 void reset() { m_valid = false; m_index = T(); }
46
48 // cppcheck-suppress returnByReference
49 operator const T&() const { return m_index; }
50
51
52private:
55
57 bool m_valid;
58};
59
60
61} // namespace SG
62
63
64#endif // not ATHLINKS_INDEXHOLDER_H
IndexHolder(const T &t)
Copy constructor.
Definition IndexHolder.h:39
void reset()
Reset the index to a null value.
Definition IndexHolder.h:45
IndexHolder()
Constructor.
Definition IndexHolder.h:36
bool isValid() const
Return valid flag.
Definition IndexHolder.h:42
Forward declaration.