ATLAS Offline Software
ServiceStore.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
9 
10 
11 #ifndef ASGSERVICES_SERVICESTORE_H
12 #define ASGSERVICES_SERVICESTORE_H
13 
14 #ifndef XAOD_STANDALONE
15 // cppcheck-suppress preprocessorErrorDirective
16 #error "This header should only be used in XAOD_STANDALONE"
17 #else
18 
19 // System include(s):
20 #include <memory>
21 #include <string>
22 
23 // Local include(s):
26 
27 namespace asg
28 {
29 
42 
43  class ServiceStore final
44  {
45  public:
48  static StatusCode put( const std::shared_ptr<IAsgService>& pservice );
49 
51  static std::shared_ptr<IAsgService> get( const std::string& name, bool silent = false );
52 
54  template< typename T >
55  // cppcheck-suppress constStatement; false positive
56  static std::shared_ptr<T> get( const std::string& name )
57  {
58  return std::dynamic_pointer_cast< T >( get( name ) );
59  }
60 
62  template< typename T >
63  static bool contains( const std::string& name )
64  {
65  return ( dynamic_cast< T* >( get( name, true ).get() ) != 0 );
66  }
67 
69  static void dumpServiceConfig ();
70 
71  }; // class ServiceStore
72 
73 } // namespace asg
74 
75 #endif
76 
77 #endif // ASGSERVICES_SERVICESTORE_H
asg
Definition: DataHandleTestTool.h:28
EL::Detail::ManagerStep::final
@ final
IAsgService.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
contains
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition: hcg.cxx:111
StatusCode.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
python.trfDecorators.silent
def silent(func)
Redirect stdout/err to /dev/null Useful wrapper to get rid of ROOT verbosity...
Definition: trfDecorators.py:24
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