Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
art::detail::ServiceCacheEntry Class Reference

#include "/cvmfs/nova.opensciencegrid.org/externals/art/v2_13_00/source/art/Framework/Services/Registry/detail/ServiceCacheEntry.h"

Public Member Functions

 ServiceCacheEntry (fhicl::ParameterSet const &pset, std::unique_ptr< detail::ServiceHelperBase > &&helper)
 
 ServiceCacheEntry (fhicl::ParameterSet const &pset, std::unique_ptr< detail::ServiceHelperBase > &&helper, ServiceCacheEntry const &impl)
 
 ServiceCacheEntry (WrapperBase_ptr premade_service, std::unique_ptr< detail::ServiceHelperBase > &&helper)
 
WrapperBase_ptr getService (ActivityRegistry &reg, detail::ServiceStack &creationOrder) const
 
void forceCreation (ActivityRegistry &reg) const
 
fhicl::ParameterSet const & getParameterSet () const
 
template<typename T , typename = std::enable_if_t<detail::ServiceHelper<T>::scope_val != ServiceScope::PER_SCHEDULE>>
Tget (ActivityRegistry &reg, detail::ServiceStack &creationOrder) const
 
template<typename T , typename = std::enable_if_t<detail::ServiceHelper<T>::scope_val == ServiceScope::PER_SCHEDULE>>
Tget (ActivityRegistry &reg, detail::ServiceStack &creationOrder, ScheduleID sID) const
 
void registerProducts (MasterProductRegistry &mpr, ProductDescriptions &productsToProduce, ProducingServiceSignals &signals, ModuleDescription const &md)
 
bool is_impl () const
 
bool is_interface () const
 
ServiceScope serviceScope () const
 

Static Public Member Functions

static void setNSchedules (size_t nSched)
 

Private Member Functions

void makeAndCacheService (ActivityRegistry &reg) const
 
void createService (ActivityRegistry &reg, detail::ServiceStack &creationOrder) const
 
void convertService (WrapperBase_ptr &swb) const
 

Static Private Member Functions

static size_t & nSchedules ()
 

Private Attributes

fhicl::ParameterSet config_ {}
 
std::unique_ptr< detail::ServiceHelperBasehelper_
 
WrapperBase_ptr service_ {}
 
ServiceCacheEntry const *const interface_impl_ {nullptr}
 

Detailed Description

Definition at line 31 of file ServiceCacheEntry.h.

Constructor & Destructor Documentation

art::detail::ServiceCacheEntry::ServiceCacheEntry ( fhicl::ParameterSet const &  pset,
std::unique_ptr< detail::ServiceHelperBase > &&  helper 
)
art::detail::ServiceCacheEntry::ServiceCacheEntry ( fhicl::ParameterSet const &  pset,
std::unique_ptr< detail::ServiceHelperBase > &&  helper,
ServiceCacheEntry const &  impl 
)
art::detail::ServiceCacheEntry::ServiceCacheEntry ( WrapperBase_ptr  premade_service,
std::unique_ptr< detail::ServiceHelperBase > &&  helper 
)

Member Function Documentation

void art::detail::ServiceCacheEntry::convertService ( WrapperBase_ptr swb) const
inlineprivate

Definition at line 125 of file ServiceCacheEntry.h.

References ana::assert(), art::detail::ServiceInterfaceImplHelper::convert(), is_impl(), and service_.

126 {
127  assert(is_impl() &&
128  "ServiceCacheEntry::convertService called on a service interface!");
129  swb = dynamic_cast<detail::ServiceInterfaceImplHelper&>(*helper_).convert(
130  service_);
131 }
assert(nhit_max >=nhit_nbins)
void art::detail::ServiceCacheEntry::createService ( ActivityRegistry reg,
detail::ServiceStack creationOrder 
) const
inlineprivate

Definition at line 112 of file ServiceCacheEntry.h.

References ana::assert(), is_impl(), makeAndCacheService(), and service_.

115 {
116  assert(is_impl() &&
117  "ServiceCacheEntry::createService called on a service interface!");
118  // When we actually create the Service object, we have to
119  // remember the order of creation.
120  makeAndCacheService(reg);
121  creationOrder.push(service_);
122 }
assert(nhit_max >=nhit_nbins)
void makeAndCacheService(ActivityRegistry &reg) const
void art::detail::ServiceCacheEntry::forceCreation ( ActivityRegistry reg) const
inline

Definition at line 96 of file ServiceCacheEntry.h.

References ana::assert(), is_impl(), makeAndCacheService(), and service_.

97 {
98  assert(is_impl() &&
99  "ServiceCacheEntry::forceCreation called on a service interface!");
100  if (!service_) {
101  makeAndCacheService(reg);
102  }
103 }
assert(nhit_max >=nhit_nbins)
void makeAndCacheService(ActivityRegistry &reg) const
template<typename T , typename >
T & art::detail::ServiceCacheEntry::get ( ActivityRegistry reg,
detail::ServiceStack creationOrder 
) const
inline

