LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
art::Sampled< T > Class Template Reference

#include "fwd.h"

Public Types

using const_iterator = typename container_t::const_iterator
 

Public Member Functions

 Sampled ()=default
 
 Sampled (InputTag const &tag) noexcept(false)
 
bool empty () const
 
InputTag const & originalInputTag () const
 
cet::exempt_ptr< T const > get (std::string const &dataset, RunID const &id) const
 
cet::exempt_ptr< T const > get (std::string const &dataset, SubRunID const &id) const
 
void insert (std::string const &dataset, SubRunID const &id, T &&value)
 

Static Public Member Functions

static short Class_Version ()
 

Private Types

using container_t = std::map< std::string, std::map< SubRunID, T >>
 

Private Attributes

InputTag tag_ {}
 
container_t products_ {}
 

Detailed Description

template<typename T>
class art::Sampled< T >

Definition at line 33 of file fwd.h.

Member Typedef Documentation

template<typename T>
using art::Sampled< T >::const_iterator = typename container_t::const_iterator

Definition at line 75 of file Sampled.h.

template<typename T>
using art::Sampled< T >::container_t = std::map<std::string, std::map<SubRunID, T>>
private

Definition at line 72 of file Sampled.h.

Constructor & Destructor Documentation

template<typename T>
art::Sampled< T >::Sampled ( )
default
template<typename T >
art::Sampled< T >::Sampled ( InputTag const &  tag)
explicitnoexcept

Definition at line 117 of file Sampled.h.

References art::errors::LogicError.

117  : tag_{tag}
118  {
119  // Due to Ptr reseeding issues, Assns or Ptr types (or
120  // containers thereof) are not supported. This checking cannot
121  // be done at compile time because creating a Wrapper requires a
122  // Sampled instantiation, even if that instantiation will never
123  // be used.
124  auto const type_name = cet::demangle_symbol(typeid(*this).name());
125  if (type_name.find("art::Assns") != std::string::npos ||
126  type_name.find("art::Ptr") != std::string::npos) {
128  << "An attempt was made to create the type "
129  << cet::demangle_symbol(typeid(T).name())
130  << ".\n"
131  "This is not allowed. Please contact artists@fnal.gov for "
132  "guidance.";
133  }
134  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
InputTag tag_
Definition: Sampled.h:105

Member Function Documentation

template<typename T>
static short art::Sampled< T >::Class_Version ( )
inlinestatic

Definition at line 99 of file Sampled.h.

100  {
101  return 10;
102  }
template<typename T >
bool art::Sampled< T >::empty ( ) const

Definition at line 145 of file Sampled.h.

References art::Sampled< T >::products_.

146  {
147  return products_.empty();
148  }
container_t products_
Definition: Sampled.h:106
template<typename T >
cet::exempt_ptr< T const > art::Sampled< T >::get ( std::string const &  dataset,
RunID const &  id 
) const

Definition at line 152 of file Sampled.h.

References art::SubRunID::invalidSubRun().

153  {
154  return get(dataset, SubRunID::invalidSubRun(id));
155  }
static SubRunID invalidSubRun(RunID const &rID)
Definition: SubRunID.h:165
template<typename T >
cet::exempt_ptr< T const > art::Sampled< T >::get ( std::string const &  dataset,
SubRunID const &  id 
) const

Definition at line 159 of file Sampled.h.

References art::Sampled< T >::products_.

160  {
161  cet::exempt_ptr<T const> result{nullptr};
162  auto dataset_it = products_.find(dataset);
163  if (dataset_it == products_.cend()) {
164  return result;
165  }
166 
167  auto const& ids = dataset_it->second;
168  auto id_it = ids.find(id);
169  if (id_it == ids.cend()) {
170  return result;
171  }
172 
173  return cet::make_exempt_ptr(&id_it->second);
174  }
container_t products_
Definition: Sampled.h:106
template<typename T>
void art::Sampled< T >::insert ( std::string const &  dataset,
SubRunID const &  id,
T &&  value 
)
inline

Definition at line 92 of file Sampled.h.

References art::Sampled< T >::products_, and value.

Referenced by art::prevent_recursion< Sampled< T > >::insert_if_sampled_product().

93  {
94  products_[dataset].emplace(id, std::forward<T>(value));
95  }
container_t products_
Definition: Sampled.h:106
double value
Definition: spectrum.C:18
template<typename T >
InputTag const & art::Sampled< T >::originalInputTag ( ) const

Definition at line 138 of file Sampled.h.

References art::Sampled< T >::tag_.

139  {
140  return tag_;
141  }
InputTag tag_
Definition: Sampled.h:105

Member Data Documentation

template<typename T>
container_t art::Sampled< T >::products_ {}
private
template<typename T>
InputTag art::Sampled< T >::tag_ {}
private

Definition at line 105 of file Sampled.h.

Referenced by art::Sampled< T >::originalInputTag().


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