1 #ifndef DataFormats_Common_RefVectorBase_h 2 #define DataFormats_Common_RefVectorBase_h 29 template <
typename KEY>
38 memberPointersHolder_(rhs.memberPointersHolder_) {}
40 memberPointersHolder_(
std::
move(rhs.memberPointersHolder_)) {}
50 memberPointersHolder_ =
std::move(rhs.memberPointersHolder_);
58 product_(productID, prodPtr, prodGetter,
false), keys_() {}
72 keys_type
const&
keys()
const {
return keys_;}
75 bool empty()
const {
return keys_.empty();}
78 size_type
size()
const {
return keys_.size();}
81 product_.pushBackRefItem(product);
84 memberPointersHolder_.memberPointers().resize(keys_.size(),
nullptr);
86 memberPointersHolder_.memberPointers().push_back(product.
productPtr());
91 memberPointersHolder_.memberPointers().push_back(
nullptr);
98 size_type
capacity()
const {
return keys_.capacity();}
105 memberPointersHolder_.memberPointers().erase(memberPointersHolder_.memberPointers().begin() +
index);
106 return keys_.erase(keys_.begin() +
index);
112 memberPointersHolder_.memberPointers().clear();
118 product_.swap(
other.product_);
119 keys_.swap(
other.keys_);
120 memberPointersHolder_.memberPointers().swap(
other.memberPointersHolder_.memberPointers());
129 std::vector<
void const*> const&
memberPointers()
const {
return memberPointersHolder_.memberPointers(); }
137 template<
typename KEY>
144 template<
typename KEY>
147 return !(lhs == rhs);
151 template<
typename KEY>
void const * cachedMemberPointer(size_type idx) const
size_type size() const
Size of vector.
void swap(RefVectorBase< KEY > &other) noexcept
swap two vectors
void clear()
clear the vector
#define CMS_CLASS_VERSION(_version_)
void swap(Association< C > &lhs, Association< C > &rhs)
std::vector< void const * > const & memberPointers() const
RefVectorBase(RefVectorBase &&rhs) noexcept
~RefVectorBase() noexcept
Destructor.
RefCore const & refCore() const
Accessor for product ID and product getter.
std::vector< void const * > & memberPointers()
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
bool empty() const
Is vector empty?
void const * productPtr() const
keys_type::size_type size_type
RefVectorBase()
Default constructor needed for reading from persistent store. Not for direct use. ...
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
RefVectorMemberPointersHolder memberPointersHolder_
void pushBack(RefCore const &product, KEY const &key)
RefVectorMemberPointersHolder()
std::vector< void const * > memberPointers_
RefVectorBase & operator=(RefVectorBase const &rhs)
RefVectorBase(RefVectorBase const &rhs)
RefVectorBase(ProductID const &productID, void const *prodPtr=nullptr, EDProductGetter const *prodGetter=nullptr)
keys_type const & keys() const
Accessor for vector of keys and pointers.
RefVectorBase & operator=(RefVectorBase &&rhs) noexcept
std::vector< KEY > keys_type
keys_type::iterator eraseAtIndex(size_type index)
erase an element from the vector
void reserve(size_type n)
Reserve space for vector.
size_type capacity() const
Capacity of vector.