ATLAS Offline Software
Loading...
Searching...
No Matches
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
22CxxUtils::CachedUniquePtr<LArGeo::VDetectorParameters> LArGeo::VDetectorParameters::s_instance;
23
24void 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}
static const VDetectorParameters * GetInstance()
static void SetInstance(std::unique_ptr< VDetectorParameters >)
CachedUniquePtrT< const T > CachedUniquePtr