Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
art::Wrapper< T > Class Template Reference

#include "/cvmfs/nova.opensciencegrid.org/externals/art/v2_13_00/source/art/Framework/Principal/Handle.h"

Inheritance diagram for art::Wrapper< T >:
art::EDProduct

Public Member Functions

 Wrapper ()=default
 
 Wrapper (std::unique_ptr< T > ptr)
 
virtual ~Wrapper ()=default
 
T const * product () const
 
T const * operator-> () const
 
bool isPresent () const
 
virtual std::type_info const * typeInfo () const
 
void setPtr (std::type_info const &toType, unsigned long index, void const *&ptr) const
 
void getElementAddresses (std::type_info const &toType, std::vector< unsigned long > const &indices, std::vector< void const * > &ptr) const
 
std::unique_ptr< EDProductmakePartner (std::type_info const &wanted_type) const
 
unsigned getRangeSetID () const
 
void setRangeSetID (unsigned const id)
 
void combine (EDProduct *p)
 
std::unique_ptr< EDProductcreateEmptySampledProduct (InputTag const &tag) const
 
void insertIfSampledProduct (std::string const &dataset, SubRunID const &id, std::unique_ptr< EDProduct > product)
 

Static Public Member Functions

static short Class_Version ()
 

Private Member Functions

void fillView (std::vector< void const * > &view) const override
 
std::string productSize () const override
 
void do_combine (EDProduct *product) override
 
void do_setRangeSetID (unsigned) override
 
unsigned do_getRangeSetID () const override
 
std::unique_ptr< EDProductdo_makePartner (std::type_info const &wanted_type) const override
 
std::unique_ptr< EDProductdo_createEmptySampledProduct (InputTag const &tag) const override
 
void do_insertIfSampledProduct (std::string const &dataset, SubRunID const &id, std::unique_ptr< EDProduct > product) override
 
bool isPresent_ () const override
 
std::type_info const * typeInfo_ () const override
 
void do_setPtr (std::type_info const &toType, unsigned long index, void const *&ptr) const override
 
void do_getElementAddresses (std::type_info const &toType, std::vector< unsigned long > const &indices, std::vector< void const * > &ptr) const override
 
T && refOrThrow (T *ptr)
 

Private Attributes

bool present {false}
 
unsigned rangeSetID {-1u}
 
T obj {}
 

Friends

template<typename >
struct prevent_recursion
 

Detailed Description

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

Definition at line 59 of file Handle.h.

Constructor & Destructor Documentation

template<typename T>
art::Wrapper< T >::Wrapper ( )
default
template<typename T >
art::Wrapper< T >::Wrapper ( std::unique_ptr< T ptr)
explicit

Definition at line 166 of file Wrapper.h.

References art::Wrapper< T >::obj, art::Wrapper< T >::rangeSetID, art::Wrapper< T >::refOrThrow(), T, and submit_hadd::u.

167  : present{ptr.get() != 0}, rangeSetID{-1u}, obj(refOrThrow(ptr.get()))
168 {}
unsigned rangeSetID
Definition: Wrapper.h:137
bool present
Definition: Wrapper.h:136
T && refOrThrow(T *ptr)
Definition: Wrapper.h:335
template<typename T>
virtual art::Wrapper< T >::~Wrapper ( )
virtualdefault

Member Function Documentation

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

Definition at line 92 of file Wrapper.h.

References stan::io::product(), string, getGoodRuns4SAM::tag, and POTSpillRate::view.

93  {
94  return 11;
95  }
void art::EDProduct::combine ( EDProduct p)
inlineinherited

Definition at line 81 of file EDProduct.h.

References art::EDProduct::do_combine().

82  {
83  do_combine(p);
84  }
const char * p
Definition: xmltok.h:285
virtual void do_combine(EDProduct *)=0
std::unique_ptr<EDProduct> art::EDProduct::createEmptySampledProduct ( InputTag const &  tag) const
inlineinherited

Definition at line 87 of file EDProduct.h.

References art::EDProduct::do_createEmptySampledProduct().

88  {
90  }
virtual std::unique_ptr< EDProduct > do_createEmptySampledProduct(InputTag const &tag) const =0
template<typename T >
void art::Wrapper< T >::do_combine ( art::EDProduct p)
overrideprivatevirtual

Implements art::EDProduct.

Definition at line 206 of file Wrapper.h.

References art::detail::CanBeAggregated< T, Enable >::aggregate(), art::EDProduct::isPresent(), art::Wrapper< T >::obj, and art::Wrapper< T >::present.

