Encapsuled pointer class for pointers pointing to derived classes.
More...
#include <memcore/DynPtr.hpp>
List of all members.
Public Types
Public Member Functions
-
const DynPtr & getDynPtr () const throw ()
- Convenience type cast to dynamic pointer class.
-
const type_info & getType () const throw ()
- Return type info of associated object, typeid(NullPtr) or typeid(void) if none.
- bool isAssignable (const DynPtr< ObjectBase, ObjectBase > &Other) const throw ()
- Check whether a given pointer to a base class may be assigned to a pointer of the derived class.
-
Object * rawptr () const throw ()
-
void speak (const char *s, const char *prefix="") const throw ()
- Print some debug messages to the console.
|
|
- operator void * () const throw ()
- Check if the pointer is valid.
- bool operator! () const throw ()
- Check if the pointer is invalid.
Static Public Member Functions
-
static const DynPtr & getNullPtr () throw ()
- Associated static NullPtr - avoids creation of a temporary object when a reference is needed.
Protected Member Functions
-
void assignReferer (const DynPtr< ObjectBase, ObjectBase > &P) throw ()
-
template<class AnyObject > DynPtr (const DynPtr< AnyObject, ObjectBase > &Other) throw ()
- Implicit type conversion within the same class hierarchy Any pointer.
-
DynPtr (Referer< ObjectBase > *SomeReferer) throw ()
-
DynPtr (Object *Obj, const NotNullPtr &) throw ()
-
DynPtr (const NullPtr &) throw ()
-
DynPtr (Object *Obj, const SelfInitialize &) throw ()
-
void operator= (const DynPtr< ObjectBase, ObjectBase > &P) throw ()
Protected Attributes
Related Functions
(Note that these are not member functions.)
-
void Speak (const char *s, const char *prefix="") const
- Verbose information printing for this pointer.
Detailed Description
template<class Object, class ObjectBase>
class DynPtr< Object, ObjectBase >
Encapsuled pointer class for pointers pointing to derived classes.
It performs a native dynamic_cast<> on assignment and construction and caches the result.
Member Function Documentation
template<class Object, class ObjectBase>
bool DynPtr< Object, ObjectBase >::isAssignable |
( |
const DynPtr< ObjectBase, ObjectBase > & |
Other |
) |
const throw () [inline] |
Check whether a given pointer to a base class may be assigned to a pointer of the derived class.
This function doesn't need to create a new pointer and is thus little lighter than pointer assignment, it basically just involves a dynamic_cast.
template<class Object, class ObjectBase>
DynPtr< Object, ObjectBase >::operator void * |
( |
|
) |
const throw () [inline] |
Check if the pointer is valid.
Note that the referred object might still exist, but not be of the appropriate type.
template<class Object, class ObjectBase>
bool DynPtr< Object, ObjectBase >::operator! |
( |
|
) |
const throw () [inline] |
Check if the pointer is invalid.
Note that the referred object might still exist, but not be of the appropriate type.
The documentation for this class was generated from the following file: