torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::physical::Progeny< T > Class Template Reference

Concept for any object that may have a parent. More...

#include <Progeny.hpp>

Public Member Functions

 Progeny (void)
 Null constructor. More...
 
 Progeny (const WeakPtrType &inParentPtr)
 Constructor that specifies a parent. More...
 
const WeakPtrTypegetParentWeakPtr (void) const
 Returns a weak pointer to the parent. More...
 
void setParentWeakPtr (WeakPtrType inParentPtr)
 Sets the weak pointer to the parent. More...
 
void resetParentWeakPtr (void)
 Method to reset and orphan this object. More...
 
const SharedPtrTypegetParentSharedPtr (void) const
 Returns a shared pointer to the parent (WARNING: Does not work right). More...
 

Protected Types

typedef boost::weak_ptr< T > WeakPtrType
 Weak pointer of our own type. More...
 
typedef boost::shared_ptr< T > SharedPtrType
 Shared pointer of our own type. More...
 

Protected Attributes

WeakPtrType mParentWeakPtr
 Weak pointer to the parent. More...
 

Detailed Description

template<class T>
class torc::physical::Progeny< T >

Concept for any object that may have a parent.

Definition at line 29 of file Progeny.hpp.

Member Typedef Documentation

template<class T>
typedef boost::shared_ptr<T> torc::physical::Progeny< T >::SharedPtrType
protected

Shared pointer of our own type.

Definition at line 35 of file Progeny.hpp.

template<class T>
typedef boost::weak_ptr<T> torc::physical::Progeny< T >::WeakPtrType
protected

Weak pointer of our own type.

Definition at line 33 of file Progeny.hpp.

Constructor & Destructor Documentation

template<class T>
torc::physical::Progeny< T >::Progeny ( void  )
inline

Null constructor.

Definition at line 42 of file Progeny.hpp.

42 {}
template<class T>
torc::physical::Progeny< T >::Progeny ( const WeakPtrType inParentPtr)
inline

Constructor that specifies a parent.

Definition at line 44 of file Progeny.hpp.

44 : mParentWeakPtr(inParentPtr) {}
WeakPtrType mParentWeakPtr
Weak pointer to the parent.
Definition: Progeny.hpp:38

Member Function Documentation

template<class T>
const SharedPtrType& torc::physical::Progeny< T >::getParentSharedPtr ( void  ) const
inline

Returns a shared pointer to the parent (WARNING: Does not work right).

Always seems to generate a "Returning reference to temporary" warning, and I cannot figure out why.

It is the caller's responsibility to reset the shared pointer when done.

Todo:
Figure out why Progeny<T>::getParentSharedPtr() yields a "Returning reference to temporary" warning.

Definition at line 59 of file Progeny.hpp.

59 { return mParentWeakPtr.lock(); }
WeakPtrType mParentWeakPtr
Weak pointer to the parent.
Definition: Progeny.hpp:38
template<class T>
const WeakPtrType& torc::physical::Progeny< T >::getParentWeakPtr ( void  ) const
inline

Returns a weak pointer to the parent.

Definition at line 47 of file Progeny.hpp.

47 { return mParentWeakPtr; }
WeakPtrType mParentWeakPtr
Weak pointer to the parent.
Definition: Progeny.hpp:38
template<class T>
void torc::physical::Progeny< T >::resetParentWeakPtr ( void  )
inline

Method to reset and orphan this object.

Definition at line 51 of file Progeny.hpp.

51 { mParentWeakPtr.reset(); }
WeakPtrType mParentWeakPtr
Weak pointer to the parent.
Definition: Progeny.hpp:38
template<class T>
void torc::physical::Progeny< T >::setParentWeakPtr ( WeakPtrType  inParentPtr)
inline

Sets the weak pointer to the parent.

Definition at line 49 of file Progeny.hpp.

49 { mParentWeakPtr = inParentPtr; }
WeakPtrType mParentWeakPtr
Weak pointer to the parent.
Definition: Progeny.hpp:38

Field Documentation

template<class T>
WeakPtrType torc::physical::Progeny< T >::mParentWeakPtr
protected

Weak pointer to the parent.

Definition at line 38 of file Progeny.hpp.


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