207 {
208  if (!p->isPresent())
209  return;
210 
211  auto wp = static_cast<Wrapper<T>*>(p);
213 
214  // The presence for the combined product is 'true', if we get this
215  // far.
216  present = true;
217 }
const char * p
Definition: xmltok.h:285
bool present
Definition: Wrapper.h:136
bool isPresent() const
Definition: EDProduct.h:30
static void aggregate(T &, T const &)
Definition: aggregate.h:54
template<typename T >
std::unique_ptr< art::EDProduct > art::Wrapper< T >::do_createEmptySampledProduct ( InputTag const &  tag) const
overrideprivatevirtual

Implements art::EDProduct.

Definition at line 295 of file Wrapper.h.

References art::prevent_recursion< T >::create_empty_sampled_product().

296 {
298 }
static std::unique_ptr< EDProduct > create_empty_sampled_product(InputTag const &tag)
Definition: Wrapper.h:250
template<typename T >
void art::Wrapper< T >::do_getElementAddresses ( std::type_info const &  toType,
std::vector< unsigned long > const &  indices,
std::vector< void const * > &  ptr 
) const
inlineoverrideprivatevirtual

Implements art::EDProduct.

Definition at line 323 of file Wrapper.h.

References art::Wrapper< T >::obj, and T.

327 {
328  std::conditional_t<has_setPtr<T>::value, DoSetPtr<T>, DoNotSetPtr<T>>
329  maybe_filler;
330  maybe_filler(this->obj, toType, indices, ptrs);
331 }
const XML_Char int const XML_Char * value
Definition: expat.h:331
template<typename T >
unsigned art::Wrapper< T >::do_getRangeSetID ( ) const
overrideprivatevirtual

Implements art::EDProduct.

Definition at line 228 of file Wrapper.h.

References art::Wrapper< T >::rangeSetID.

229 {
230  return rangeSetID;
231 }
unsigned rangeSetID
Definition: Wrapper.h:137
template<typename T >
void art::Wrapper< T >::do_insertIfSampledProduct ( std::string const &  dataset,
SubRunID const &  id,
std::unique_ptr< EDProduct product 
)
overrideprivatevirtual

Implements art::EDProduct.

Definition at line 302 of file Wrapper.h.

References art::prevent_recursion< T >::insert_if_sampled_product(), and art::Wrapper< T >::obj.

305 {
307  obj, dataset, id, move(product));
308 }
T const * product() const
Definition: Wrapper.h:172
static void insert_if_sampled_product(T &, std::string const &dataset, SubRunID const &, std::unique_ptr< EDProduct >)
Definition: Wrapper.h:257
template<typename T >
std::unique_ptr< art::EDProduct > art::Wrapper< T >::do_makePartner ( std::type_info const &  wanted_type) const
overrideprivatevirtual

Implements art::EDProduct.

Definition at line 235 of file Wrapper.h.

References art::Wrapper< T >::obj.

236 {
237  std::unique_ptr<art::EDProduct> retval;
239  DoMakePartner<T>,
240  DoNotMakePartner<T>>
241  maybe_maker;
242  retval = maybe_maker(obj, wanted_wrapper);
243  return retval;
244 }
const XML_Char int const XML_Char * value
Definition: expat.h:331
template<typename T >
void art::Wrapper< T >::do_setPtr ( std::type_info const &  toType,
unsigned long  index,
void const *&  ptr 
) const
inlineoverrideprivatevirtual

Implements art::EDProduct.

Definition at line 312 of file Wrapper.h.

References art::Wrapper< T >::obj.

315 {
316  std::conditional_t<has_setPtr<T>::value, DoSetPtr<T>, DoNotSetPtr<T>>
317  maybe_filler;
318  maybe_filler(this->obj, toType, index, ptr);
319 }
const XML_Char int const XML_Char * value
Definition: expat.h:331
template<typename T >
void art::Wrapper< T >::do_setRangeSetID ( unsigned  id)
overrideprivatevirtual

Implements art::EDProduct.

Definition at line 221 of file Wrapper.h.

References art::Wrapper< T >::rangeSetID.

222 {
223  rangeSetID = id;
224 }
::xsd::cxx::tree::id< char, ncname > id
Definition: Database.h:165
unsigned rangeSetID
Definition: Wrapper.h:137
template<typename T >
void art::Wrapper< T >::fillView ( std::vector< void const * > &  view) const
overrideprivatevirtual

Reimplemented from art::EDProduct.

Definition at line 192 of file Wrapper.h.

References art::CannotFillView< T >::fill(), art::Wrapper< T >::obj, and string.

193 {
195 }
static void fill(T const &, std::vector< void const * > &)
Definition: traits.h:143
void art::EDProduct::getElementAddresses ( std::type_info const &  toType,
std::vector< unsigned long > const &  indices,
std::vector< void const * > &  ptr 
) const
inherited
unsigned art::EDProduct::getRangeSetID ( ) const
inlineinherited

