libqi-api  2.8.7.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | List of all members
qi::Trackable< T > Class Template Reference

Object tracking by blocking destruction while shared pointers are present. More...

#include <trackable.hpp>

Public Member Functions

 Trackable ()
 Default constructor. More...
 
 QI_API_DEPRECATED_MSG (Use default constructor instead) Trackable(T *ptr)
 
 ~Trackable ()
 
boost::weak_ptr< T > weakPtr () const
 
void wait ()
 

Protected Member Functions

void destroy ()
 

Detailed Description

template<typename T>
class qi::Trackable< T >

Object tracking by blocking destruction while shared pointers are present.

Inherit from Trackable to allow a form of tracking that blocks destruction while shared pointers are held. This allows using your class without a shared_ptr wrapper.

Warning
when inheriting from this class, you must invoke the destroy() method from your destructor, before any operation that puts your object in an invalid state.
since destroy() blocks until all shared pointers are destroyed, deadlocks may occur if used improperly.

Definition at line 45 of file trackable.hpp.

Constructor & Destructor Documentation

template<typename T >
qi::Trackable< T >::Trackable ( )
inline

Default constructor.

Definition at line 22 of file trackable.hxx.

template<typename T >
qi::Trackable< T >::~Trackable ( )
inline

Definition at line 63 of file trackable.hxx.

Member Function Documentation

template<typename T >
void qi::Trackable< T >::destroy ( )
inlineprotected

Must be called by parent class destructor, first thing. Can block until lock holders terminate

Definition at line 37 of file trackable.hxx.

template<typename T>
qi::Trackable< T >::QI_API_DEPRECATED_MSG ( Use default constructor  instead)
Deprecated:
Not required anymore, use the default constructor instead.
template<typename T >
void qi::Trackable< T >::wait ( )
inline

Blocks until destroy() is called and all shared_ptr built from weak_ptr() are deleted.

Definition at line 44 of file trackable.hxx.

template<typename T >
boost::weak_ptr< T > qi::Trackable< T >::weakPtr ( ) const
inline
Returns
A weak_ptr from this. While a shared_ptr exists from this weak_ptr, a call to destroy will block()

Definition at line 76 of file trackable.hxx.


The documentation for this class was generated from the following files: