LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
service_helper_macros.h
Go to the documentation of this file.
1
#ifndef art_Framework_Services_Registry_detail_service_helper_macros_h
2
#define art_Framework_Services_Registry_detail_service_helper_macros_h
3
// vim: set sw=2 expandtab :
4
5
#include "
art/Framework/Services/Registry/ServiceScope.h
"
6
#include "
art/Framework/Services/Registry/detail/ServiceWrapper.h
"
7
#include "
art/Framework/Services/Registry/detail/ServiceWrapperBase.h
"
8
#include "
canvas/Utilities/TypeID.h
"
9
10
#include <memory>
11
13
// Utility for including the service type in a static_assert
14
#define ART_DETAIL_STRINGIZED_VALUE(value) #value
15
#define ART_DETAIL_STRINGIZED_TYPE(svc) ART_DETAIL_STRINGIZED_VALUE(svc)
16
17
// Define a member function returning the typeid of the service.
18
#define DEFINE_ART_SERVICE_TYPEID(svc) \
19
art::TypeID get_typeid() const override \
20
{ \
21
return TypeID{typeid(svc)}; \
22
}
23
24
// Define a member function to return the scope of the service, and a
25
// static to provide compile-time help when we have the concrete helper
26
// class instead of a base.
27
#define DEFINE_ART_SERVICE_SCOPE(scopeArg) \
28
ServiceScope scope() const override \
29
{ \
30
return scope_val; \
31
} \
32
static constexpr ServiceScope scope_val{ServiceScope::scopeArg};
33
34
#define DEFINE_ART_SERVICE_RETRIEVER(svc) \
35
void* retrieve(std::shared_ptr<ServiceWrapperBase>& swb) \
36
const final override \
37
{ \
38
return &std::dynamic_pointer_cast<ServiceWrapper<svc>>(swb)->get(); \
39
}
40
41
#endif
/* art_Framework_Services_Registry_detail_service_helper_macros_h */
42
43
// Local Variables:
44
// mode: c++
45
// End:
ServiceScope.h
ServiceWrapperBase.h
TypeID.h
ServiceWrapper.h
art
Framework
Services
Registry
detail
service_helper_macros.h
Generated on Thu May 2 2024 20:59:30 for LArSoft by
1.8.11