CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes
edm::OwnArray< T, MAX_SIZE, P > Class Template Reference

#include <OwnArray.h>

Classes

class  const_iterator
 
class  iterator
 
struct  Ordering
 

Public Types

typedef T const & const_reference
 
typedef Tpointer
 
typedef P policy_type
 
typedef Treference
 
typedef unsigned int size_type
 
typedef T value_type
 

Public Member Functions

reference back ()
 
const_reference back () const
 
iterator begin ()
 
const_iterator begin () const
 
size_type capacity () const
 
void clear ()
 
const pointerdata () const
 
bool empty () const
 
iterator end ()
 
const_iterator end () const
 
iterator erase (iterator first, iterator last)
 
iterator erase (iterator pos)
 
void fillPtrVector (std::type_info const &toType, std::vector< unsigned long > const &indices, std::vector< void const * > &ptrs) const
 
void fillView (ProductID const &id, std::vector< void const * > &pointers, FillViewHelperVector &helpers) const
 
reference front ()
 
const_reference front () const
 
bool is_back_safe () const
 
selfoperator= (self const &)
 
reference operator[] (size_type)
 
const_reference operator[] (size_type) const
 
 OwnArray ()
 
 OwnArray (OwnArray const &)
 
 OwnArray (size_type)
 
void pop_back ()
 
template<typename D >
void push_back (D *&d)
 
template<typename D >
void push_back (D *const &d)
 
template<typename D >
void push_back (std::unique_ptr< D > d)
 
void push_back (T const &valueToCopy)
 
void reserve (size_t)
 
void setPtr (std::type_info const &toType, unsigned long index, void const *&ptr) const
 
size_type size () const
 
void sort ()
 
template<typename S >
void sort (S s)
 
void swap (self &other)
 
 ~OwnArray ()
 

Static Public Member Functions

static short Class_Version ()
 

Private Types

typedef std::vector< T * > base
 
typedef OwnArray< T, MAX_SIZE, Pself
 

Private Member Functions

void destroy ()
 

Static Private Member Functions

template<typename O >
static Ordering< O > ordering (O const &comp)
 

Private Attributes

pointer data_ [MAX_SIZE]
 
size_type size_
 

Detailed Description

template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
class edm::OwnArray< T, MAX_SIZE, P >

Definition at line 24 of file OwnArray.h.

Member Typedef Documentation

◆ base

template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
typedef std::vector<T*> edm::OwnArray< T, MAX_SIZE, P >::base
private

Definition at line 27 of file OwnArray.h.

◆ const_reference

template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
typedef T const& edm::OwnArray< T, MAX_SIZE, P >::const_reference

Definition at line 33 of file OwnArray.h.

◆ pointer

template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
typedef T* edm::OwnArray< T, MAX_SIZE, P >::pointer

Definition at line 31 of file OwnArray.h.

◆ policy_type

template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
typedef P edm::OwnArray< T, MAX_SIZE, P >::policy_type

Definition at line 34 of file OwnArray.h.

◆ reference

template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
typedef T& edm::OwnArray< T, MAX_SIZE, P >::reference

Definition at line 32 of file OwnArray.h.

◆ self

template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
typedef OwnArray<T,MAX_SIZE,P> edm::OwnArray< T, MAX_SIZE, P >::self
private

Definition at line 26 of file OwnArray.h.

◆ size_type

template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
typedef unsigned int edm::OwnArray< T, MAX_SIZE, P >::size_type

Definition at line 29 of file OwnArray.h.

◆ value_type

template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
typedef T edm::OwnArray< T, MAX_SIZE, P >::value_type

Definition at line 30 of file OwnArray.h.

Constructor & Destructor Documentation

◆ OwnArray() [1/3]

template<typename T , unsigned int M, typename P >
edm::OwnArray< T, M, P >::OwnArray ( )
inline

Definition at line 181 of file OwnArray.h.

181  : data_{{0}}, size_(0) {
182  }

◆ OwnArray() [2/3]

