PandaTree
|
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_type & | operator= (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. | |
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.
|
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.
|
inline |
Accessor to container.
Throws a runtime_error if container is not valid.
|
inline |
Accessor to idx.
Throws a runtime_error if idx is not valid.
|
inline |
The dereference operator.
Throws an invalid_argument exception if the reference is invalid.
|
inline |
The arrow operator.
Returns a null pointer if the container is not set or the index points to an invalid location.
|
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.