30 #if !defined(_smart_ptr_h_) 47 typedef const T *const_ptr_type;
49 typedef const T &const_ref_type;
67 ptr_type
get() {
return _p; }
69 const_ptr_type
get()
const {
return _p; }
103 operator ptr_type() {
return _p; }
105 operator const_ptr_type()
const {
return _p; }
107 operator ref_type() {
return *
_p; }
109 operator const_ref_type()
const {
return *
_p; }
111 operator bool()
const {
return _p != 0; }
115 set(
const_cast<ptr_type
>(p));
144 template <
typename T>
170 ptr_type
get() {
return _p; }
172 const_ptr_type
get()
const {
return _p; }
206 operator ptr_type() {
return _p; }
208 operator const_ptr_type()
const {
return _p; }
210 operator ref_type() {
return *
_p; }
212 operator const_ref_type()
const {
return *
_p; }
214 operator bool()
const {
return _p != 0; }
218 set(
const_cast<ptr_type
>(p));
238 #endif // _smart_ptr_h_ void clear()
Dissociates a previously set pointer value, deleting it at the same time.
Definition: src/blfwk/smart_ptr.h:86
virtual void safe_delete()
Definition: apps/elftosb/common/smart_ptr.h:66
smart_array_ptr()
Default constuctor. Initialises with no pointer set.
Definition: src/blfwk/smart_ptr.h:155
virtual ~smart_array_ptr()
Definition: src/blfwk/smart_ptr.h:168
virtual void safe_delete()
Definition: src/blfwk/smart_ptr.h:193
smart_ptr()
Default constuctor. Initialises with no pointer set.
Definition: src/blfwk/smart_ptr.h:52
smart_array_ptr< T > & operator=(const_ptr_type p)
To allow setting the pointer directly. Equivalent to a call to set().
Definition: src/blfwk/smart_ptr.h:216
smart_ptr(ptr_type p)
This constructor takes a pointer to the object to be deleted.
Definition: src/blfwk/smart_ptr.h:58
Simple, standard smart pointer class.
Definition: apps/elftosb/common/smart_ptr.h:18
void reset()
Dissociates any previously set pointer value without deleting it.
Definition: src/blfwk/smart_ptr.h:84
void reset()
Dissociates any previously set pointer value without deleting it.
Definition: src/blfwk/smart_ptr.h:187
void clear()
Dissociates a previously set pointer value, deleting it at the same time.
Definition: src/blfwk/smart_ptr.h:189
ptr_type _p
The wrapped pointer.
Definition: apps/elftosb/common/smart_ptr.h:108
Keyblob specification.
Definition: Keyblob.h:27
const_ptr_type operator->() const
Another operator to allow you to treat the object just like a pointer.
Definition: src/blfwk/smart_ptr.h:225
smart_array_ptr(ptr_type p)
This constructor takes a pointer to the object to be deleted.
Definition: src/blfwk/smart_ptr.h:161
const_ptr_type operator->() const
Another operator to allow you to treat the object just like a pointer.
Definition: src/blfwk/smart_ptr.h:122
Simple, standard smart pointer class that uses the array delete operator.
Definition: apps/elftosb/common/smart_ptr.h:121
ptr_type operator->()
Another operator to allow you to treat the object just like a pointer.
Definition: src/blfwk/smart_ptr.h:120
smart_ptr< T > & operator=(const_ptr_type p)
To allow setting the pointer directly. Equivalent to a call to set().
Definition: src/blfwk/smart_ptr.h:113
ptr_type operator->()
Another operator to allow you to treat the object just like a pointer.
Definition: src/blfwk/smart_ptr.h:223
ref_type operator[](unsigned index)
Indexing operator.
Definition: src/blfwk/smart_ptr.h:227
const_ref_type operator[](unsigned index) const
Indexing operator.
Definition: src/blfwk/smart_ptr.h:229
virtual ~smart_ptr()
Definition: src/blfwk/smart_ptr.h:65