1 #ifndef DataFormats_Common_OwnVector_h
2 #define DataFormats_Common_OwnVector_h
11 #if defined CMS_USE_DEBUGGING_ALLOCATOR
24 template <
typename T,
typename P = ClonePolicy<T> >
27 #if defined(CMS_USE_DEBUGGING_ALLOCATOR)
28 typedef std::vector<T*, debugging_allocator<T> >
base;
30 typedef std::vector<T*>
base;
69 typename base::const_iterator
i;
78 iterator(
typename base::iterator
const& it) :
i(it) { }
98 typename base::iterator
i;
107 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
123 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
129 data_.shrink_to_fit();
137 template <
typename D>
void push_back(std::auto_ptr<D>
d);
147 iterator
erase(iterator pos);
157 std::vector<void const*>& pointers,
160 void setPtr(std::type_info
const& toType,
162 void const*& ptr)
const;
165 std::vector<unsigned long>
const& indices,
166 std::vector<void const*>& ptrs)
const;
178 return comp(*t1, *t2);
185 return Ordering<O>(
comp);
190 template<
typename T,
typename P>
194 template<
typename T,
typename P>
198 template<
typename T,
typename P>
205 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
206 template<
typename T,
typename P>
212 template<
typename T,
typename P>
217 template<
typename T,
typename P>
224 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
225 template<
typename T,
typename P>
233 template<
typename T,
typename P>
238 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>
260 return data_.empty();
263 template<
typename T,
typename P>
268 template<
typename T,
typename P>
273 template<
typename T,
typename P>
278 template<
typename T,
typename P>
288 template<
typename T,
typename P>
300 template<
typename T,
typename P>
303 data_.push_back(d.release());
307 template<
typename T,
typename P>
313 template<
typename T,
typename P>
321 template <
typename T,
typename P>
323 return data_.back() != 0;
326 template<
typename T,
typename P>
331 "In OwnVector::back() we have intercepted an attempt to dereference a null pointer\n"
332 "Since OwnVector is allowed to contain null pointers, you much assure that the\n"
333 "pointer at the end of the collection is not null before calling back()\n"
334 "if you wish to avoid this exception.\n"
335 "Consider using OwnVector::is_back_safe()\n");
337 return *data_.back();
340 template<
typename T,
typename P>
345 "In OwnVector::back() we have intercepted an attempt to dereference a null pointer\n"
346 "Since OwnVector is allowed to contain null pointers, you much assure that the\n"
347 "pointer at the end of the collection is not null before calling back()\n"
348 "if you wish to avoid this exception.\n"
349 "Consider using OwnVector::is_back_safe()\n");
351 return *data_.back();
354 template<
typename T,
typename P>
356 return *data_.front();
359 template<
typename T,
typename P>
361 return *data_.front();
364 template<
typename T,
typename P>
366 typename base::const_iterator
b = data_.begin(),
e = data_.end();
367 for(
typename base::const_iterator
i = b;
i !=
e; ++
i)
371 template<
typename T,
typename P>
376 template<
typename T,
typename P>
382 template<
typename T,
typename P>
388 template<
typename T,
typename P>
390 typename base::iterator
b = first.
i,
e = last.
i;
391 for(
typename base::iterator
i = b;
i !=
e; ++
i)
396 template<
typename T,
typename P>
template<
typename S>
401 template<
typename T,
typename P>
406 template<
typename T,
typename P>
408 data_.swap(other.data_);
411 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
412 template<
typename T,
typename P>
414 std::vector<void const*>& pointers,
419 size_type numElements = this->
size();
420 pointers.reserve(numElements);
421 helpers.reserve(numElements);
423 for(
typename base::const_iterator
i=data_.begin(),
e=data_.end();
i!=
e; ++
i, ++
key) {
427 "In OwnVector::fillView() we have intercepted an attempt to put a null pointer\n"
428 "into a View and that is not allowed. It is probably an error that the null\n"
429 "pointer was in the OwnVector in the first place.\n");
432 pointers.push_back(*
i);
433 helpers.emplace_back(
id,key);
439 template<
typename T,
typename P>
448 template <
typename T,
typename P>
453 std::vector<void const*>& pointers,
455 obj.
fillView(
id, pointers, helpers);
459 template <
typename T,
typename P>
467 template <
typename T,
typename P>
472 void const*& ptr)
const {
473 detail::reallySetPtr<OwnVector<T,P> >(*
this, toType,
index, ptr);
476 template <
typename T,
typename P>
480 std::type_info
const& toType,
483 obj.
setPtr(toType, index, ptr);
486 template <
typename T,
typename P>
490 std::vector<unsigned long>
const& indices,
491 std::vector<void const*>& ptrs)
const {
496 template <
typename T,
typename P>
500 std::type_info
const& toType,
501 std::vector<unsigned long>
const& indices,
502 std::vector<void const*>& ptrs) {
507 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
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
#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)
void setPtr(std::type_info const &toType, unsigned long index, void const *&ptr) const
ptrdiff_t difference_type
void fillPtrVector(std::type_info const &toType, std::vector< unsigned long > const &indices, std::vector< void const * > &ptrs) const
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
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
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
double S(const TLorentzVector &, const TLorentzVector &)
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)
void swap(OwnVector< T, P > &other)
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector
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
const_iterator operator-(difference_type n) const