CMS 3D CMS Logo

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

#include <Product.h>

Inheritance diagram for edm::Wrapper< T >:
edm::WrapperBase edm::ViewTypeChecker

Public Types

typedef T value_type
 
typedef T wrapped_type
 

Public Member Functions

TbareProduct ()
 
T const * operator-> () const
 
Wrapper< T > & operator= (Wrapper< T > const &)=delete
 
T const * product () const
 
 Wrapper ()
 
 Wrapper (std::unique_ptr< T > ptr)
 
 Wrapper (Wrapper< T > const &rh)=delete
 
template<typename... Args>
 Wrapper (Emplace, Args &&...)
 
 Wrapper (T *)
 
template<typename... Args>
 Wrapper (Emplace, Args &&... args)
 
 ~Wrapper () override
 
- Public Member Functions inherited from edm::WrapperBase
std::type_info const & dynamicTypeInfo () const
 
void fillPtrVector (std::type_info const &iToType, std::vector< unsigned long > const &iIndicies, std::vector< void const *> &oPtr) const
 
void fillView (ProductID const &id, std::vector< void const *> &view, FillViewHelperVector &helpers) const
 
bool hasIsProductEqual () const
 
bool hasSwap () const
 
bool isMergeable () const
 
bool isPresent () const
 
bool isProductEqual (WrapperBase const *newProduct) const
 
bool mergeProduct (WrapperBase const *newProduct)
 
bool sameType (WrapperBase const &other) const
 
void setPtr (std::type_info const &iToType, unsigned long iIndex, void const *&oPtr) const
 
void swapProduct (WrapperBase *newProduct)
 
std::shared_ptr< soa::TableExaminerBasetableExaminer () const
 
std::type_info const & wrappedTypeInfo () const
 
 WrapperBase ()
 
 ~WrapperBase () override
 
- Public Member Functions inherited from edm::ViewTypeChecker
std::type_info const & memberTypeInfo () const
 
std::type_info const & valueTypeInfo () const
 
 ViewTypeChecker ()
 
virtual ~ViewTypeChecker ()
 

Static Public Member Functions

static short Class_Version ()
 
static std::type_info const & productTypeInfo ()
 
static std::type_info const & typeInfo ()
 

Private Member Functions

void do_fillPtrVector (std::type_info const &iToType, std::vector< unsigned long > const &iIndices, std::vector< void const *> &oPtr) const override
 
void do_fillView (ProductID const &id, std::vector< void const *> &pointers, FillViewHelperVector &helpers) const override
 
void do_setPtr (std::type_info const &iToType, unsigned long iIndex, void const *&oPtr) const override
 
std::type_info const & dynamicTypeInfo_ () const override
 
bool hasIsProductEqual_ () const override
 
bool hasSwap_ () const override
 
bool isMergeable_ () const override
 
bool isPresent_ () const override
 
bool isProductEqual_ (WrapperBase const *newProduct) const override
 
std::type_info const & memberTypeInfo_ () const override
 
bool mergeProduct_ (WrapperBase const *newProduct) override
 
void swapProduct_ (WrapperBase *newProduct) override
 
std::shared_ptr< soa::TableExaminerBasetableExaminer_ () const override
 
std::type_info const & valueTypeInfo_ () const override
 
std::type_info const & wrappedTypeInfo_ () const override
 

Private Attributes

T obj
 
bool present
 

Detailed Description

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

Definition at line 10 of file Product.h.

Member Typedef Documentation

◆ value_type

template<typename T>
typedef T edm::Wrapper< T >::value_type

Definition at line 26 of file Wrapper.h.

◆ wrapped_type

template<typename T>
typedef T edm::Wrapper< T >::wrapped_type

Definition at line 27 of file Wrapper.h.

Constructor & Destructor Documentation

◆ Wrapper() [1/6]

template<typename T>
edm::Wrapper< T >::Wrapper ( )
inline

Definition at line 28 of file Wrapper.h.

28 : WrapperBase(), obj(), present(false) {}
bool present
Definition: Wrapper.h:77

◆ Wrapper() [2/6]

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

Definition at line 81 of file Wrapper.h.

81  : WrapperBase(), obj(), present(ptr.get() != nullptr) {
82  if (present) {
83  obj = std::move(*ptr);
84  }
85  }
bool present
Definition: Wrapper.h:77
def move(src, dest)
Definition: eostools.py:511

◆ Wrapper() [3/6]

template<typename T>
edm::Wrapper< T >::Wrapper ( Wrapper< T > const &  rh)
delete

◆ Wrapper() [4/6]

