22 return (
Raw() != NULL);
30 return (
Raw() == NULL);
50 inline operator T* ()
const {
return Raw(); }
57 inline Ptr<Type>
Cast() {
return dynamic_cast<Type*
>(
Raw()); }
60 inline const Ptr<Type>
Cast()
const {
return dynamic_cast<Type*
>(
Raw()); }
65 return Cast<const Type>().IsSet();
71 template<
class Type,
class Self>
72 inline static Type& As_Helper(Self&
self) {
74 Type* retptr =
dynamic_cast<Type*
>(
self.Raw());
86 inline Type&
As() {
return As_Helper<Type>(*
this); }
89 inline const Type&
As()
const {
return As_Helper<const Type>(*
this); }
95 inline const T&
As()
const {
Assert();
return (*
Raw()); }
#define Throw_RC_Type(Type, err)
Use this to throw an RC:ErrorMsg subtype exception.
Definition: Errors.h:282
T & operator*()
Dereferences the pointer, or throws an exception if null.
Definition: PtrCommon.h:38
bool IsSet() const
True if the pointer is non-NULL.
Definition: PtrCommon.h:21
T * operator->()
Provides access to the enclosed pointer, or throws RC::ErrorMsgNull if null.
Definition: PtrCommon.h:45
Type & As()
Dynamically casts and dereferences to the type presented as a template parameter, or throws ErrorMsgC...
Definition: PtrCommon.h:86
Ptr< Type > Cast()
Dynamically casts to an RC::Ptr of the type used as a template parameter on this function.
Definition: PtrCommon.h:57
void Assert() const
Throws RC::ErrorMsgNull if the pointer is null.
Definition: PtrCommon.h:12
bool IsNull() const
True if the pointer is NULL.
Definition: PtrCommon.h:29
bool CanCast() const
True if it can dynamically cast to this type.
Definition: PtrCommon.h:64
T * Raw() const
Returns a direct reference to the enclosed pointer.
Definition: PtrSharedCommon.h:16