Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | List of all members
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 38 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.

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  }
static QCString name
Definition: declinfo.cpp:673
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.

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.

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.

160  {
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  }
static QCString result
int find(char c, int index=0, bool cs=TRUE) const
Definition: qcstring.cpp:41
container_t products_
Definition: Sampled.h:106
constexpr exempt_ptr< E > make_exempt_ptr(E *) noexcept
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.

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

Definition at line 138 of file Sampled.h.

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

Member Data Documentation

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

Definition at line 106 of file Sampled.h.

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

Definition at line 105 of file Sampled.h.


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