template<typename T>
template<typename... Args>
edm::Wrapper< T >::Wrapper ( Emplace  ,
Args &&  ... 
)
explicit

◆ ~Wrapper()

template<typename T>
edm::Wrapper< T >::~Wrapper ( )
inlineoverride

Definition at line 35 of file Wrapper.h.

35 {}

◆ Wrapper() [5/6]

template<typename T>
edm::Wrapper< T >::Wrapper ( T ptr)

Definition at line 92 of file Wrapper.h.

92  : WrapperBase(), present(ptr != 0), obj() {
93  std::unique_ptr<T> temp(ptr);
94  if (present) {
95  obj = std::move(*ptr);
96  }
97  }
bool present
Definition: Wrapper.h:77
def move(src, dest)
Definition: eostools.py:511

◆ Wrapper() [6/6]

template<typename T>
template<typename... Args>
edm::Wrapper< T >::Wrapper ( Emplace  ,
Args &&...  args 
)

Definition at line 89 of file Wrapper.h.

89 : WrapperBase(), obj(std::forward<Args>(args)...), present(true) {}
bool present
Definition: Wrapper.h:77

Member Function Documentation

◆ bareProduct()

template<typename T>
T& edm::Wrapper< T >::bareProduct ( )
inline

Definition at line 39 of file Wrapper.h.

39 { return obj; }

◆ Class_Version()

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

Definition at line 49 of file Wrapper.h.

51 :
52  bool isPresent_() const override { return present; }
bool isPresent_() const override
Definition: Wrapper.h:52
bool present
Definition: Wrapper.h:77

◆ do_fillPtrVector()

template<typename T>
void edm::Wrapper< T >::do_fillPtrVector ( std::type_info const &  iToType,
std::vector< unsigned long > const &  iIndices,
std::vector< void const *> &  oPtr 
) const
overrideprivatevirtual

Implements edm::WrapperBase.

◆ do_fillView()

template<typename T>
void edm::Wrapper< T >::do_fillView ( ProductID const &  id,
std::vector< void const *> &  pointers,
FillViewHelperVector helpers 
) const
overrideprivatevirtual

Implements edm::WrapperBase.

◆ do_setPtr()

template<typename T>
void edm::Wrapper< T >::do_setPtr ( std::type_info const &  iToType,
unsigned long  iIndex,
void const *&  oPtr 
) const
overrideprivatevirtual

Implements edm::WrapperBase.

◆ dynamicTypeInfo_()

template<typename T>
std::type_info const& edm::Wrapper< T >::dynamicTypeInfo_ ( ) const
inlineoverrideprivatevirtual

Implements edm::WrapperBase.

Definition at line 53 of file Wrapper.h.

53 { return typeid(T); }
long double T

◆ hasIsProductEqual_()

template<typename T >
bool edm::Wrapper< T >::hasIsProductEqual_ ( ) const
inlineoverrideprivatevirtual

Implements edm::WrapperBase.

Definition at line 128 of file Wrapper.h.

128  {
129  if constexpr (requires(T& a, T const& b) { a.isProductEqual(b); }) {
130  return true;
131  }
132  return false;
133  }
requires requires
Definition: RefToBase.h:238
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
long double T

◆ hasSwap_()

template<typename T >
bool edm::Wrapper< T >::hasSwap_ ( ) const
inlineoverrideprivatevirtual

Implements edm::WrapperBase.

Definition at line 146 of file Wrapper.h.

146  {
147  if constexpr (requires(T& a, T& b) { a.swap(b); }) {
148  return true;
149  }
150  return false;
151  }
requires requires
Definition: RefToBase.h:238
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
long double T

◆ isMergeable_()

template<typename T >
bool edm::Wrapper< T >::isMergeable_ ( ) const
inlineoverrideprivatevirtual

Implements edm::WrapperBase.

Definition at line 110 of file Wrapper.h.

110  {
111  if constexpr (requires(T& a, T const& b) { a.mergeProduct(b); }) {
112  return true;
113  }
114  return false;
115  }
requires requires
Definition: RefToBase.h:238
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
long double T

◆ isPresent_()

template<typename T>
bool edm::Wrapper< T >::isPresent_ ( ) const
inlineoverrideprivatevirtual

Reimplemented from edm::WrapperBase.

Definition at line 52 of file Wrapper.h.

52 { return present; }
bool present
Definition: Wrapper.h:77

◆ isProductEqual_()

template<typename T >
bool edm::Wrapper< T >::isProductEqual_ ( WrapperBase const *  newProduct) const
inlineoverrideprivatevirtual