template<typename T , unsigned int M, typename P >
edm::OwnArray< T, M, P >::OwnArray ( size_type  n)
inline

Definition at line 185 of file OwnArray.h.

185  : data_{{0}}, size_(n) {
186  }

◆ OwnArray() [3/3]

template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
edm::OwnArray< T, MAX_SIZE, P >::OwnArray ( OwnArray< T, MAX_SIZE, P > const &  )

◆ ~OwnArray()

template<typename T , unsigned int M, typename P >
edm::OwnArray< T, M, P >::~OwnArray ( )
inline

Definition at line 203 of file OwnArray.h.

203  {
204  destroy();
205  }

Member Function Documentation

◆ back() [1/2]

template<typename T , unsigned int M, typename P >
OwnArray< T, M, P >::reference edm::OwnArray< T, M, P >::back ( )
inline

Definition at line 311 of file OwnArray.h.

311  {
312  pointer result = data_[size_-1];
313  if (result == 0) {
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");
320  }
321  return *result;
322  }

References edm::errors::NullPointerError, mps_fire::result, and edm::Exception::throwThis().

◆ back() [2/2]

template<typename T , unsigned int M, typename P >
OwnArray< T, M, P >::const_reference edm::OwnArray< T, M, P >::back ( ) const
inline

Definition at line 325 of file OwnArray.h.

325  {
326  pointer const * result = data_[size_-1];
327  if (result == 0) {
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");
334  }
335  return *result;
336  }

References edm::errors::NullPointerError, mps_fire::result, and edm::Exception::throwThis().

◆ begin() [1/2]

template<typename T , unsigned int M, typename P >
OwnArray< T, M, P >::iterator edm::OwnArray< T, M, P >::begin ( void  )
inline

Definition at line 224 of file OwnArray.h.

224  {
225  return iterator(data_);
226  }

◆ begin() [2/2]

template<typename T , unsigned int M, typename P >
OwnArray< T, M, P >::const_iterator edm::OwnArray< T, M, P >::begin ( void  ) const
inline

Definition at line 234 of file OwnArray.h.

234  {
235  return const_iterator(data_);
236  }

◆ capacity()

template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
size_type edm::OwnArray< T, MAX_SIZE, P >::capacity ( ) const
inline

Definition at line 124 of file OwnArray.h.

124 { return MAX_SIZE;}

References pixelgpudetails::MAX_SIZE.

◆ Class_Version()

template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
static short edm::OwnArray< T, MAX_SIZE, P >::Class_Version ( )
inlinestatic

Definition at line 159 of file OwnArray.h.

161 :
162  void destroy();

◆ clear()

template<typename T , unsigned int M, typename P >
void edm::OwnArray< T, M, P >::clear ( void  )
inline

Definition at line 361 of file OwnArray.h.

361  {
362  destroy();
363  size_=0;
364  }

Referenced by BeautifulSoup.Tag::setString().

◆ data()

template<typename T , unsigned int M, typename P >
const OwnArray< T, M, P >::pointer * edm::OwnArray< T, M, P >::data ( ) const
inline

Definition at line 356 of file OwnArray.h.

356  {
357  return data_;
358  }

◆ destroy()

template<typename T , unsigned int M, typename P >
void edm::OwnArray< T, M, P >::destroy ( )
inlineprivate

Definition at line 349 of file OwnArray.h.

349  {
350  pointer * b = data_, * e = data_+size();
351  for(pointer * i = b; i != e; ++ i)
352  delete * i;
353  }

References b, MillePedeFileConverter_cfg::e, mps_fire::i, and findQualityFiles::size.

◆ empty()

template<typename T , unsigned int M, typename P >
bool edm::OwnArray< T, M, P >::empty ( ) const
inline

Definition at line 249 of file OwnArray.h.

249  {
250  return 0==size_;
251  }

◆ end() [1/2]

template<typename T , unsigned int M, typename P >
OwnArray< T, M, P >::iterator edm::OwnArray< T, M, P >::end ( void  )
inline

