PandaTree
Classes | Public Types | Public Member Functions | List of all members
panda::RefVector< E > Class Template Reference

A vector of references to elements in a container. More...

#include <RefVector.h>

Classes

class  RefHolder
 "pointer" wrapper for Ref More...
 
class  RefVectorIterator
 const iterator More...
 

Public Types

typedef RefVector< E > self_type
 
typedef E element_type
 
typedef Ref< element_type > ref_type
 
typedef ConstRef< element_type > const_ref_type
 
typedef std::vector< Short_t > Indices
 
typedef RefVectorIterator< kTRUE > const_iterator
 
typedef RefVectorIterator< kFALSE > iterator
 

Public Member Functions

 RefVector ()
 Default constructor.
 
 RefVector (ContainerBase const *&c, Indices &indices)
 Standard constructor. More...
 
 RefVector (self_type const &orig)
 Copy constructor.
 
void setIndices (Indices &indices)
 Set the index.
 
void setContainer (ContainerBase const *&c)
 Set the container (an Array or a Collection). More...
 
UShort_t size () const
 Size of the vector.
 
ref_type at (UShort_t)
 Element (ref) accessor.
 
const_ref_type at (UShort_t) const
 Element (ref) accessor.
 
element_type const & objAt (UShort_t) const
 Object accessor.
 
self_typeoperator= (self_type const &)
 Assignment operator.
 
void addRef (element_type const *)
 Setter function. More...
 
void push_back (ref_type const &)
 Setter function. More...
 
void clear ()
 Clear operation.
 
void init ()
 Initializer. More...
 
Bool_t isValid () const
 Validity check. Both container and idx must be valid, and idx must not be 0xffffffff.
 
Indices *& indices ()
 Accessor to indices. More...
 
ContainerBase const * container () const
 Accessor to container. More...
 
void sort (ContainerBase::Comparison const &)
 Sort the ref vector. More...
 
const_iterator begin () const
 
iterator begin ()
 
const_iterator end () const
 
iterator end ()
 

Detailed Description

template<class E>
class panda::RefVector< E >

A vector of references to elements in a container.

The vector version of Ref, where the container is shared between the elements (individual refs). A vector of index integers, instead of a single integer, is written to the tree.

Constructor & Destructor Documentation

§ RefVector()

template<class E>
panda::RefVector< E >::RefVector ( ContainerBase const *&  c,
Indices &  indices 
)
inline

Standard constructor.

The container must be a pointer to a derived class of Array<E> or Collection<E>. Proper assignment is only done at runtime and thus there no protection against assigning a wrong type of container.

Member Function Documentation

§ addRef()

template<class E >
void panda::RefVector< E >::addRef ( element_type const *  _obj)

Setter function.

Pass a element_type object after the container is set. If the object is found in the collector, pushes the index value.

§ container()

template<class E >
ContainerBase const * panda::RefVector< E >::container ( ) const

Accessor to container.

Throws a runtime_error if container is not valid.

§ indices()

template<class E >
std::vector< Short_t > *& panda::RefVector< E >::indices ( )

Accessor to indices.

Throws a runtime_error if indices is NULL.

§ init()

template<class E>
void panda::RefVector< E >::init ( )
inline

Initializer.

Invalidates the index by setting it to 0xffffffff.

§ push_back()

template<class E>
void panda::RefVector< E >::push_back ( ref_type const &  )

Setter function.

Pushes back a ref if the container is common.

§ setContainer()

template<class E>
void panda::RefVector< E >::setContainer ( ContainerBase const *&  c)
inline

Set the container (an Array or a Collection).

The container must be a derived class of Array<E> or Collection<E>. There is no protection against assigning a wrong type of container.

§ sort()

template<class E >
void panda::RefVector< E >::sort ( ContainerBase::Comparison const &  _c)

Sort the ref vector.

The internal indices are re-ordered, but the underlying data is untouched


The documentation for this class was generated from the following file: