Macros
helper_macros.h File Reference
#include "art/Framework/Services/Registry/ServiceScope.h"
#include "art/Framework/Services/Registry/detail/ServiceHandleAllowed.h"
#include "art/Framework/Services/Registry/detail/ServiceHelper.h"
#include "art/Framework/Services/Registry/detail/ServiceWrapper.h"
#include "art/Framework/Services/Registry/detail/ServiceWrapperBase.h"
#include "art/Framework/Services/Registry/detail/ensure_only_one_thread.h"
#include "art/Utilities/SharedResourcesRegistry.h"

Go to the source code of this file.

Macros

#define ART_DETAIL_STRINGIZED_VALUE(value)   #value
 
#define ART_DETAIL_STRINGIZED_TYPE(svc)   ART_DETAIL_STRINGIZED_VALUE(svc)
 
#define DEFINE_ART_SERVICE_TYPEID(svc)    art::TypeID get_typeid() const override { return TypeID{typeid(svc)}; }
 
#define DEFINE_ART_SERVICE_SCOPE(scopeArg)
 
#define DEFINE_ART_SERVICE_RETRIEVER(svc)
 
#define DEFINE_ART_SERVICE_MAKER(svc, scopeArg)
 
#define DEFINE_ART_SERVICE_HELPER_CREATE(svc)
 
#define ART_DETAIL_DECLARE_SERVICE(svc, scopeArg)
 
#define ART_DETAIL_DECLARE_SERVICE_INTERFACE(iface, scopeArg)
 
#define ART_DETAIL_DECLARE_SERVICE_INTERFACE_IMPL(svc, iface, scopeArg)
 
#define ART_DETAIL_DECLARE_SYSTEM_SERVICE(svc, scopeArg)
 
#define DEFINE_ART_SH_CREATE(svc)   DEFINE_ART_SH_CREATE_DETAIL(svc, service)
 
#define DEFINE_ART_SIH_CREATE(svc)   DEFINE_ART_SH_CREATE_DETAIL(svc, iface)
 
#define DEFINE_ART_SH_CREATE_DETAIL(svc, type)
 

Macro Definition Documentation

#define ART_DETAIL_DECLARE_SERVICE (   svc,
  scopeArg 
)
Value:
namespace art::detail { \
template <> \
struct ServiceHelper<svc> : public ServiceImplHelper, \
public ServiceLGMHelper, \
public ServiceLGRHelper { \
DEFINE_ART_SERVICE_TYPEID(svc) \
DEFINE_ART_SERVICE_SCOPE(scopeArg) \
DEFINE_ART_SERVICE_RETRIEVER(svc) \
DEFINE_ART_SERVICE_MAKER(svc, scopeArg) \
bool \
is_interface_impl() const override \
{ \
return false; \
} \
}; \
}

Definition at line 59 of file helper_macros.h.

#define ART_DETAIL_DECLARE_SERVICE_INTERFACE (   iface,
  scopeArg 
)
Value:
namespace art::detail { \
template <> \
struct ServiceHelper<iface> : public ServiceInterfaceHelper, \
public ServiceLGRHelper { \
DEFINE_ART_SERVICE_TYPEID(iface) \
DEFINE_ART_SERVICE_SCOPE(scopeArg) \
DEFINE_ART_SERVICE_RETRIEVER(iface) \
}; \
}

Definition at line 78 of file helper_macros.h.

#define ART_DETAIL_DECLARE_SERVICE_INTERFACE_IMPL (   svc,
  iface,
  scopeArg 
)
Value:
namespace art::detail { \
template <> \
struct ServiceHelper<svc> : public ServiceInterfaceImplHelper, \
public ServiceLGMHelper, \
public ServiceLGRHelper { \
DEFINE_ART_SERVICE_TYPEID(svc) \
DEFINE_ART_SERVICE_SCOPE(scopeArg) \
DEFINE_ART_SERVICE_RETRIEVER(svc) \
DEFINE_ART_SERVICE_MAKER(svc, scopeArg) \
art::TypeID \
get_interface_typeid() const final override \
{ \
return TypeID{typeid(iface)}; \
} \
std::unique_ptr<ServiceWrapperBase> \
convert( \
std::shared_ptr<ServiceWrapperBase> const& swb) const final override \
{ \
return std::dynamic_pointer_cast<ServiceWrapper<svc>>(swb) \
->getAs<iface>(); \
} \
static_assert(is_shared(ServiceHelper<iface>::scope_val) || \
is_legacy(ServiceHelper<svc>::scope_val), \
"\n\nart error: An implementation that inherits from a " \
"LEGACY interface\n" \
" must be a LEGACY service\n\n"); \
}; \
}
constexpr bool is_shared(ServiceScope const scope) noexcept
Definition: ServiceScope.h:15
constexpr bool is_legacy(ServiceScope const scope) noexcept
Definition: ServiceScope.h:10

