CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
pointer const * data () const
 
bool empty () const
 
iterator end ()
 
const_iterator end () const
 
iterator erase (iterator pos)
 
iterator erase (iterator first, iterator last)
 
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 (size_type)
 
 OwnArray (OwnArray const &)
 
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::auto_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
 
template<typename S >
void sort (S s)
 
void sort ()
 
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

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.

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.

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.

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.

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.

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.

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.

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

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) {
size_type size_
Definition: OwnArray.h:177
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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) {
size_type size_
Definition: OwnArray.h:177
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
edm::OwnArray< T, MAX_SIZE, P >::OwnArray ( OwnArray< T, MAX_SIZE, P > const &  )
template<typename T , unsigned int M, typename P >
edm::OwnArray< T, M, P >::~OwnArray ( )
inline

Definition at line 203 of file OwnArray.h.

References pyrootRender::destroy().

203  {
204  destroy();
205  }
void destroy()
Definition: OwnArray.h:349

Member Function Documentation

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.

References edm::errors::NullPointerError, query::result, and edm::size_().

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  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
tuple result
Definition: query.py:137
size_type size_
Definition: OwnArray.h:177
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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.

References edm::errors::NullPointerError, query::result, and edm::size_().

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  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
tuple result
Definition: query.py:137
size_type size_
Definition: OwnArray.h:177
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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  }
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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  }
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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;}
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();
void destroy()
Definition: OwnArray.h:349
template<typename T , unsigned int M, typename P >
void edm::OwnArray< T, M, P >::clear ( void  )
inline
template<typename T , unsigned int M, typename P >
OwnArray< T, M, P >::pointer const * edm::OwnArray< T, M, P >::data ( ) const
inline

Definition at line 356 of file OwnArray.h.

Referenced by cuy.FindIssue::__init__().

356  {
357  return data_;
358  }
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
template<typename T , unsigned int M, typename P >
void edm::OwnArray< T, M, P >::destroy ( )
inlineprivate

Definition at line 349 of file OwnArray.h.

References b, alignCSCRings::e, i, and findQualityFiles::size.

349  {
350  pointer * b = data_, * e = data_+size();
351  for(pointer * i = b; i != e; ++ i)
352  delete * i;
353  }
int i
Definition: DBlmapReader.cc:9
size_type size() const
Definition: OwnArray.h:244
double b
Definition: hdecay.h:120
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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.

References edm::size_().

Referenced by Vispa.Gui.VispaWidget.TextField::setAutosizeFont(), and Vispa.Gui.VispaWidget.TextField::setAutotruncate().

249  {
250  return 0==size_;
251  }
size_type size_
Definition: OwnArray.h:177
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.

References findQualityFiles::size.

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

229  {
230  return iterator(data_+size());
231  }
size_type size() const
Definition: OwnArray.h:244
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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.

References findQualityFiles::size.

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

239  {
240  return const_iterator(data_+size());
241  }
size_type size() const
Definition: OwnArray.h:244
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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.

References b, alignCSCRings::e, i, edm::OwnArray< T, MAX_SIZE, P >::iterator::i, findQualityFiles::size, and edm::size_().

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  }
int i
Definition: DBlmapReader.cc:9
size_type size() const
Definition: OwnArray.h:244
double b
Definition: hdecay.h:120
size_type size_
Definition: OwnArray.h:177
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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.

References b, alignCSCRings::e, i, edm::OwnArray< T, MAX_SIZE, P >::iterator::i, cuy::ib, cmsLHEtoEOSManager::l, findQualityFiles::size, and edm::size_().

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  }
int i
Definition: DBlmapReader.cc:9
int ib
Definition: cuy.py:660
size_type size() const
Definition: OwnArray.h:244
double b
Definition: hdecay.h:120
size_type size_
Definition: OwnArray.h:177
T first(std::pair< T, U > const &p)
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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.

References edm::detail::reallyfillPtrVector().

Referenced by edm::fillPtrVector().

