libpgplotxx.a (C++ interface to PGPLOT)
|
The handle class. More...
#include <pghandle.h>
Public Types | |
Typedefs for class template Handle. | |
| |
typedef X | Tvalue |
typedef X * | Tpointer |
typedef X & | Treference |
typedef const X * | Tpointer_to_const |
typedef const X & | Treference_to_const |
typedef HandleOfConst< Tvalue > | Tbase |
typedef Handle< Tvalue > | Tcontainer |
typedef Tbase | Tcontainer_of_const |
typedef Tcontainer_of_const | Tcoc |
Public Member Functions | |
template<class Y > | |
Tcontainer & | operator= (const Handle< Y > &h) |
Assignement operator providing transparency to inheritance. More... | |
Constructors | |
Action is provided by base class. | |
Handle () | |
Default constructor. More... | |
Handle (Treference_to_const x) | |
Initializing constructor. More... | |
template<class Y > | |
Handle (const Handle< Y > &h) | |
Copy constructor providing transparency to inheritance. More... | |
Write access operators. | |
Tpointer | operator-> () const |
Write access operator with pointer semantics. More... | |
Treference | operator* () const |
Write access operator with pointer semantics. More... | |
Protected Member Functions | |
Write access operators must be protected | |
Tpointer | pointer () const |
expose the pointer to derived classes More... | |
Treference | reference () const |
expose the object to derived classes More... | |
The handle class.
This handle class provides transparency to class inheritance. Consider a base class A
and a derived class B
where the contstructor is just an example to illustrate code below. If you want to provide access to the same instance of B at more than one locations within your code, it is safe to use a Handle<B> that can be initialized in a straight forward way like
The value b can be passed around safely, providing access to the contained value of type B with pointer semantics. No consider a function
that accepts a handle to the base class you can simply call this function by
and the contents of the object of type B will be available within function sample through virtual functions.
Definition at line 219 of file pghandle.h.