From 6f94639a3f5e20e1c635b2d8676086464d7cba2e Mon Sep 17 00:00:00 2001 From: David Date: Mon, 18 Jun 2007 20:45:45 +0000 Subject: david - did more documenting --- src/sptr.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'src/sptr.h') diff --git a/src/sptr.h b/src/sptr.h index faa8524..4baa697 100644 --- a/src/sptr.h +++ b/src/sptr.h @@ -45,31 +45,55 @@ namespace Bu } } + /** + * Get the number of references to this pointer. + *@returns (int32_t) The number of references to this pointer. + */ int32_t count() const { return *pRefCnt; } + /** + * Pointer access operator. + *@returns (const T *) + */ const T *operator->() const { return pData; } + /** + * Dereference operator. + *@returns (const T &) The value at the end of the pointer. + */ const T &operator*() const { return *pData; } + /** + * Pointer access operator. + *@returns (T *) + */ T *operator->() { return pData; } + /** + * Dereference operator. + *@returns (T &) The value at the end of the pointer. + */ T &operator*() { return *pData; } + /** + * Assignment operator. + *@param src (const SPtr &) + */ SPtr operator=( const SPtr &src ) { decCount(); @@ -81,6 +105,10 @@ namespace Bu return *this; } + /** + * Assignment operator. + *@param src (const SPtr &) + */ const SPtr operator=( const SPtr &src ) const { decCount(); @@ -92,21 +120,38 @@ namespace Bu return *this; } + /** + * Equals comparison operator. + *@param src (const SPtr &) The SPtr to compare to. + *@returns (bool) Are the equal? + */ bool operator==( const SPtr &src ) const { return pData == src.pData; } + /** + * Equals comparison operator. + *@param src (const T *) The pointer to compare to. + *@returns (bool) Are the equal? + */ bool operator==( const T *src ) const { return pData == src; } + /** + * Boolean cast operator. Do we have a pointer? + */ operator bool() const { return pRefCnt != NULL; } + /** + * Do we have a pointer? + *@returns (bool) Do we have a pointer? + */ bool isSet() const { return pRefCnt != NULL; -- cgit v1.2.3