|
![CMS Logo](/cmsdoxygen/common/rightImage.jpg) |
Go to the documentation of this file. 1 #ifndef DataFormats_Common_Ptr_h
2 #define DataFormats_Common_Ptr_h
35 #include <type_traits>
101 :
core_(productID,
item, nullptr, transient),
key_(item_key) {}
111 template <
typename U>
125 template <
typename U>
170 void const*
product()
const {
return nullptr; }
181 if (getter !=
nullptr) {
183 unsigned int iKey =
key_;
184 if (
prod ==
nullptr) {
186 if (
prod ==
nullptr) {
187 if (throwIfNotFound) {
194 void const* ad =
nullptr;
195 prod->setPtr(
typeid(
T), iKey, ad);
204 template <
typename T>
205 template <
typename C>
207 assert(iProduct !=
nullptr);
208 typename C::const_iterator it = iProduct->begin();
209 std::advance(it, iKey);
215 template <
typename T>
218 return *reinterpret_cast<T const*>(core_.productPtr());
222 template <
typename T>
225 return reinterpret_cast<T const*>(core_.productPtr());
228 template <
typename T>
231 return hasProductCache();
234 template <
typename T>
236 return lhs.refCore() == rhs.refCore() && lhs.key() == rhs.key();
239 template <
typename T>
241 return !(lhs == rhs);
244 template <
typename T>
248 return (lhs.refCore() == rhs.refCore() ? lhs.key() < rhs.key() : lhs.refCore() < rhs.refCore());
258 template <
typename T>
261 std::vector<void const*>& pointers,
263 pointers.reserve(
obj.size());
265 for (
auto const&
p :
obj) {
266 if (
p.isAvailable()) {
267 pointers.push_back(
p.get());
269 pointers.push_back(
nullptr);
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector
T const & operator*() const
Dereference operator.
void setProductPtr(void const *prodPtr) const
bool hasProductCache() const
bool operator!() const
Checks for null.
void productNotFoundException(std::type_info const &type) const
RefCore const & refCore() const
Ptr(ProductID const &productID, T const *item, key_type item_key)
Ptr(Ptr< U > const &iOther, std::enable_if_t< std::is_base_of< U, T >::value > *=nullptr)
EDProductGetter const * productGetter() const
Accessor for product getter.
Ptr(ProductID const &productID, key_type itemKey, EDProductGetter const *prodGetter)
T const * get() const
Returns C++ pointer to the item.
Ptr(ProductID const &productID, T const *item, key_type item_key, bool transient)
virtual WrapperBase const * getIt(ProductID const &) const =0
Ptr(ProductID const &iId)
EDProductGetter const * mustBeNonZero(EDProductGetter const *prodGetter, std::string refType, ProductID const &productID)
EDProductGetter const * productGetter() const
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
#define CMS_CLASS_VERSION(_version_)
Ptr(Handle< C > const &handle, key_type itemKey, bool=true)
Ptr(Ptr< U > const &iOther, std::enable_if_t< std::is_base_of< T, U >::value > *=nullptr)
static const element_type * address(const iter &i)
ProductID id() const
Accessor for product ID.
bool isTransient() const
Checks if this Ptr is transient (i.e. not persistable).
def template(fileName, svg, replaceme="REPLACEME")
T const * operator->() const
Member dereference operator.
Ptr(C const *iProduct, key_type iItemKey, bool=true)
void const * productPtr() const
Ptr(TestHandle< C > const &handle, key_type itemKey, bool=true)
T const * getItem_(C const *product, key_type iKey)
void const * product() const
virtual WrapperBase const * getThinnedProduct(ProductID const &, unsigned int &key) const =0
void getData_(bool throwIfNotFound=true) const
bool isNonnull() const
Checks for non-null.
Ptr(OrphanHandle< C > const &handle, key_type itemKey, bool=true)
Ptr(T const *item, key_type iItemKey)
void fillView(AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper > const &obj, ProductID const &id, std::vector< void const * > &pointers, FillViewHelperVector &helpers)
bool isNull() const
Checks for null.