ATLAS Offline Software
Loading...
Searching...
No Matches
ActsElementVector.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-2022 CERN for the benefit of the ATLAS collaboration.
4 */
11
12
13#ifndef ACTSGEOMETRY_ACTSELEMENTVECTOR_H
14#define ACTSGEOMETRY_ACTSELEMENTVECTOR_H
15
16
19#include <mutex>
20
21
30{
31public:
32 // The only thing we can do is add another element to the list.
33 // Declared const so that the thread-safety checker won't complain ---
34 // we lock the vector internally.
35 void push_back (std::shared_ptr<const ActsDetectorElement> p) const
36 {
37 std::scoped_lock lock (m_mutex);
38 m_vec.push_back (p);
39 }
40
41 // Allow access if we have a mutable reference
42 std::vector<std::shared_ptr<const ActsDetectorElement>>& vector() {
43 return m_vec;
44 }
45
46private:
47 mutable std::vector<std::shared_ptr<const ActsDetectorElement>> m_vec ATLAS_THREAD_SAFE;
48 mutable std::mutex m_mutex;
49};
50
51
52#endif // not ACTSGEOMETRY_ACTSELEMENTVECTOR_H
Define macros for attributes used to control the static checker.
Helper to hold elements for deletion.
std::vector< std::shared_ptr< const ActsDetectorElement > > & vector()
std::vector< std::shared_ptr< const ActsDetectorElement > > m_vec ATLAS_THREAD_SAFE
void push_back(std::shared_ptr< const ActsDetectorElement > p) const