ATLAS Offline Software
Loading...
Searching...
No Matches
thread_specific_ptr.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 */
17
18
19#ifndef ATHCONTAINERS_THREAD_SPECIFIC_PTR_H
20#define ATHCONTAINERS_THREAD_SPECIFIC_PTR_H
21
22
23#ifdef ATHCONTAINERS_NO_THREADS
24
25
26namespace AthContainers_detail {
27
28
32template <class T>
33class thread_specific_ptr
34{
35public:
36 thread_specific_ptr() : m_ptr(0) {}
37 ~thread_specific_ptr() { delete m_ptr; }
38 thread_specific_ptr (const thread_specific_ptr&) = delete;
39 thread_specific_ptr& operator= (const thread_specific_ptr&) = delete;
40 T* get() { return m_ptr; }
41 T* operator->() { return m_ptr; }
42 T& operator*() { return *m_ptr; }
43 const T* get() const { return m_ptr; }
44 const T* operator->() const { return m_ptr; }
45 const T& operator*() const { return *m_ptr; }
46 void reset (T* new_value=0) { delete m_ptr; m_ptr = new_value; }
47 T* release() { T* ret = m_ptr; m_ptr = 0; return ret; }
48
49private:
50 T* m_ptr;
51};
52
53
54} // namespace AthContainers_detail
55
56
57#else // not ATHCONTAINERS_NO_THREADS
58
59
60#include "boost/thread/tss.hpp"
61
62
63namespace AthContainers_detail {
64
65
66using boost::thread_specific_ptr;
67
68
69} // namespace AthContainers_detail
70
71
72
73#endif // not ATHCONTAINERS_NO_THREADS
74
75
76#endif // not ATHCONTAINERS_THREAD_SPECIFIC_PTR_H
xAOD::MissingET_v1 operator*(const xAOD::MissingET_v1 &met, float scale)
Create new MET object from source with scaled (weighted) kinematics.
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130
constexpr std::enable_if_t< is_bitmask_v< E >, E & > reset(E &lhs, E rhs)
Convenience function to clear bits in a class enum bitmask.
Definition bitmask.h:251
unsigned long long T