LArSoft
v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
|
Container for a list of pointers to providers. More...
#include "ProviderPack.h"
Public Member Functions | |
ProviderPack ()=default | |
Default constructor: a null provider pointer for each type. More... | |
ProviderPack (Providers const *...provider_ptrs) | |
Constructor: stores a provider pointer for each type. More... | |
template<typename... OtherProviders> | |
ProviderPack (ProviderPack< OtherProviders... > const &from) | |
Constructor: extracts the providers from another parameter pack. More... | |
template<typename... OtherProviders> | |
ProviderPack (OtherProviders const *...providers) | |
Constructor: picks the providers from the specified ones. More... | |
template<typename... PackProviders, typename... OtherProviders> | |
ProviderPack (ProviderPack< PackProviders... > const &fromPack, OtherProviders const *...providers) | |
Constructor: picks the providers from a pack plus specified ones. More... | |
template<typename Provider > | |
Provider const * | get () const |
Returns the provider with the specified type. More... | |
template<typename Provider > | |
void | set (Provider const *provider_ptr) |
Sets the provider with the specified type. More... | |
template<typename... OtherProviders> | |
bool | operator== (ProviderPack< OtherProviders... > const &other) const |
Returns whether other provider pack has all the same providers as this. More... | |
template<typename... OtherProviders> | |
bool | operator!= (ProviderPack< OtherProviders... > const &other) const |
Returns whether other provider pack and this have different providers. More... | |
Static Public Member Functions | |
template<typename Provider > | |
static constexpr bool | has () |
Returns whether there is a provider with the specified type. More... | |
template<typename... OtherProviders> | |
static constexpr bool | containsProviders () |
Returns whether all our providers are in the OfferedProviders list. More... | |
Private Types | |
using | this_type = ProviderPack< Providers... > |
alias of this class More... | |
using | tuple_type = std::tuple< Providers const *... > |
type used for storage of the pointers More... | |
Private Attributes | |
tuple_type | providers |
container of the pointers, type-safe More... | |
Container for a list of pointers to providers.
Providers | types of the providers in the parameter pack |
The pointers are stored as constant. Note that this container can host any type of objects, and it has "provider" in the name because the reason it was written was to provide a fast way to specify a set of LArSoft service providers. The only limitation is that there should be only one object per type. Pointed objects are not owned by this class.
(note that in the latter check constexpr
is supported only since C++17).
Definition at line 114 of file ProviderPack.h.
|
private |
alias of this class
Definition at line 118 of file ProviderPack.h.
|
private |
type used for storage of the pointers
Definition at line 121 of file ProviderPack.h.
|
default |
Default constructor: a null provider pointer for each type.
|
inline |
Constructor: stores a provider pointer for each type.
Definition at line 129 of file ProviderPack.h.
|
inline |
Constructor: extracts the providers from another parameter pack.
OtherProviders | list of the providers of the source provider pack |
from | where to copy the information from |
This constructor requires all the providers we need to be present in the source provider pack.
Definition at line 141 of file ProviderPack.h.
|
inline |
Constructor: picks the providers from the specified ones.
OtherProviders | list of the type of providers offered |
providers | all the providers needed (or more) |
This constructor will pick, among the offered providers, the ones that are needed.
Definition at line 157 of file ProviderPack.h.
lar::ProviderPack< Providers >::ProviderPack | ( | ProviderPack< PackProviders... > const & | fromPack, |
OtherProviders const *... | providers | ||
) |
Constructor: picks the providers from a pack plus specified ones.
FromPack | parameter pack to start from |
OtherProviders | list of the type of providers offered |
fromPack | providers to be picked |
providers | all the remaining providers needed (or more) |
This constructor will pick all the providers from the specified pack, and the ones from the other providers. This constructor can be used to "expand" from another provider:
Definition at line 687 of file ProviderPack.h.
References lar::makeProviderPack().
|
static |
Returns whether all our providers are in the OfferedProviders list.
OfferedProviders | list of offered providers |
This static function returns true if all the providers in this provider pack are included among the OfferedProviders list. That list can contain additional provider types, which will not affect the result.
Usage example:
using providers_t = lar::ProviderPack<geo::GeometryCore, detinfo::LArProperties>; static_assert( providers_t::containsProviders <detinfo::LArProperties, detinfo::DetectorProperties>(), "Not all the required providers are present." );
In this example, the assertion will fail because of the absence of detinfo::DetectorProperties
from providers_t.
Definition at line 736 of file ProviderPack.h.
References in.
|
inline |
Returns the provider with the specified type.
Definition at line 193 of file ProviderPack.h.
References lar::details::findDerivedFrom().
Referenced by opdet::FlashHypothesisCreator::CreateFlashHypothesesFromSegment(), calo::TrackCalorimetryAlg::ExtractCalorimetry(), opdet::FlashHypothesisCreator::GetFlashHypothesisCollection(), cosmic::BeamFlashTrackMatchTaggerAlg::GetMIPHypotheses(), opdet::FlashHypothesisAnaAlg::RunComparison(), cosmic::BeamFlashTrackMatchTaggerAlg::RunCompatibilityCheck(), cosmic::BeamFlashTrackMatchTaggerAlg::RunHypothesisComparison(), and detinfo::DetectorPropertiesStandard::Setup().
|
inlinestatic |
Returns whether there is a provider with the specified type.
Definition at line 212 of file ProviderPack.h.
References lar::details::hasDerivedFrom(), geo::details::operator!=(), geo::details::operator==(), and fhicl::other.
bool lar::ProviderPack< Providers >::operator!= | ( | ProviderPack< OtherProviders... > const & | other | ) | const |
Returns whether other provider pack and this have different providers.
Definition at line 729 of file ProviderPack.h.
References fhicl::other.
bool lar::ProviderPack< Providers >::operator== | ( | ProviderPack< OtherProviders... > const & | other | ) | const |
Returns whether other provider pack has all the same providers as this.
Definition at line 718 of file ProviderPack.h.
References fhicl::other.
|
inline |
Sets the provider with the specified type.
Definition at line 203 of file ProviderPack.h.
References lar::details::findDerivedFrom().
|
private |
container of the pointers, type-safe
Definition at line 251 of file ProviderPack.h.