Definition at line 229 of file OwnArray.h.

229  {
230  return iterator(data_+size());
231  }

References findQualityFiles::size.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

◆ end() [2/2]

template<typename T , unsigned int M, typename P >
OwnArray< T, M, P >::const_iterator edm::OwnArray< T, M, P >::end ( void  ) const
inline

Definition at line 239 of file OwnArray.h.

239  {
240  return const_iterator(data_+size());
241  }

References findQualityFiles::size.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

◆ erase() [1/2]

template<typename T , unsigned int M, typename P >
OwnArray< T, M, P >::iterator edm::OwnArray< T, M, P >::erase ( iterator  first,
iterator  last 
)

Definition at line 377 of file OwnArray.h.

377  {
378  pointer * b = first.i, * e = last.i;
379  for(pointer * i = b; i != e; ++ i) delete * i;
380  pointer * l = data_+size();
381  auto ib=b;
382  for(pointer * i = e; i != l; ++i) *(ib++) = *i;
383  size_ -= (e-b);
384  return iterator(b);
385  }

References b, MillePedeFileConverter_cfg::e, edm::first(), mps_fire::i, cuy::ib, cmsLHEtoEOSManager::l, dqmdumpme::last, and findQualityFiles::size.

◆ erase() [2/2]

template<typename T , unsigned int M, typename P >
OwnArray< T, M, P >::iterator edm::OwnArray< T, M, P >::erase ( iterator  pos)

Definition at line 367 of file OwnArray.h.

367  {
368  pointer * b = pos.i;
369  delete *b;
370  pointer * e = data_+size();
371  for(pointer * i = b; i != e-1; ++ i) *i = *(i+1);
372  size_--;
373  return iterator(b);
374  }

References b, MillePedeFileConverter_cfg::e, mps_fire::i, and findQualityFiles::size.

◆ fillPtrVector()

template<typename T , unsigned int M, typename P >
void edm::OwnArray< T, M, P >::fillPtrVector ( std::type_info const &  toType,
std::vector< unsigned long > const &  indices,
std::vector< void const * > &  ptrs 
) const
inline

Definition at line 479 of file OwnArray.h.

481  {
482  detail::reallyfillPtrVector(*this, toType, indices, ptrs);
483  }

References dqmdumpme::indices, and edm::detail::reallyfillPtrVector().

◆ fillView()

template<typename T , unsigned int M, typename P >
void edm::OwnArray< T, M, P >::fillView ( ProductID const &  id,
std::vector< void const * > &  pointers,
FillViewHelperVector helpers 
) const

Definition at line 403 of file OwnArray.h.

405  {
406  typedef Ref<OwnArray> ref_type ;
407  typedef reftobase::RefHolder<ref_type> holder_type;
408 
409  size_type numElements = this->size();
410  pointers.reserve(numElements);
411  helpers.reserve(numElements);
412  size_type key = 0;
413  for(typename base::const_iterator i=data_.begin(), e=data_.end(); i!=e; ++i, ++key) {
414 
415  if (*i == 0) {
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");
420  }
421  else {
422  pointers.push_back(*i);
423  holder_type h(ref_type(id, *i, key,this));
424  helpers.push_back(&h);
425  }
426  }
427  }

References MillePedeFileConverter_cfg::e, h, mps_fire::i, crabWrapper::key, edm::errors::NullPointerError, gpuClustering::numElements, findQualityFiles::size, and edm::Exception::throwThis().

◆ front() [1/2]

template<typename T , unsigned int M, typename P >
OwnArray< T, M, P >::reference edm::OwnArray< T, M, P >::front ( )
inline

Definition at line 339 of file OwnArray.h.

339  {
340  return *data_[0];
341  }

◆ front() [2/2]

template<typename T , unsigned int M, typename P >
OwnArray< T, M, P >::const_reference edm::OwnArray< T, M, P >::front ( ) const
inline