Definition at line 90 of file helper_macros.h.

#define ART_DETAIL_DECLARE_SYSTEM_SERVICE (   svc,
  scopeArg 
)
Value:
namespace art::detail { \
template <> \
struct ServiceHelper<svc> : public ServiceImplHelper, \
public ServiceLGRHelper { \
DEFINE_ART_SERVICE_TYPEID(svc) \
DEFINE_ART_SERVICE_SCOPE(scopeArg) \
bool \
is_interface_impl() const override \
{ \
return false; \
} \
DEFINE_ART_SERVICE_RETRIEVER(svc) \
}; \
}

Definition at line 122 of file helper_macros.h.

#define ART_DETAIL_STRINGIZED_TYPE (   svc)    ART_DETAIL_STRINGIZED_VALUE(svc)

Definition at line 16 of file helper_macros.h.

#define ART_DETAIL_STRINGIZED_VALUE (   value)    #value

Definition at line 15 of file helper_macros.h.

#define DEFINE_ART_SERVICE_HELPER_CREATE (   svc)
Value:
static std::unique_ptr<ServiceHelperBase> createHelper() \
{ \
return std::make_unique<ServiceHelper<svc>>(); \
}

Definition at line 52 of file helper_macros.h.

#define DEFINE_ART_SERVICE_MAKER (   svc,
  scopeArg 
)
Value:
std::unique_ptr<ServiceWrapperBase> make(fhicl::ParameterSet const& pset, \
ActivityRegistry& reg) \
const final override \
{ \
if constexpr (is_shared(ServiceScope::scopeArg) && \
detail::handle_allowed_v<svc>) { \
SharedResourcesRegistry::instance()->registerSharedResource( \
SharedResource<svc>); \
} else if constexpr (is_legacy(ServiceScope::scopeArg)) { \
ensure_only_one_thread(pset); \
} \
return std::make_unique<ServiceWrapper<svc>>(pset, reg); \
}
const std::string instance
unique_ptr< InputSource > make(ParameterSet const &conf, InputSourceDescription &desc)
constexpr bool is_shared(ServiceScope const scope) noexcept
Definition: ServiceScope.h:15
constexpr bool is_legacy(ServiceScope const scope) noexcept
Definition: ServiceScope.h:10
cet::registry_via_id< success_t, val > reg

Definition at line 36 of file helper_macros.h.

#define DEFINE_ART_SERVICE_RETRIEVER (   svc)
Value:
void* retrieve(std::shared_ptr<ServiceWrapperBase>& swb) \
const final override \
{ \
return &std::dynamic_pointer_cast<ServiceWrapper<svc>>(swb)->get(); \
}

Definition at line 29 of file helper_macros.h.

#define DEFINE_ART_SERVICE_SCOPE (   scopeArg)
Value:
ServiceScope scope() const override { return scope_val; } \
static constexpr ServiceScope scope_val{ServiceScope::scopeArg};
static QCString scope
Definition: declinfo.cpp:668
ServiceScope
Definition: ServiceScope.h:7

Definition at line 25 of file helper_macros.h.

#define DEFINE_ART_SERVICE_TYPEID (   svc)    art::TypeID get_typeid() const override { return TypeID{typeid(svc)}; }

Definition at line 19 of file helper_macros.h.

#define DEFINE_ART_SH_CREATE (   svc)    DEFINE_ART_SH_CREATE_DETAIL(svc, service)

Definition at line 139 of file helper_macros.h.

#define DEFINE_ART_SH_CREATE_DETAIL (   svc,
  type 
)
Value:
EXTERN_C_FUNC_DECLARE_START \
std::unique_ptr<art::detail::ServiceHelperBase> create_##type##_helper() \
{ \
return std::make_unique<art::detail::ServiceHelper<svc>>(); \
} \
EXTERN_C_FUNC_DECLARE_END

Definition at line 143 of file helper_macros.h.

#define DEFINE_ART_SIH_CREATE (   svc)    DEFINE_ART_SH_CREATE_DETAIL(svc, iface)

Definition at line 141 of file helper_macros.h.