481  {
482  detail::reallyfillPtrVector(*this, toType, indices, ptrs);
483  }
void reallyfillPtrVector(COLLECTION const &coll, std::type_info const &iToType, std::vector< unsigned long > const &iIndicies, std::vector< void const * > &oPtr)
Definition: fillPtrVector.h:38
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.

References alignCSCRings::e, h, i, relval_steps::key, edm::errors::NullPointerError, and findQualityFiles::size.

Referenced by edm::fillView().

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  }
int i
Definition: DBlmapReader.cc:9
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
size_type size() const
Definition: OwnArray.h:244
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
unsigned int size_type
Definition: OwnArray.h:29
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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  }
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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  }
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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.

References edm::size_().

306  {
307  return data_[size_-1] != 0;
308  }
size_type size_
Definition: OwnArray.h:177
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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.

References swap(), and groupFilesInBlocks::temp.

208  {
209  OwnArray<T,M,P> temp(o);
210  swap(temp);
211  return *this;
212  }
void swap(self &other)
Definition: OwnArray.h:398
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.

References gen::n.

254  {
255  return *data_[n];
256  }
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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.

References gen::n.

259  {
260  return *data_[n];
261  }
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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.

References AlCaHLTBitMon_QueryRunRegistry::comp.

173  {
174  return Ordering<O>(comp);
175  }
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.

References edm::size_().

299  {
300  // We have to delete the pointed-to thing, before we squeeze it
301  // out of the vector...
302  delete data_[--size_];
303  }
size_type size_
Definition: OwnArray.h:177
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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.

References ztail::d, and edm::size_().

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  }
tuple d
Definition: ztail.py:151
size_type size_
Definition: OwnArray.h:177
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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.

References ztail::d, and edm::size_().

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  }
tuple d
Definition: ztail.py:151
size_type size_
Definition: OwnArray.h:177
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
template<typename T , unsigned int M, typename P >
template<typename D >
void edm::OwnArray< T, M, P >::push_back ( std::auto_ptr< D >  d)
inline

Definition at line 287 of file OwnArray.h.

References edm::size_().

287  {
288  data_[size_++]=d.release();
289  }
tuple d
Definition: ztail.py:151
size_type size_
Definition: OwnArray.h:177
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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.

References clone(), and edm::size_().

293  {
295  }
tuple d
Definition: ztail.py:151
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
size_type size_
Definition: OwnArray.h:177
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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 {}
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.

References cmsHarvester::index.

Referenced by edm::setPtr().

462  {
463  detail::reallySetPtr<OwnArray<T,M,P> >(*this, toType, index, ptr);
464  }
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.

References edm::size_().

244  {
245  return size_;
246  }
size_type size_
Definition: OwnArray.h:177
template<typename T , unsigned int M, typename P >
template<typename S >
void edm::OwnArray< T, M, P >::sort ( S  s)

Definition at line 388 of file OwnArray.h.

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

388  {
389  std::sort(data_, data_+size(), ordering(comp));
390  }
static Ordering< O > ordering(O const &comp)
Definition: OwnArray.h:173
size_type size() const
Definition: OwnArray.h:244
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
template<typename T , unsigned int M, typename P >
void edm::OwnArray< T, M, P >::sort ( )

Definition at line 393 of file OwnArray.h.

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

393  {
394  std::sort(data_, data_+size(), ordering(std::less<value_type>()));
395  }
static Ordering< O > ordering(O const &comp)
Definition: OwnArray.h:173
size_type size() const
Definition: OwnArray.h:244
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176
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.

References edm::OwnArray< T, MAX_SIZE, P >::data_.

Referenced by edm::swap().

398  {
399  std::swap_ranges(data_,data_+M, other.data_);
400  }
pointer data_[MAX_SIZE]
Definition: OwnArray.h:176

Member Data Documentation

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.

Referenced by edm::OwnArray< T, MAX_SIZE, P >::swap().

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.