Definition at line 344 of file OwnArray.h.

344  {
345  return *data_[0];
346  }

◆ is_back_safe()

template<typename T , unsigned int M, typename P >
bool edm::OwnArray< T, M, P >::is_back_safe ( ) const
inline

Definition at line 306 of file OwnArray.h.

306  {
307  return data_[size_-1] != 0;
308  }

◆ operator=()

template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
OwnArray< T, M, P > & edm::OwnArray< T, M, P >::operator= ( self const &  )
inline

Definition at line 208 of file OwnArray.h.

208  {
209  OwnArray<T,M,P> temp(o);
210  swap(temp);
211  return *this;
212  }

References EcalTangentSkim_cfg::o, edm::swap(), and groupFilesInBlocks::temp.

◆ operator[]() [1/2]

template<typename T , unsigned int M, typename P >
OwnArray< T, M, P >::reference edm::OwnArray< T, M, P >::operator[] ( size_type  n)
inline

Definition at line 254 of file OwnArray.h.

254  {
255  return *data_[n];
256  }

References dqmiodumpmetadata::n.

◆ operator[]() [2/2]

template<typename T , unsigned int M, typename P >
OwnArray< T, M, P >::const_reference edm::OwnArray< T, M, P >::operator[] ( size_type  n) const
inline

Definition at line 259 of file OwnArray.h.

259  {
260  return *data_[n];
261  }

References dqmiodumpmetadata::n.

◆ ordering()

template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
template<typename O >
static Ordering<O> edm::OwnArray< T, MAX_SIZE, P >::ordering ( O const &  comp)
inlinestaticprivate

Definition at line 173 of file OwnArray.h.

173  {
174  return Ordering<O>(comp);
175  }

References AlCaHLTBitMon_QueryRunRegistry::comp.

◆ pop_back()

template<typename T , unsigned int M, typename P >
void edm::OwnArray< T, M, P >::pop_back ( )
inline

Definition at line 299 of file OwnArray.h.

299  {
300  // We have to delete the pointed-to thing, before we squeeze it
301  // out of the vector...
302  delete data_[--size_];
303  }

◆ push_back() [1/4]

template<typename T , unsigned int M, typename P >
template<typename D >
void edm::OwnArray< T, M, P >::push_back ( D *&  d)
inline

Definition at line 265 of file OwnArray.h.

265  {
266  // C++ does not yet support rvalue references, so d should only be
267  // able to bind to an lvalue.
268  // This should be called only for lvalues.
269  data_[size_++]=d;
270  d = 0;
271  }

References ztail::d.

◆ push_back() [2/4]

template<typename T , unsigned int M, typename P >
template<typename D >
void edm::OwnArray< T, M, P >::push_back ( D *const &  d)
inline

Definition at line 275 of file OwnArray.h.

275  {
276 
277  // C++ allows d to be bound to an lvalue or rvalue. But the other
278  // signature should be a better match for an lvalue (because it
279  // does not require an lvalue->rvalue conversion). Thus this
280  // signature should only be chosen for rvalues.
281  data_[size_++]=d;
282  }

References ztail::d.

◆ push_back() [3/4]

template<typename T , unsigned int M, typename P >
template<typename D >
void edm::OwnArray< T, M, P >::push_back ( std::unique_ptr< D >  d)
inline

Definition at line 287 of file OwnArray.h.

287  {
288  data_[size_++]=d.release();
289  }

References ztail::d.

◆ push_back() [4/4]

template<typename T , unsigned int M, typename P >
void edm::OwnArray< T, M, P >::push_back ( T const &  valueToCopy)
inline

Definition at line 293 of file OwnArray.h.

293  {
295  }

References clone(), and ztail::d.

◆ reserve()

template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
void edm::OwnArray< T, MAX_SIZE, P >::reserve ( size_t  )
inline

Definition at line 123 of file OwnArray.h.

123 {}

◆ setPtr()

