Macros
declaration_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/Framework/Services/Registry/detail/service_helper_macros.h"
#include "art/Utilities/SharedResource.h"
#include "canvas/Utilities/TypeID.h"
#include <memory>

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_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)
 

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 45 of file declaration_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 64 of file declaration_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 76 of file declaration_helper_macros.h.

#define ART_DETAIL_STRINGIZED_TYPE (   svc)    ART_DETAIL_STRINGIZED_VALUE(svc)

Definition at line 20 of file declaration_helper_macros.h.

#define ART_DETAIL_STRINGIZED_VALUE (   value)    #value

Definition at line 19 of file declaration_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 38 of file declaration_helper_macros.h.

#define DEFINE_ART_SERVICE_MAKER (   svc,
  scopeArg 
)
Value:
std::unique_ptr<ServiceWrapperBase> make(fhicl::ParameterSet const& pset, \
ActivityRegistry& reg, \
detail::SharedResources& resources) \
const final override \
{ \
if constexpr (is_shared(ServiceScope::scopeArg) && \
detail::handle_allowed_v<svc>) { \
resources.registerSharedResource(SharedResource<svc>); \
} else if constexpr (is_legacy(ServiceScope::scopeArg)) { \
ensure_only_one_thread(pset); \
} \
return std::make_unique<ServiceWrapper<svc>>(pset, reg); \
}
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 22 of file declaration_helper_macros.h.