ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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  */
19 #ifndef ATHCONTAINERS_THREAD_SPECIFIC_PTR_H
20 #define ATHCONTAINERS_THREAD_SPECIFIC_PTR_H
21 
22 
23 #ifdef ATHCONTAINERS_NO_THREADS
24 
25 
26 namespace AthContainers_detail {
27 
28 
32 template <class T>
33 class thread_specific_ptr
34 {
35 public:
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 
49 private:
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 
63 namespace AthContainers_detail {
64 
65 
66 using 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
columnar::operator=
AccessorTemplate & operator=(AccessorTemplate &&that)
Definition: VectorColumn.h:88
AthContainers_detail
Definition: concurrent_vector.h:54
InDetDD::operator*
SiLocalPosition operator*(const SiLocalPosition &position, const double factor)
Definition: SiLocalPosition.cxx:98
python.EventInfoMgtInit.release
release
Definition: EventInfoMgtInit.py:24
CxxUtils::reset
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
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35