template<typename T , unsigned int M, typename P >
void edm::OwnArray< T, M, P >::setPtr ( std::type_info const &  toType,
unsigned long  index,
void const *&  ptr 
) const
inline

Definition at line 460 of file OwnArray.h.

462  {
463  detail::reallySetPtr<OwnArray<T,M,P> >(*this, toType, index, ptr);
464  }

◆ size()

template<typename T , unsigned int M, typename P >
OwnArray< T, M, P >::size_type edm::OwnArray< T, M, P >::size ( void  ) const
inline

Definition at line 244 of file OwnArray.h.

244  {
245  return size_;
246  }

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

◆ sort() [1/2]

template<typename T , unsigned int M, typename P >
void edm::OwnArray< T, M, P >::sort ( )

Definition at line 393 of file OwnArray.h.

393  {
394  std::sort(data_, data_+size(), ordering(std::less<value_type>()));
395  }

References config::ordering, findQualityFiles::size, and jetUpdater_cfi::sort.

◆ sort() [2/2]

template<typename T , unsigned int M, typename P >
template<typename S >
void edm::OwnArray< T, M, P >::sort ( S  s)

◆ swap()

template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
void edm::OwnArray< T, M, P >::swap ( self other)
inline

Definition at line 398 of file OwnArray.h.

398  {
399  std::swap_ranges(data_,data_+M, other.data_);
400  }

References trackingPlots::other.

Member Data Documentation

◆ data_

template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
pointer edm::OwnArray< T, MAX_SIZE, P >::data_[MAX_SIZE]
private

Definition at line 176 of file OwnArray.h.

◆ size_

template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
size_type edm::OwnArray< T, MAX_SIZE, P >::size_
private

Definition at line 177 of file OwnArray.h.

AlCaHLTBitMon_QueryRunRegistry.comp
string comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
pos
Definition: PixelAliasList.h:18
edm::OwnArray::destroy
void destroy()
Definition: OwnArray.h:349
h
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
edm::OwnArray::ordering
static Ordering< O > ordering(O const &comp)
Definition: OwnArray.h:173
gpuClustering::numElements
uint16_t *__restrict__ uint16_t const *__restrict__ uint32_t const *__restrict__ uint32_t *__restrict__ uint32_t const *__restrict__ int32_t *__restrict__ uint32_t numElements
Definition: gpuClusterChargeCut.h:26
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
edm::OwnArray::data_
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
edm::first
T first(std::pair< T, U > const &p)
Definition: ParameterSet.cc:217
edm::errors::NullPointerError
Definition: EDMException.h:40
dqmdumpme.last
last
Definition: dqmdumpme.py:56
clone
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
pixelgpudetails::MAX_SIZE
constexpr unsigned int MAX_SIZE
Definition: SiPixelROCsStatusAndMapping.h:10
edm::detail::reallyfillPtrVector
void reallyfillPtrVector(COLLECTION const &coll, std::type_info const &iToType, std::vector< unsigned long > const &iIndicies, std::vector< void const * > &oPtr)
Definition: fillPtrVector.h:37
trackingPlots.other
other
Definition: trackingPlots.py:1464
h
b
double b
Definition: hdecay.h:118
helpers
Definition: makeCompositeCandidate.h:8
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
edm::OwnArray::size_type
unsigned int size_type
Definition: OwnArray.h:29
cuy.ib
ib
Definition: cuy.py:661
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
edm::OwnArray::size
size_type size() const
Definition: OwnArray.h:244
edm::OwnArray::swap
void swap(self &other)
Definition: OwnArray.h:398
edm::OwnArray::size_
size_type size_
Definition: OwnArray.h:177
edm::Exception::throwThis
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:83
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
ztail.d
d
Definition: ztail.py:151
mps_fire.result
result
Definition: mps_fire.py:311
edm::OwnArray::pointer
T * pointer
Definition: OwnArray.h:31
dqmdumpme.indices
indices
Definition: dqmdumpme.py:50
crabWrapper.key
key
Definition: crabWrapper.py:19
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37