40 : core_(iOther.core_), indicies_(iOther.indicies_), cachedItems_(nullptr) {
67 (*cachedItems_).reserve(
indicies_.capacity());
70 if (tmpCachedItems and (
indicies_.size() == (*tmpCachedItems).size())) {
72 tmpCachedItems->push_back(iData);
74 tmpCachedItems->push_back(
nullptr);
76 delete tmpCachedItems;
94 for (
auto ptr : *tmpCachedItems) {
114 if (
nullptr == tmpProductGetter) {
119 auto tmpCachedItems = std::make_unique<std::vector<void const*>>();
124 std::vector<void const*>* expected =
nullptr;
125 if (
cachedItems_.compare_exchange_strong(expected, tmpCachedItems.get())) {
127 tmpCachedItems.release();
133 tmpCachedItems->resize(
indicies_.size(),
nullptr);
135 std::vector<unsigned int> thinnedKeys;
137 std::vector<WrapperBase const*> wrappers(
indicies_.size(),
nullptr);
138 tmpProductGetter->getThinnedProducts(
id(), wrappers, thinnedKeys);
139 unsigned int nWrappers = wrappers.size();
141 assert(wrappers.size() == tmpCachedItems->size());
142 for (
unsigned k = 0;
k < nWrappers; ++
k) {
143 if (wrappers[
k] !=
nullptr) {
144 wrappers[
k]->setPtr(
typeInfo(), thinnedKeys[
k], (*tmpCachedItems)[
k]);
148 std::vector<void const*>* expected =
nullptr;
149 if (
cachedItems_.compare_exchange_strong(expected, tmpCachedItems.get())) {
151 tmpCachedItems.release();
162 if (
item ==
nullptr) {
164 <<
"Asked for data from a PtrVector which refers to a non-existent product with ProductID " <<
id() <<
"\n";
void push_back_base(RefCore const &core, key_type iKey, void const *iData)
void pushBackItem(RefCore const &productToBeInserted, bool checkPointer)
EDProductGetter const * productGetter() const
Accessor for product getter.
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
void swap(RefCore &) noexcept
void swap(PtrVectorBase &other)
swap
static const std::vector< void const * > s_emptyCache
bool equal(const T &first, const T &second)
bool operator==(PtrVectorBase const &iRHS) const
void const * product() const
std::vector< key_type > indicies_
std::atomic< std::vector< void const * > * > cachedItems_
bool checkCachedItems() const
ProductID id() const
Accessor for product ID.
static const std::vector< void const * > & emptyCache()
virtual std::type_info const & typeInfo() const