1 #ifndef DataFormats_Common_OwnVector_h
2 #define DataFormats_Common_OwnVector_h
11 #if defined CMS_USE_DEBUGGING_ALLOCATOR
12 #include "DataFormats/Common/interface/debugging_allocator.h"
23 template <
typename T,
typename P = ClonePolicy<T> >
26 #if defined(CMS_USE_DEBUGGING_ALLOCATOR)
27 typedef std::vector<T*, debugging_allocator<T> >
base;
29 typedef std::vector<T*>
base;
88 typename base::const_iterator
base_iter()
const {
return i; }
89 typename base::const_iterator
i;
139 typename base::iterator
i;
147 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
163 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
170 template <
typename D>
172 template <
typename D>
174 template <
typename D>
178 template <
typename D>
179 void set(
size_t i,
D*&
d);
180 template <
typename D>
181 void set(
size_t i,
D*
const&
d);
182 template <
typename D>
183 void set(
size_t i, std::unique_ptr<D>
d);
184 void set(
size_t i, T
const& valueToCopy);
186 template <
typename D>
188 template <
typename D>
189 void insert(const_iterator
i,
D*
const&
d);
190 template <
typename D>
191 void insert(const_iterator
i, std::unique_ptr<D>
d);
192 void insert(const_iterator
i, T
const& valueToCopy);
202 iterator
erase(iterator pos);
205 template <
typename S>
213 void setPtr(std::type_info
const& toType,
unsigned long index,
void const*& ptr)
const;
216 std::vector<unsigned long>
const&
indices,
217 std::vector<void const*>& ptrs)
const;
232 template <
typename O>
234 return Ordering<O>(
comp);
239 template <
typename T,
typename P>
242 template <
typename T,
typename P>
245 template <
typename T,
typename P>
247 size_type current = 0;
248 for (const_iterator
i = o.
begin(),
e = o.
end();
i !=
e; ++
i, ++current)
252 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
253 template <
typename T,
typename P>
259 template <
typename T,
typename P>
264 template <
typename T,
typename P>
271 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
272 template <
typename T,
typename P>
279 template <
typename T,
typename P>
284 template <
typename T,
typename P>
289 template <
typename T,
typename P>
294 template <
typename T,
typename P>
299 template <
typename T,
typename P>
304 template <
typename T,
typename P>
306 return data_.empty();
309 template <
typename T,
typename P>
314 template <
typename T,
typename P>
319 template <
typename T,
typename P>
324 template <
typename T,
typename P>
325 template <
typename D>
334 template <
typename T,
typename P>
335 template <
typename D>
344 template <
typename T,
typename P>
345 template <
typename D>
347 data_.push_back(d.release());
350 template <
typename T,
typename P>
355 template <
typename T,
typename P>
356 template <
typename D>
366 template <
typename T,
typename P>
367 template <
typename D>
376 template <
typename T,
typename P>
377 template <
typename D>
379 if (d.get() == data_[
i])
382 data_[
i] = d.release();
385 template <
typename T,
typename P>
393 template <
typename T,
typename P>
394 template <
typename D>
400 template <
typename T,
typename P>
401 template <
typename D>
406 template <
typename T,
typename P>
407 template <
typename D>
409 data_.insert(it.
base_iter(), d.release());
412 template <
typename T,
typename P>
417 template <
typename T,
typename P>
425 template <
typename T,
typename P>
427 return data_.back() != 0;
430 template <
typename T,
typename P>
433 if (result ==
nullptr) {
435 "In OwnVector::back() we have intercepted an attempt to dereference a null pointer\n"
436 "Since OwnVector is allowed to contain null pointers, you much assure that the\n"
437 "pointer at the end of the collection is not null before calling back()\n"
438 "if you wish to avoid this exception.\n"
439 "Consider using OwnVector::is_back_safe()\n");
441 return *data_.back();
444 template <
typename T,
typename P>
449 "In OwnVector::back() we have intercepted an attempt to dereference a null pointer\n"
450 "Since OwnVector is allowed to contain null pointers, you much assure that the\n"
451 "pointer at the end of the collection is not null before calling back()\n"
452 "if you wish to avoid this exception.\n"
453 "Consider using OwnVector::is_back_safe()\n");
455 return *data_.back();
458 template <
typename T,
typename P>
460 return *data_.front();
463 template <
typename T,
typename P>
465 return *data_.front();
468 template <
typename T,
typename P>
470 typename base::const_iterator
b = data_.begin(),
e = data_.end();
471 for (
typename base::const_iterator
i = b;
i !=
e; ++
i)
475 template <
typename T,
typename P>
480 template <
typename T,
typename P>
486 template <
typename T,
typename P>
492 template <
typename T,
typename P>
494 typename base::iterator
b = first.
i,
e = last.
i;
495 for (
typename base::iterator
i = b;
i !=
e; ++
i)
500 template <
typename T,
typename P>
501 template <
typename S>
503 std::sort(data_.begin(), data_.end(),
ordering(comp));
506 template <
typename T,
typename P>
508 std::sort(data_.begin(), data_.end(),
ordering(std::less<value_type>()));
511 template <
typename T,
typename P>
513 data_.swap(other.data_);
516 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
517 template <
typename T,
typename P>
519 std::vector<void const*>& pointers,
522 pointers.reserve(numElements);
523 helpers.reserve(numElements);
525 for (
typename base::const_iterator
i = data_.begin(),
e = data_.end();
i !=
e; ++
i, ++
key) {
528 "In OwnVector::fillView() we have intercepted an attempt to put a null pointer\n"
529 "into a View and that is not allowed. It is probably an error that the null\n"
530 "pointer was in the OwnVector in the first place.\n");
532 pointers.push_back(*
i);
533 helpers.emplace_back(
id, key);
539 template <
typename T,
typename P>
548 template <
typename T,
typename P>
551 std::vector<void const*>& pointers,
553 obj.
fillView(
id, pointers, helpers);
556 template <
typename T,
typename P>
563 template <
typename T,
typename P>
565 detail::reallySetPtr<OwnVector<T, P> >(*
this, toType,
index, ptr);
568 template <
typename T,
typename P>
570 obj.
setPtr(toType, index, ptr);
573 template <
typename T,
typename P>
575 std::vector<unsigned long>
const&
indices,
576 std::vector<void const*>& ptrs)
const {
580 template <
typename T,
typename P>
582 std::type_info
const& toType,
583 std::vector<unsigned long>
const&
indices,
584 std::vector<void const*>& ptrs) {
588 template <
typename T,
typename P>
difference_type operator-(iterator const &o) const
T const * operator->() const
const edm::EventSetup & c
iterator operator-(difference_type n) const
base::const_iterator::iterator_category iterator_category
const_iterator & operator++()
reference operator[](size_type)
bool operator()(T const *t1, T const *t2) const
void fillPtrVector(std::vector< T, A > const &obj, std::type_info const &iToType, std::vector< unsigned long > const &iIndicies, std::vector< void const * > &oPtr)
iterator & operator+=(difference_type d)
T const & operator*() const
iterator & operator-=(difference_type d)
void fillView(ProductID const &id, std::vector< void const * > &pointers, FillViewHelperVector &helpers) const
bool operator!=(iterator const &ci) const
bool operator==(const_iterator const &ci) const
void swap(OwnVector< T, P > &other) noexcept
#define CMS_CLASS_VERSION(_version_)
OwnVector< T, P > & operator=(OwnVector< T, P > const &)
void swap(Association< C > &lhs, Association< C > &rhs)
void setPtr(std::vector< T, A > const &obj, std::type_info const &iToType, unsigned long iIndex, void const *&oPtr)
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
void reallyfillPtrVector(COLLECTION const &coll, std::type_info const &iToType, std::vector< unsigned long > const &iIndicies, std::vector< void const * > &oPtr)
const_iterator operator--(int)
bool operator<(const_iterator const &o) const
reference operator[](difference_type d) const
bool operator<(iterator const &o) const
bool operator==(iterator const &ci) const
reference operator[](difference_type d) const
ptrdiff_t difference_type
const_iterator(typename base::const_iterator const &it)
void fillView(AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper > const &obj, ProductID const &id, std::vector< void const * > &pointers, FillViewHelperVector &helpers)
iterator erase(iterator pos)
tuple key
prepare the HTCondor submission files and eventually submit them
void setPtr(std::type_info const &toType, unsigned long index, void const *&ptr) const
void set(size_t i, D *&d)
ptrdiff_t difference_type
uint16_t *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ uint32_t *__restrict__ uint32_t const *__restrict__ int32_t *__restrict__ uint32_t numElements
void fillPtrVector(std::type_info const &toType, std::vector< unsigned long > const &indices, std::vector< void const * > &ptrs) const
const_iterator operator++(int)
bool is_back_safe() const
const_iterator(iterator const &it)
DecomposeProduct< arg, typename Div::arg > D
T const & const_reference
base::size_type size_type
std::pair< OmniClusterRef, TrackingParticleRef > P
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
base const & data() const
iterator(typename base::iterator const &it)
difference_type operator-(const_iterator const &o) const
const_iterator & operator--()
static Ordering< O > ordering(O const &comp)
iterator operator+(difference_type n) const
const_iterator & operator-=(difference_type d)
T first(std::pair< T, U > const &p)
base::const_iterator base_iter() const
void insert(const_iterator i, D *&d)
const_iterator operator+(difference_type n) const
tuple size
Write out results.
bool operator!=(const_iterator const &ci) const
const_iterator & operator+=(difference_type d)
base::iterator::iterator_category iterator_category
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector
const_iterator operator-(difference_type n) const