All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Private Attributes | List of all members
lar::SimpleServiceProviderWrapper< PROVIDER > Class Template Reference

Service returning a provider. More...

#include <ServiceProviderWrappers.h>

Public Types

using provider_type = PROVIDER
 type of the service provider More...
 
using Parameters = art::ServiceTable< typename provider_type::Config >
 Type of configuration parameter (for art description) More...
 

Public Member Functions

 SimpleServiceProviderWrapper (Parameters const &config, art::ActivityRegistry &)
 Constructor (using a configuration table) More...
 
provider_type const * provider () const
 Returns a constant pointer to the service provider. More...
 

Private Attributes

std::unique_ptr< provider_typeprov
 service provider More...
 

Detailed Description

template<class PROVIDER>
class lar::SimpleServiceProviderWrapper< PROVIDER >

Service returning a provider.


Template Parameters
PROVIDERtype of service provider to be returned

This class provides the simplest possible art service to wrap a LArSoft service provider. The service is not reacting to any framework events.

The configuration is passed directly to the provider.

The simplest way to create an art service with this template is:

#include "larcore/CoreUtils/ServiceProviderWrappers.h"
#include "path/to/MyProvider.h"


namespace myprov {

  using MyService = lar::SimpleServiceProviderWrapper<MyProvider>;

}

DECLARE_ART_SERVICE(myprov::MyService, LEGACY)

An implementation file is necessary too, that will look like:

#include "path/to/MyService.h"

DEFINE_ART_SERVICE(myprov::MyService)

If callback registration is needed, a class can derive from this template and still gain a bit of boilerplate facility. That is:

Requirements on the service provider:

Definition at line 88 of file ServiceProviderWrappers.h.

Member Typedef Documentation

template<class PROVIDER >
using lar::SimpleServiceProviderWrapper< PROVIDER >::Parameters = art::ServiceTable<typename provider_type::Config>

Type of configuration parameter (for art description)

Definition at line 94 of file ServiceProviderWrappers.h.

template<class PROVIDER >
using lar::SimpleServiceProviderWrapper< PROVIDER >::provider_type = PROVIDER

type of the service provider

Definition at line 91 of file ServiceProviderWrappers.h.

Constructor & Destructor Documentation

template<class PROVIDER >
lar::SimpleServiceProviderWrapper< PROVIDER >::SimpleServiceProviderWrapper ( Parameters const &  config,
art::ActivityRegistry &   
)
inline

Constructor (using a configuration table)

Definition at line 99 of file ServiceProviderWrappers.h.

100  : prov(std::make_unique<provider_type>(config()))
101  {}
std::unique_ptr< provider_type > prov
service provider

Member Function Documentation

template<class PROVIDER >
provider_type const* lar::SimpleServiceProviderWrapper< PROVIDER >::provider ( ) const
inline

Returns a constant pointer to the service provider.

Definition at line 105 of file ServiceProviderWrappers.h.

105 { return prov.get(); }
std::unique_ptr< provider_type > prov
service provider

Member Data Documentation

template<class PROVIDER >
std::unique_ptr<provider_type> lar::SimpleServiceProviderWrapper< PROVIDER >::prov
private

service provider

Definition at line 110 of file ServiceProviderWrappers.h.


The documentation for this class was generated from the following file: