ATLAS Offline Software
Loading...
Searching...
No Matches
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
27namespace 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
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:114
::StatusCode StatusCode
StatusCode definition for legacy code.
unsigned long long T