ATLAS Offline Software
VDetectorParameters.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 // DetectorParameters
7 // 30-Jun-2003 Bill Seligman (WGS)
8 
9 // This routine implements a modified version of the singleton
10 // pattern. It's initialized with a pointer to some class that
11 // inherits from this one; thereafter that pointer can be accessed
12 // from any routine in the simulation.
13 
14 // Note: we're using the LArGeo namespace, which is why LArGeo:: is in
15 // front of so many names.
16 
18 #include <cstdlib>
19 #include <iostream>
20 
21 
22 CxxUtils::CachedUniquePtr<LArGeo::VDetectorParameters> LArGeo::VDetectorParameters::s_instance;
23 
24 void LArGeo::VDetectorParameters::SetInstance(std::unique_ptr<VDetectorParameters> p)
25 {
26  s_instance.set (std::move (p));
27 }
28 
30 {
31  const VDetectorParameters* p = s_instance.get();
32  if(p==nullptr)
33  std::cerr << "LArGeo::VDetectorParameters::GetInstance was called, but "
34  << "the pointer to the detector-parameter access object is 0."
35  << std::endl;
36 
37  return p;
38 }
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
LArGeo::VDetectorParameters::SetInstance
static void SetInstance(std::unique_ptr< VDetectorParameters >)
Definition: VDetectorParameters.cxx:24
LArGeo::VDetectorParameters
Definition: VDetectorParameters.h:29
CxxUtils::CachedUniquePtrT
Cached pointer with atomic update.
Definition: CachedUniquePtr.h:54
VDetectorParameters.h
LArGeo::VDetectorParameters::GetInstance
static const VDetectorParameters * GetInstance()
Definition: VDetectorParameters.cxx:29