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  static std::shared_ptr<T> get( const std::string& name )
56  {
57  return std::dynamic_pointer_cast< T >( get( name ) );
58  }
59 
61  template< typename T >
62  static bool contains( const std::string& name )
63  {
64  return ( dynamic_cast< T* >( get( name, true ).get() ) != 0 );
65  }
66 
68  static void dumpServiceConfig ();
69 
70  }; // class ServiceStore
71 
72 } // namespace asg
73 
74 #endif
75 
76 #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:228
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