CMS 3D CMS Logo

Classes | Public Types | 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>

List of all members.

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
const_iterator end () const
iterator end ()
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, helper_vector &helpers) const
const_reference front () const
reference front ()
bool is_back_safe () const
selfoperator= (self const &)
reference operator[] (size_type)
const_reference operator[] (size_type) const
 OwnArray (OwnArray const &)
 OwnArray ()
 OwnArray (size_type)
void pop_back ()
template<typename D >
void push_back (D *&d)
template<typename D >
void push_back (std::auto_ptr< D > d)
template<typename D >
void push_back (D *const &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 ()

Private Types

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

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.

: data_{{0}}, size_(0) {
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.

: data_{{0}}, size_(n) {
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().

                                      {
    destroy();
  }

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_().

                                                                     {
    pointer result = data_[size_-1];
    if (result == 0) {
      Exception::throwThis(errors::NullPointerError,
                           "In OwnArray::back() we have intercepted an attempt to dereference a null pointer\n"
                           "Since OwnArray is allowed to contain null pointers, you much assure that the\n"
                           "pointer at the end of the collection is not null before calling back()\n"
                           "if you wish to avoid this exception.\n"
                           "Consider using OwnArray::is_back_safe()\n");
    }
    return *result;
  }
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_().

                                                                                 {
    pointer const * result = data_[size_-1];
    if (result == 0) {
      Exception::throwThis(errors::NullPointerError,
                           "In OwnArray::back() we have intercepted an attempt to dereference a null pointer\n"
                           "Since OwnArray is allowed to contain null pointers, you much assure that the\n"
                           "pointer at the end of the collection is not null before calling back()\n"
                           "if you wish to avoid this exception.\n"
                           "Consider using OwnArray::is_back_safe()\n");
    }
    return *result;
  }
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.

                                                                     {
    return iterator(data_);
  }
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.

                                                                                 {
    return const_iterator(data_);
  }
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.

{ return MAX_SIZE;}
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.

References pyrootRender::destroy(), and edm::size_().

                                       {
    destroy();
    size_=0;
  }
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.

                                                                                 {
    return data_;
  }
template<typename T , unsigned int M, typename P >
void edm::OwnArray< T, M, P >::destroy ( ) [inline, private]

Definition at line 349 of file OwnArray.h.

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

                                         {
    pointer * b = data_, * e = data_+size();
    for(pointer * i = b; i != e; ++ i)
      delete * i;
  }
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_().

                                             {
    return 0==size_;
  }
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.

                                                                               {
    return const_iterator(data_+size());
  }
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.

                                                                    {
     return iterator(data_+size());
   }
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, edm::OwnArray< T, MAX_SIZE, P >::iterator::i, i, findQualityFiles::size, and edm::size_().

                                                                          {
    pointer * b = pos.i;
    delete *b;
    pointer * e = data_+size();
    for(pointer * i = b; i != e-1; ++ i) *i = *(i+1);
    size_--;
    return iterator(b);
  }
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, edm::OwnArray< T, MAX_SIZE, P >::iterator::i, i, cuy::ib, prof2calltree::l, findQualityFiles::size, and edm::size_().

                                                                                           {
     pointer * b = first.i, * e = last.i;
    for(pointer * i = b; i != e; ++ i) delete * i;
    pointer * l = data_+size();
    auto ib=b;
    for(pointer * i = e; i != l; ++i)  *(ib++) = *i;
    size_ -= (e-b);
    return iterator(b);
  }
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().

                                                                      {
    detail::reallyfillPtrVector(*this, toType, indices, ptrs);
  }
template<typename T , unsigned int M, typename P >
void edm::OwnArray< T, M, P >::fillView ( ProductID const &  id,
std::vector< void const * > &  pointers,
helper_vector helpers 
) const

Definition at line 403 of file OwnArray.h.

References alignCSCRings::e, h, i, combine::key, edm::errors::NullPointerError, edm::reftobase::RefVectorHolderBase::push_back(), edm::reftobase::RefVectorHolderBase::reserve(), and findQualityFiles::size.

Referenced by edm::fillView().

                                                               {
    typedef Ref<OwnArray>      ref_type ;
    typedef reftobase::RefHolder<ref_type> holder_type;

    size_type numElements = this->size();
    pointers.reserve(numElements);
    helpers.reserve(numElements);
    size_type key = 0;
    for(typename base::const_iterator i=data_.begin(), e=data_.end(); i!=e; ++i, ++key) {

      if (*i == 0) {
        Exception::throwThis(errors::NullPointerError,
          "In OwnArray::fillView() we have intercepted an attempt to put a null pointer\n"
          "into a View and that is not allowed.  It is probably an error that the null\n"
          "pointer was in the OwnArray in the first place.\n");
      }
      else {
        pointers.push_back(*i);
        holder_type h(ref_type(id, *i, key,this));
        helpers.push_back(&h);
      }
    }
  }
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.

                                                                      {
    return *data_[0];
  }
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.

                                                                                  {
    return *data_[0];
  }
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_().

                                                    {
    return data_[size_-1] != 0;
  }
template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
self& edm::OwnArray< T, MAX_SIZE, P >::operator= ( self const &  )
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 n.

                                                                                                  {
    return *data_[n];
  }
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 n.

                                                                                      {
    return *data_[n];
  }
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) [inline, static, private]

Definition at line 173 of file OwnArray.h.

References AlCaHLTBitMon_QueryRunRegistry::comp.

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

                                          {
    // We have to delete the pointed-to thing, before we squeeze it
    // out of the vector...
    delete data_[--size_];
  }
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_().

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_().

                                                           {
    data_[size_++]=d.release();
  }
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 edm::size_().

                                                {
    // C++ does not yet support rvalue references, so d should only be
    // able to bind to an lvalue.
    // This should be called only for lvalues.
    data_[size_++]=d; 
    d = 0;
  }
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 edm::size_().

                                                      {
    
    // C++ allows d to be bound to an lvalue or rvalue. But the other
    // signature should be a better match for an lvalue (because it
    // does not require an lvalue->rvalue conversion). Thus this
    // signature should only be chosen for rvalues.
    data_[size_++]=d; 
  }
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.

{}
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 getHLTprescales::index.

Referenced by edm::setPtr().

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

                                                                           {
    return size_;
  }
template<typename T , unsigned int M, typename P >
template<typename S >
void edm::OwnArray< T, M, P >::sort ( s)
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, findQualityFiles::size, and python::multivaluedict::sort().

                               {
    std::sort(data_, data_+size(), ordering(std::less<value_type>()));
  }
template<typename T, unsigned int MAX_SIZE, typename P = ClonePolicy<T>>
void edm::OwnArray< T, MAX_SIZE, P >::swap ( self other)

Referenced by edm::swap().


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.

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.