1 #ifndef DataFormats_Common_OwnArray_h
2 #define DataFormats_Common_OwnArray_h
11 #if defined CMS_USE_DEBUGGING_ALLOCATOR
23 template <
typename T,
unsigned int MAX_SIZE,
typename P = ClonePolicy<T> >
27 typedef std::vector<T*>
base;
102 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
118 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
126 template <
typename D>
void push_back(
D*
const& d);
127 template <
typename D>
void push_back(std::auto_ptr<D> d);
137 iterator
erase(iterator pos);
143 void swap(
self& other);
146 std::vector<void const*>& pointers,
149 void setPtr(std::type_info
const& toType,
151 void const*& ptr)
const;
154 std::vector<unsigned long>
const& indices,
155 std::vector<void const*>& ptrs)
const;
167 return comp(*t1, *t2);
180 template<
typename T,
unsigned int M,
typename P>
184 template<
typename T,
unsigned int M,
typename P>
188 template<
typename T,
unsigned int M,
typename P>
189 inline OwnArray<T, M, P>::OwnArray(OwnArray<T, M, P>
const&
o) :
size_(o.
size()) {
191 for (const_iterator
i = o.begin(),
e = o.end();
i !=
e; ++
i,++
current)
195 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
196 template<
typename T,
unsigned int M,
typename P>
197 inline OwnArray<T, M, P>::OwnArray(OwnArray<T, M, P>&& o) {
198 std::swap_ranges(data_,data_+M, o.data_);
202 template<
typename T,
unsigned int M,
typename P>
207 template<
typename T,
unsigned int M,
typename P>
214 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
215 template<
typename T,
unsigned int M,
typename P>
217 std::swap_ranges(data_,data_+M, o.data_);
223 template<
typename T,
unsigned int M,
typename P>
228 template<
typename T,
unsigned int M,
typename P>
233 template<
typename T,
unsigned int M,
typename P>
238 template<
typename T,
unsigned int M,
typename P>
243 template<
typename T,
unsigned int M,
typename P>
248 template<
typename T,
unsigned int M,
typename P>
253 template<
typename T,
unsigned int M,
typename P>
258 template<
typename T,
unsigned int M,
typename P>
263 template<
typename T,
unsigned int M,
typename P>
273 template<
typename T,
unsigned int M,
typename P>
285 template<
typename T,
unsigned int M,
typename P>
288 data_[
size_++]=d.release();
292 template<
typename T,
unsigned int M,
typename P>
298 template<
typename T,
unsigned int M,
typename P>
302 delete data_[--
size_];
305 template <
typename T,
unsigned int M,
typename P>
307 return data_[
size_-1] != 0;
310 template<
typename T,
unsigned int M,
typename P>
315 "In OwnArray::back() we have intercepted an attempt to dereference a null pointer\n"
316 "Since OwnArray is allowed to contain null pointers, you much assure that the\n"
317 "pointer at the end of the collection is not null before calling back()\n"
318 "if you wish to avoid this exception.\n"
319 "Consider using OwnArray::is_back_safe()\n");
324 template<
typename T,
unsigned int M,
typename P>
329 "In OwnArray::back() we have intercepted an attempt to dereference a null pointer\n"
330 "Since OwnArray is allowed to contain null pointers, you much assure that the\n"
331 "pointer at the end of the collection is not null before calling back()\n"
332 "if you wish to avoid this exception.\n"
333 "Consider using OwnArray::is_back_safe()\n");
338 template<
typename T,
unsigned int M,
typename P>
343 template<
typename T,
unsigned int M,
typename P>
348 template<
typename T,
unsigned int M,
typename P>
355 template<
typename T,
unsigned int M,
typename P>
360 template<
typename T,
unsigned int M,
typename P>
366 template<
typename T,
unsigned int M,
typename P>
376 template<
typename T,
unsigned int M,
typename P>
387 template<
typename T,
unsigned int M,
typename P>
template<
typename S>
392 template<
typename T,
unsigned int M,
typename P>
397 template<
typename T,
unsigned int M,
typename P>
399 std::swap_ranges(data_,data_+M, other.
data_);
402 template<
typename T,
unsigned int M,
typename P>
404 std::vector<void const*>& pointers,
410 pointers.reserve(numElements);
413 for(
typename base::const_iterator
i=data_.begin(),
e=data_.end();
i!=
e; ++
i, ++
key) {
417 "In OwnArray::fillView() we have intercepted an attempt to put a null pointer\n"
418 "into a View and that is not allowed. It is probably an error that the null\n"
419 "pointer was in the OwnArray in the first place.\n");
422 pointers.push_back(*
i);
423 holder_type
h(ref_type(
id, *
i, key,
this));
429 template<
typename T,
unsigned int M,
typename P>
438 template <
typename T,
unsigned int M,
typename P>
443 std::vector<void const*>& pointers,
445 obj.
fillView(
id, pointers, helpers);
449 template <
typename T,
unsigned int M,
typename P>
457 template <
typename T,
unsigned int M,
typename P>
462 void const*& ptr)
const {
463 detail::reallySetPtr<OwnArray<T,M,P> >(*
this, toType,
index, ptr);
466 template <
typename T,
unsigned int M,
typename P>
470 std::type_info
const& toType,
473 obj.
setPtr(toType, index, ptr);
476 template <
typename T,
unsigned int M,
typename P>
480 std::vector<unsigned long>
const& indices,
481 std::vector<void const*>& ptrs)
const {
486 template <
typename T,
unsigned int M,
typename P>
490 std::type_info
const& toType,
491 std::vector<unsigned long>
const& indices,
492 std::vector<void const*>& ptrs) {
497 template <
typename T,
unsigned int M,
typename P>
void swap(ora::Record &rh, ora::Record &lh)
bool is_back_safe() const
pointer const * data() const
const_iterator & operator-=(difference_type d)
iterator operator+(difference_type n) const
bool operator<(const_iterator const &o) const
bool operator<(iterator const &o) const
const_iterator operator++(int)
void fillView(AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper > const &obj, ProductID const &id, std::vector< void const * > &pointers, helper_vector &helpers)
reference operator[](size_type)
iterator & operator-=(difference_type d)
static Ordering< O > ordering(O const &comp)
void fillPtrVector(std::vector< T, A > const &obj, std::type_info const &iToType, std::vector< unsigned long > const &iIndicies, std::vector< void const * > &oPtr)
bool operator!=(iterator const &ci) const
void setPtr(std::type_info const &toType, unsigned long index, void const *&ptr) const
const_iterator(iterator const &it)
const_iterator operator--(int)
#define CMS_CLASS_VERSION(_version_)
base::iterator::iterator_category iterator_category
size_type capacity() const
ptrdiff_t difference_type
bool operator!=(const_iterator const &ci) const
self & operator=(self const &)
void setPtr(std::vector< T, A > const &obj, std::type_info const &iToType, unsigned long iIndex, void const *&oPtr)
void reallyfillPtrVector(COLLECTION const &coll, std::type_info const &iToType, std::vector< unsigned long > const &iIndicies, std::vector< void const * > &oPtr)
bool operator()(T const *t1, T const *t2) const
bool operator==(iterator const &ci) const
T const & const_reference
reference operator[](difference_type d) const
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
difference_type operator-(iterator const &o) const
base::const_iterator::iterator_category iterator_category
void fillPtrVector(std::type_info const &toType, std::vector< unsigned long > const &indices, std::vector< void const * > &ptrs) const
T const & operator*() const
T operator[](int i) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
void fillView(ProductID const &id, std::vector< void const * > &pointers, helper_vector &helpers) const
const_iterator & operator--()
const_iterator operator+(difference_type n) const
iterator operator-(difference_type n) const
DecomposeProduct< arg, typename Div::arg > D
const_iterator & operator+=(difference_type d)
bool operator==(const_iterator const &ci) const
virtual void reserve(size_type n)=0
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
const_iterator(pointer const *it)
double S(const TLorentzVector &, const TLorentzVector &)
const_iterator & operator++()
reference operator[](difference_type d) const
iterator & operator+=(difference_type d)
iterator erase(iterator pos)
char data[epos_bytes_allocation]
ptrdiff_t difference_type
virtual void push_back(RefHolderBase const *r)=0
T const * operator->() const
T first(std::pair< T, U > const &p)
const_iterator operator-(difference_type n) const
tuple size
Write out results.
difference_type operator-(const_iterator const &o) const