Implements edm::WrapperBase.

Definition at line 136 of file Wrapper.h.

136  {
137  Wrapper<T> const* wrappedNewProduct = dynamic_cast<Wrapper<T> const*>(newProduct);
138  assert(wrappedNewProduct != nullptr);
139  if constexpr (requires(T& a, T const& b) { a.isProductEqual(b); }) {
140  return obj.isProductEqual(wrappedNewProduct->obj);
141  }
142  return true;
143  }
requires requires
Definition: RefToBase.h:238
assert(be >=bs)
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
long double T

◆ memberTypeInfo_()

template<typename T >
std::type_info const & edm::Wrapper< T >::memberTypeInfo_ ( ) const
inlineoverrideprivatevirtual

Implements edm::ViewTypeChecker.

Definition at line 105 of file Wrapper.h.

105  {
106  return detail::getMemberType<T>()();
107  }

◆ mergeProduct_()

template<typename T >
bool edm::Wrapper< T >::mergeProduct_ ( WrapperBase const *  newProduct)
inlineoverrideprivatevirtual

Implements edm::WrapperBase.

Definition at line 118 of file Wrapper.h.

118  {
119  Wrapper<T> const* wrappedNewProduct = dynamic_cast<Wrapper<T> const*>(newProduct);
120  assert(wrappedNewProduct != nullptr);
121  if constexpr (requires(T& a, T const& b) { a.mergeProduct(b); }) {
122  return obj.mergeProduct(wrappedNewProduct->obj);
123  }
124  return true;
125  }
requires requires
Definition: RefToBase.h:238
assert(be >=bs)
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
long double T

◆ operator->()

template<typename T>
T const* edm::Wrapper< T >::operator-> ( ) const
inline

Definition at line 37 of file Wrapper.h.

37 { return product(); }
T const * product() const
Definition: Wrapper.h:36

◆ operator=()

template<typename T>
Wrapper<T>& edm::Wrapper< T >::operator= ( Wrapper< T > const &  )
delete

◆ product()

template<typename T>
T const* edm::Wrapper< T >::product ( ) const
inline

Definition at line 36 of file Wrapper.h.

Referenced by edm::Wrapper< OpticalAlignments >::operator->().

36 { return (present ? &obj : nullptr); }
bool present
Definition: Wrapper.h:77

◆ productTypeInfo()

template<typename T>
static std::type_info const& edm::Wrapper< T >::productTypeInfo ( )
inlinestatic

Definition at line 42 of file Wrapper.h.

42 { return typeid(T); }
long double T

◆ swapProduct_()

template<typename T >
void edm::Wrapper< T >::swapProduct_ ( WrapperBase newProduct)
inlineoverrideprivatevirtual

Implements edm::WrapperBase.

Definition at line 154 of file Wrapper.h.

154  {
155  Wrapper<T>* wrappedNewProduct = dynamic_cast<Wrapper<T>*>(newProduct);
156  assert(wrappedNewProduct != nullptr);
157  if constexpr (requires(T& a, T& b) { a.swap(b); }) {
158  obj.swap(wrappedNewProduct->obj);
159  }
160  }
requires requires
Definition: RefToBase.h:238
assert(be >=bs)
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
long double T

◆ tableExaminer_()

template<typename T >
std::shared_ptr< edm::soa::TableExaminerBase > edm::Wrapper< T >::tableExaminer_ ( ) const
inlineoverrideprivatevirtual

Implements edm::WrapperBase.

Definition at line 171 of file Wrapper.h.

171  {
173  }
static std::shared_ptr< edm::soa::TableExaminerBase > make(void const *)
Definition: Wrapper.h:165

◆ typeInfo()

template<typename T>
static std::type_info const& edm::Wrapper< T >::typeInfo ( )
inlinestatic

◆ valueTypeInfo_()

template<typename T >
std::type_info const & edm::Wrapper< T >::valueTypeInfo_ ( ) const
inlineoverrideprivatevirtual

Implements edm::ViewTypeChecker.

Definition at line 100 of file Wrapper.h.

100  {
101  return detail::getValueType<T>()();
102  }

◆ wrappedTypeInfo_()

template<typename T>
std::type_info const& edm::Wrapper< T >::wrappedTypeInfo_ ( ) const
inlineoverrideprivatevirtual

Implements edm::WrapperBase.

Definition at line 54 of file Wrapper.h.

54 { return typeid(Wrapper<T>); }

Member Data Documentation

◆ obj

template<typename T>
T edm::Wrapper< T >::obj
private

◆ present

template<typename T>
bool edm::Wrapper< T >::present
private