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

A const version of Ref. More...

#include <Ref.h>

Public Types

typedef ConstRef< E > self_type
 
typedef E value_type
 
typedef Short_t index_type
 

Public Member Functions

 ConstRef ()
 Default constructor.
 
 ConstRef (ContainerBase const *&c, index_type const &idx)
 Standard constructor. More...
 
 ConstRef (self_type const &orig)
 Copy constructor.
 
self_typeoperator= (self_type const &)=delete
 
void setIndex (index_type const &idx)
 Set the index.
 
void setContainer (ContainerBase const *&c)
 Set the container. More...
 
value_type const * operator-> () const
 The arrow operator. More...
 
value_type const & operator* () const
 The dereference operator. More...
 
Bool_t isValid () const
 Validity check. Both container and idx must be valid, and idx must not be 0xffffffff.
 
index_type const & idx () const
 Accessor to idx. More...
 
ContainerBase const * container () const
 Accessor to container. More...
 
value_type const * get () const
 Pointer to object.
 

Detailed Description

template<class E>
class panda::ConstRef< E >

A const version of Ref.

Generating Ref and ConstRef from a single template has been attempted, but it was impossible to delete the assignment operator from ConstRef while enabling it in Ref (using e.g. enable_if) because the default assignment operator will take precedence.

Constructor & Destructor Documentation

§ ConstRef()

template<class E>
panda::ConstRef< E >::ConstRef ( ContainerBase const *&  c,
index_type const &  idx 
)
inline

Standard constructor.

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

Member Function Documentation

§ container()

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

Accessor to container.

Throws a runtime_error if container is not valid.

§ idx()

template<class E>
index_type const& panda::ConstRef< E >::idx ( ) const
inline

Accessor to idx.

Throws a runtime_error if idx is not valid.

§ operator*()

template<class E>
value_type const& panda::ConstRef< E >::operator* ( ) const
inline

The dereference operator.

Throws an invalid_argument exception if the reference is invalid.

§ operator->()

template<class E>
value_type const* panda::ConstRef< E >::operator-> ( ) const
inline

The arrow operator.

Returns a null pointer if the container is not set or the index points to an invalid location.

§ setContainer()

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

Set the container.

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


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