Skip to content

Commit 0f815f4

Browse files
authored
Merge pull request #522 from dmcdougall/fix_smartptr_docs
Add docs for ScopedPtr and SmartPtr
2 parents e1b683a + 0352b65 commit 0f815f4

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

src/core/inc/ScopedPtr.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,38 @@
3535
#include <memory>
3636
#endif
3737

38+
/*!
39+
* \file ScopedPtr.h
40+
* \brief This file declares and defines a scoped pointer
41+
*/
42+
43+
/*!
44+
* \class ScopedPtr
45+
* \brief Definition of a scoped pointer.
46+
*
47+
* Scoped pointers are smart pointers that clean up after themselves when they
48+
* go out of scope, with no shared ownership, and with no transfer of
49+
* ownership regardless of the underlying implementation.
50+
*
51+
* If QUESO detects C++11 functionality at configure-time, then the underlying
52+
* implementation of ScopedPtr is that of std::unique_ptr. Even when this is
53+
* the case, please note that shared ownership and transfer of ownership are
54+
* not supported.
55+
*
56+
* If QUESO does not detect C++11 functionality then QUESO will check if boost
57+
* is present and, if so, will use boost::scoped_ptr as the underlying
58+
* implementation. It should now be clear why shared ownership and transfer
59+
* of ownership are not permitted.
60+
*
61+
* If QUESO fails to detect both C++11 functionality and boost then QUESO's
62+
* last resort is to fall back on the C++03's std::auto_ptr. If std::auto_ptr
63+
* isn't detected, QUESO will fail to configure.
64+
*
65+
* ScopedPtr is implemented as a template typedef pattern. That is, one
66+
* declares a ScopedPtr like so:
67+
*
68+
* QUESO::ScopedPtr< name_of_type >::Type name_of_variable;
69+
*/
3870
namespace QUESO
3971
{
4072
#ifdef QUESO_HAVE_CXX11_UNIQUE_PTR

src/core/inc/SharedPtr.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,33 @@
3333
#include <boost/shared_ptr.hpp>
3434
#endif
3535

36+
/*!
37+
* \file SharedPtr.h
38+
* \brief This file declares and defines a shared pointer
39+
*/
40+
41+
/*!
42+
* \class SharedPtr
43+
* \brief Definition of a shared pointer.
44+
*
45+
* Shared pointers may share ownership of some dynamically allocated object.
46+
* The object pointed to is guaranteed to be deleted when the last underlying
47+
* implementation of SharedPtr is destroyed or reset.
48+
*
49+
* If QUESO detects C++11 functionality ot configure-time, then the underlying
50+
* implementation of SharedPtr is that of std::shared_ptr.
51+
*
52+
* If QUESO does not detect C++11 functionality, boost is required. In that
53+
* case, the underlying implementation is that of boost::shared_ptr.
54+
*
55+
* If QUESO does not detect C++11 functionality and does not detect boost then
56+
* QUESO will fail to configure.
57+
*
58+
* SharedPtr is implemented as a template typdef pattern. That is, one
59+
* declares a SharedPtr like so:
60+
*
61+
* QUESO::SharedPtr< name_of_type >::Type name_of_variable;
62+
*/
3663
namespace QUESO
3764
{
3865
#ifdef QUESO_HAVE_CXX11_SHARED_PTR

0 commit comments

Comments
 (0)