Definition at line 141 of file ServiceCacheEntry.h.

References ana::assert(), getService(), art::PER_SCHEDULE, art::detail::ServiceLGRHelper::retrieve(), serviceScope(), and T.

143 {
145  "Called wrong service get() function: need ScheduleID");
146  WrapperBase_ptr swb = getService(reg, creationOrder);
147  return *reinterpret_cast<T*>(
148  dynamic_cast<detail::ServiceLGRHelper&>(*helper_).retrieve(swb));
149 }
std::shared_ptr< detail::ServiceWrapperBase > WrapperBase_ptr
ServiceScope serviceScope() const
WrapperBase_ptr getService(ActivityRegistry &reg, detail::ServiceStack &creationOrder) const
assert(nhit_max >=nhit_nbins)
double T
Definition: Xdiff_gwt.C:5
template<typename T , typename >
T & art::detail::ServiceCacheEntry::get ( ActivityRegistry reg,
detail::ServiceStack creationOrder,
ScheduleID  sID 
) const
inline

Definition at line 153 of file ServiceCacheEntry.h.

References ana::assert(), getService(), art::PER_SCHEDULE, art::detail::ServicePSRHelper::retrieve(), serviceScope(), and T.

156 {
158  "Called wrong service get() function!");
159  WrapperBase_ptr swb = getService(reg, creationOrder);
160  return *reinterpret_cast<T*>(
161  dynamic_cast<detail::ServicePSRHelper&>(*helper_).retrieve(swb, sID));
162 }
std::shared_ptr< detail::ServiceWrapperBase > WrapperBase_ptr
ServiceScope serviceScope() const
WrapperBase_ptr getService(ActivityRegistry &reg, detail::ServiceStack &creationOrder) const
assert(nhit_max >=nhit_nbins)
double T
Definition: Xdiff_gwt.C:5
fhicl::ParameterSet const & art::detail::ServiceCacheEntry::getParameterSet ( ) const
inline

Definition at line 106 of file ServiceCacheEntry.h.

References config_.

107 {
108  return config_;
109 }
WrapperBase_ptr art::detail::ServiceCacheEntry::getService ( ActivityRegistry reg,
detail::ServiceStack creationOrder 
) const

Referenced by get().

bool art::detail::ServiceCacheEntry::is_impl ( ) const
inline

Definition at line 178 of file ServiceCacheEntry.h.

References is_interface().

Referenced by convertService(), createService(), and forceCreation().

179 {
180  return !is_interface();
181 }
bool art::detail::ServiceCacheEntry::is_interface ( ) const
inline

Definition at line 184 of file ServiceCacheEntry.h.

References helper_.

Referenced by is_impl().

185 {
186  return helper_->is_interface();
187 }
std::unique_ptr< detail::ServiceHelperBase > helper_
void art::detail::ServiceCacheEntry::makeAndCacheService ( ActivityRegistry reg) const
private

Referenced by createService(), and forceCreation().

size_t & art::detail::ServiceCacheEntry::nSchedules ( )
inlinestaticprivate

Definition at line 171 of file ServiceCacheEntry.h.

Referenced by setNSchedules().

172 {
173  static size_t s_ns{1};
174  return s_ns;
175 }
void art::detail::ServiceCacheEntry::registerProducts ( MasterProductRegistry mpr,
ProductDescriptions productsToProduce,
ProducingServiceSignals signals,
ModuleDescription const &  md 
)
art::ServiceScope art::detail::ServiceCacheEntry::serviceScope ( ) const
inline

Definition at line 134 of file ServiceCacheEntry.h.

References helper_, and T.

Referenced by get().

135 {
136  return helper_->scope();
137 }
std::unique_ptr< detail::ServiceHelperBase > helper_
void art::detail::ServiceCacheEntry::setNSchedules ( size_t  nSched)
inlinestatic

Definition at line 165 of file ServiceCacheEntry.h.

References nSchedules().

166 {
167  nSchedules() = nSched;
168 }

Member Data Documentation

fhicl::ParameterSet art::detail::ServiceCacheEntry::config_ {}
private

Definition at line 89 of file ServiceCacheEntry.h.

Referenced by getParameterSet().

std::unique_ptr<detail::ServiceHelperBase> art::detail::ServiceCacheEntry::helper_
private

Definition at line 90 of file ServiceCacheEntry.h.

Referenced by is_interface(), and serviceScope().

ServiceCacheEntry const* const art::detail::ServiceCacheEntry::interface_impl_ {nullptr}
private

Definition at line 92 of file ServiceCacheEntry.h.

WrapperBase_ptr art::detail::ServiceCacheEntry::service_ {}
mutableprivate

Definition at line 91 of file ServiceCacheEntry.h.

Referenced by convertService(), createService(), and forceCreation().


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