|
|
Go to the documentation of this file. 1 #ifndef DataFormats_Common_OwnVector_h
2 #define DataFormats_Common_OwnVector_h
11 #if defined CMS_USE_DEBUGGING_ALLOCATOR
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);
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>
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>
254 inline OwnVector<T, P>::OwnVector(OwnVector<T, P>&&
o) noexcept {
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>
281 return iterator(data_.begin());
284 template <
typename T,
typename P>
286 return iterator(data_.end());
289 template <
typename T,
typename P>
291 return const_iterator(data_.begin());
294 template <
typename T,
typename P>
296 return const_iterator(data_.end());
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>
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>
396 data_.insert(it.base_iter(),
d);
400 template <
typename T,
typename P>
401 template <
typename D>
403 data_.insert(it.base_iter(),
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>
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>
489 return iterator(data_.erase(
pos.i));
492 template <
typename T,
typename P>
495 for (
typename base::iterator
i =
b;
i !=
e; ++
i)
497 return iterator(data_.erase(
b,
e));
500 template <
typename T,
typename P>
501 template <
typename S>
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);
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);
539 template <
typename T,
typename P>
548 template <
typename T,
typename P>
551 std::vector<void const*>& pointers,
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>
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>
iterator operator-(difference_type n) const
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector
base::const_iterator::iterator_category iterator_category
void fillView(ProductID const &id, std::vector< void const * > &pointers, FillViewHelperVector &helpers) const
iterator operator+(difference_type n) const
base::const_iterator base_iter() const
const_iterator & operator++()
T const & const_reference
base::size_type size_type
ptrdiff_t difference_type
ptrdiff_t difference_type
void swap(OwnVector< T, P > &a, OwnVector< T, P > &b) noexcept
static Ordering< O > ordering(O const &comp)
T first(std::pair< T, U > const &p)
void setPtr(std::type_info const &toType, unsigned long index, void const *&ptr) const
base::iterator::iterator_category iterator_category
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
bool operator<(const_iterator const &o) const
bool operator!=(const_iterator const &ci) const
void reallyfillPtrVector(COLLECTION const &coll, std::type_info const &iToType, std::vector< unsigned long > const &iIndicies, std::vector< void const * > &oPtr)
const_iterator operator-(difference_type n) const
iterator(typename base::iterator const &it)
#define CMS_CLASS_VERSION(_version_)
difference_type operator-(const_iterator const &o) const
void insert(const_iterator i, D *&d)
const_iterator(typename base::const_iterator const &it)
const_iterator operator--(int)
T const & operator*() const
bool operator<(iterator const &o) const
void fillView(OwnVector< T, P > const &obj, ProductID const &id, std::vector< void const * > &pointers, FillViewHelperVector &helpers)
void clear(HadCaloObj &c)
void fillPtrVector(std::type_info const &toType, std::vector< unsigned long > const &indices, std::vector< void const * > &ptrs) const
void setPtr(OwnVector< T, P > const &obj, std::type_info const &toType, unsigned long index, void const *&ptr)
difference_type operator-(iterator const &o) const
const_iterator operator++(int)
def template(fileName, svg, replaceme="REPLACEME")
void fillPtrVector(OwnVector< T, P > const &obj, std::type_info const &toType, std::vector< unsigned long > const &indices, std::vector< void const * > &ptrs)
const_iterator & operator--()
DecomposeProduct< arg, typename Div::arg > D
OwnVector< T, P > & operator=(OwnVector< T, P > const &)
base const & data() const
const_iterator & operator+=(difference_type d)
const_iterator(iterator const &it)
T const * operator->() const
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
reference operator[](difference_type d) const
const_iterator operator+(difference_type n) const
void swap(OwnVector< T, P > &other) noexcept
bool is_back_safe() const
char data[epos_bytes_allocation]
const_iterator & operator-=(difference_type d)
reference operator[](difference_type d) const
iterator & operator-=(difference_type d)
bool operator==(iterator const &ci) const
T operator[](int i) const
std::pair< OmniClusterRef, TrackingParticleRef > P
bool operator!=(iterator const &ci) const
iterator & operator+=(difference_type d)
bool operator==(const_iterator const &ci) const
bool operator()(T const *t1, T const *t2) const
iterator erase(iterator pos)
void set(size_t i, D *&d)