Definition at line 69 of file EDProduct.h.

References art::EDProduct::do_getRangeSetID().

70  {
71  return do_getRangeSetID();
72  }
virtual unsigned do_getRangeSetID() const =0
void art::EDProduct::insertIfSampledProduct ( std::string const &  dataset,
SubRunID const &  id,
std::unique_ptr< EDProduct product 
)
inlineinherited
bool art::EDProduct::isPresent ( ) const
inlineinherited

Definition at line 30 of file EDProduct.h.

References art::EDProduct::isPresent_().

Referenced by art::Wrapper< T >::do_combine(), and art::FileDumperOutput::printPrincipal().

31  {
32  return isPresent_();
33  }
virtual bool isPresent_() const =0
template<typename T>
bool art::Wrapper< T >::isPresent_ ( ) const
inlineoverrideprivatevirtual

Implements art::EDProduct.

Definition at line 120 of file Wrapper.h.

References allTimeWatchdog::index, art::productstatus::present(), and T.

121  {
122  return present;
123  }
bool present
Definition: Wrapper.h:136
std::unique_ptr<EDProduct> art::EDProduct::makePartner ( std::type_info const &  wanted_type) const
inlineinherited

Definition at line 63 of file EDProduct.h.

References art::EDProduct::do_makePartner().

Referenced by art::AssnsGroup::makePartner().

64  {
65  return do_makePartner(wanted_type);
66  }
virtual std::unique_ptr< EDProduct > do_makePartner(std::type_info const &wanted_type) const =0
template<typename T >
T const * art::Wrapper< T >::operator-> ( ) const

Definition at line 178 of file Wrapper.h.

References art::Wrapper< T >::product().

179 {
180  return product();
181 }
T const * product() const
Definition: Wrapper.h:172
template<typename T >
T const * art::Wrapper< T >::product ( ) const

Definition at line 172 of file Wrapper.h.

References art::Wrapper< T >::obj, and art::Wrapper< T >::present.

Referenced by art::Wrapper< T >::operator->().

173 {
174  return present ? &obj : nullptr;
175 }
bool present
Definition: Wrapper.h:136
template<typename T >
std::string art::Wrapper< T >::productSize ( ) const
overrideprivatevirtual

Reimplemented from art::EDProduct.

Definition at line 199 of file Wrapper.h.

References art::Wrapper< T >::obj.

200 {
201  return art::productSize<T>()(obj);
202 }
template<typename T >
T && art::Wrapper< T >::refOrThrow ( T ptr)
inlineprivate

Definition at line 335 of file Wrapper.h.

References art::errors::NullPointerError.

Referenced by art::Wrapper< T >::Wrapper().

336 {
337  if (ptr) {
338  return std::move(*ptr);
339  } else {
341  << "Attempt to construct " << cet::demangle_symbol(typeid(*this).name())
342  << " from nullptr.\n";
343  }
344 }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
void art::EDProduct::setPtr ( std::type_info const &  toType,
unsigned long  index,
void const *&  ptr 
) const
inherited
void art::EDProduct::setRangeSetID ( unsigned const  id)
inlineinherited

Definition at line 75 of file EDProduct.h.

References art::EDProduct::do_setRangeSetID().

76  {
77  do_setRangeSetID(id);
78  }
virtual void do_setRangeSetID(unsigned)=0
virtual std::type_info const* art::EDProduct::typeInfo ( ) const
inlinevirtualinherited

Definition at line 43 of file EDProduct.h.

References art::EDProduct::getElementAddresses(), allTimeWatchdog::index, art::EDProduct::setPtr(), string, and art::EDProduct::typeInfo_().

44  {
45  return typeInfo_();
46  }
virtual std::type_info const * typeInfo_() const =0
template<typename T >
std::type_info const * art::Wrapper< T >::typeInfo_ ( ) const
overrideprivatevirtual

Implements art::EDProduct.

Definition at line 185 of file Wrapper.h.

References art::SupportsView< T, typename >::type_id().

186 {
187  return SupportsView<T>::type_id();
188 }
static std::type_info const * type_id()
Definition: traits.h:90

Friends And Related Function Documentation

template<typename T>
template<typename >
friend struct prevent_recursion
friend

Definition at line 113 of file Wrapper.h.

Member Data Documentation

template<typename T>
T art::Wrapper< T >::obj {}
private
template<typename T>
bool art::Wrapper< T >::present {false}
private

Definition at line 136 of file Wrapper.h.

Referenced by art::Wrapper< T >::do_combine(), and art::Wrapper< T >::product().

template<typename T>
unsigned art::Wrapper< T >::rangeSetID {-1u}
private

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