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;
68 typename base::const_iterator
base_iter()
const {
return i; }
69 typename base::const_iterator
i;
98 iterator(
typename base::iterator
const& it) :
i(it) { }
99 typename base::iterator
i;
108 #if defined(__GXX_EXPERIMENTAL_CXX0X__) 118 size_type
size() const;
121 const_reference
operator[](size_type) const;
124 #if defined(__GXX_EXPERIMENTAL_CXX0X__) 129 data_.shrink_to_fit();
135 template <
typename D>
void push_back(
D*
const& d);
136 template <
typename D>
void push_back(std::unique_ptr<D> d);
139 template <
typename D>
void set(
size_t i,
D*&
d);
140 template <
typename D>
void set(
size_t i,
D*
const &
d);
141 template <
typename D>
void set(
size_t i, std::unique_ptr<D>
d);
142 void set(
size_t i, T
const& valueToCopy);
152 const_reference
back()
const;
154 const_reference
front()
const;
155 base
const&
data()
const;
167 std::vector<void const*>& pointers,
170 void setPtr(std::type_info
const& toType,
172 void const*& ptr)
const;
175 std::vector<unsigned long>
const& indices,
176 std::vector<void const*>& ptrs)
const;
188 return comp(*t1, *t2);
195 return Ordering<O>(
comp);
200 template<
typename T,
typename P>
204 template<
typename T,
typename P>
208 template<
typename T,
typename P>
210 size_type current = 0;
215 #if defined(__GXX_EXPERIMENTAL_CXX0X__) 216 template<
typename T,
typename P>
222 template<
typename T,
typename P>
227 template<
typename T,
typename P>
234 #if defined(__GXX_EXPERIMENTAL_CXX0X__) 235 template<
typename T,
typename P>
243 template<
typename T,
typename P>
248 template<
typename T,
typename P>
253 template<
typename T,
typename P>
258 template<
typename T,
typename P>
263 template<
typename T,
typename P>
268 template<
typename T,
typename P>
270 return data_.empty();
273 template<
typename T,
typename P>
278 template<
typename T,
typename P>
283 template<
typename T,
typename P>
288 template<
typename T,
typename P>
298 template<
typename T,
typename P>
309 template<
typename T,
typename P>
312 data_.push_back(d.release());
315 template<
typename T,
typename P>
320 template<
typename T,
typename P>
324 if (d ==
data_[i])
return;
330 template<
typename T,
typename P>
334 if (d ==
data_[i])
return;
339 template<
typename T,
typename P>
342 if (d.get() ==
data_[
i])
return;
347 template<
typename T,
typename P>
349 if (&d ==
data_[i])
return;
355 template<
typename T,
typename P>
362 template<
typename T,
typename P>
368 template<
typename T,
typename P>
374 template<
typename T,
typename P>
381 template<
typename T,
typename P>
389 template <
typename T,
typename P>
391 return data_.back() != 0;
394 template<
typename T,
typename P>
397 if (result ==
nullptr) {
399 "In OwnVector::back() we have intercepted an attempt to dereference a null pointer\n" 400 "Since OwnVector is allowed to contain null pointers, you much assure that the\n" 401 "pointer at the end of the collection is not null before calling back()\n" 402 "if you wish to avoid this exception.\n" 403 "Consider using OwnVector::is_back_safe()\n");
405 return *
data_.back();
408 template<
typename T,
typename P>
413 "In OwnVector::back() we have intercepted an attempt to dereference a null pointer\n" 414 "Since OwnVector is allowed to contain null pointers, you much assure that the\n" 415 "pointer at the end of the collection is not null before calling back()\n" 416 "if you wish to avoid this exception.\n" 417 "Consider using OwnVector::is_back_safe()\n");
419 return *
data_.back();
422 template<
typename T,
typename P>
424 return *
data_.front();
427 template<
typename T,
typename P>
429 return *
data_.front();
432 template<
typename T,
typename P>
434 typename base::const_iterator
b =
data_.begin(),
e =
data_.end();
435 for(
typename base::const_iterator
i = b;
i !=
e; ++
i)
439 template<
typename T,
typename P>
444 template<
typename T,
typename P>
450 template<
typename T,
typename P>
456 template<
typename T,
typename P>
458 typename base::iterator
b = first.
i,
e = last.
i;
459 for(
typename base::iterator
i = b;
i !=
e; ++
i)
464 template<
typename T,
typename P>
template<
typename S>
469 template<
typename T,
typename P>
474 template<
typename T,
typename P>
479 #if defined(__GXX_EXPERIMENTAL_CXX0X__) 480 template<
typename T,
typename P>
482 std::vector<void const*>& pointers,
484 size_type numElements = this->
size();
485 pointers.reserve(numElements);
486 helpers.reserve(numElements);
492 "In OwnVector::fillView() we have intercepted an attempt to put a null pointer\n" 493 "into a View and that is not allowed. It is probably an error that the null\n" 494 "pointer was in the OwnVector in the first place.\n");
497 pointers.push_back(*
i);
498 helpers.emplace_back(
id,key);
504 template<
typename T,
typename P>
513 template <
typename T,
typename P>
518 std::vector<void const*>& pointers,
520 obj.
fillView(
id, pointers, helpers);
524 template <
typename T,
typename P>
532 template <
typename T,
typename P>
537 void const*& ptr)
const {
538 detail::reallySetPtr<OwnVector<T,P> >(*
this, toType,
index, ptr);
541 template <
typename T,
typename P>
545 std::type_info
const& toType,
548 obj.
setPtr(toType, index, ptr);
551 template <
typename T,
typename P>
555 std::vector<unsigned long>
const& indices,
556 std::vector<void const*>& ptrs)
const {
561 template <
typename T,
typename P>
565 std::type_info
const& toType,
566 std::vector<unsigned long>
const& indices,
567 std::vector<void const*>& ptrs) {
572 template <
typename T,
typename P>
difference_type operator-(iterator const &o) const
T const * operator->() const
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
T const & operator*() const
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
#define CMS_CLASS_VERSION(_version_)
OwnVector< T, P > & operator=(OwnVector< T, P > const &)
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
auto const T2 &decltype(t1.eta()) t2
const_iterator(typename base::const_iterator const &it)
iterator erase(iterator pos)
void setPtr(std::type_info const &toType, unsigned long index, void const *&ptr) const
void set(size_t i, D *&d)
def template(fileName, svg, replaceme="REPLACEME")
ptrdiff_t difference_type
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 swap(OwnVector< T, P > &other)
void insert(const_iterator i, D *&d)
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector
const_iterator operator+(difference_type n) const
bool operator!=(const_iterator const &ci) const
const_iterator & operator+=(difference_type d)
base::iterator::iterator_category iterator_category
const_iterator operator-(difference_type n) const