Om
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Om::Owner< ThisValue > Class Template Reference

A polymorphic object with value semantics. More...

#include "owner.hpp"

+ Inheritance diagram for Om::Owner< ThisValue >:
+ Collaboration diagram for Om::Owner< ThisValue >:

Public Types

typedef void(Owner::* Boolean) () const
 The implementation of the Safe Boolean idiom. More...
 

Public Member Functions

 Owner ()
 
 Owner (Owner const &)
 
template<typename TheValue >
 Owner (std::auto_ptr< TheValue >)
 
Owneroperator= (Owner)
 
ThisValue & operator * ()
 
ThisValue const & operator * () const
 
ThisValue * operator -> ()
 
ThisValue const * operator -> () const
 
bool operator ! () const
 
 operator Boolean () const
 Implements the Safe Boolean idiom. More...
 
void Clear ()
 
ThisValue * GetValue ()
 
ThisValue const * GetValue () const
 
bool IsEmpty () const
 
template<typename TheValue >
void SetValue (std::auto_ptr< TheValue >)
 
void Swap (Owner &)
 
- Public Member Functions inherited from Om::Taker< Owner< ThisValue > >
virtual ~Taker ()=0
 
void Take (Owner< ThisValue > &)
 Swaps. More...
 
void Take (Owner< ThisValue > const &)
 Assigns. More...
 

Private Member Functions

void UncomparableBoolean () const
 

Private Attributes

boost::intrusive_ptr< ThisValue > thisValue
 The pointer to the contained, lazily-copied value. More...
 
bool thisWasExposed
 True if the contained value was exposed for modification. More...
 

Detailed Description

template<typename ThisValue>
class Om::Owner< ThisValue >

This class can be considered a smart pointer with deep copy semantics, such that copying the pointer also copies the pointee (lazily).

Definition at line 40 of file owner.hpp.

Member Typedef Documentation

◆ Boolean

template<typename ThisValue>
typedef void(Owner::* Om::Owner< ThisValue >::Boolean) () const

Definition at line 51 of file owner.hpp.

Constructor & Destructor Documentation

◆ Owner() [1/3]

template<typename ThisValue>
Om::Owner< ThisValue >::Owner ( )

◆ Owner() [2/3]

template<typename ThisValue>
Om::Owner< ThisValue >::Owner ( Owner< ThisValue > const &  )

◆ Owner() [3/3]

template<typename ThisValue>
template<typename TheValue >
Om::Owner< ThisValue >::Owner ( std::auto_ptr< TheValue >  )
explicit

Member Function Documentation

◆ operator=()

template<typename ThisValue>
Owner& Om::Owner< ThisValue >::operator= ( Owner< ThisValue >  )
Postcondition
Any references to the contained value, obtained via dereference, are invalidated.

◆ operator *() [1/2]

template<typename ThisValue>
ThisValue& Om::Owner< ThisValue >::operator * ( )
Precondition
Not empty.
Returns
The value. Do not retain this reference.

◆ operator *() [2/2]

template<typename ThisValue>
ThisValue const& Om::Owner< ThisValue >::operator * ( ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ operator ->() [1/2]

template<typename ThisValue>
ThisValue* Om::Owner< ThisValue >::operator -> ( )

◆ operator ->() [2/2]

template<typename ThisValue>
ThisValue const* Om::Owner< ThisValue >::operator -> ( ) const

◆ operator !()

template<typename ThisValue>
bool Om::Owner< ThisValue >::operator ! ( ) const
Returns
True if empty.

◆ operator Boolean()

template<typename ThisValue>
Om::Owner< ThisValue >::operator Boolean ( ) const

◆ Clear()

template<typename ThisValue>
void Om::Owner< ThisValue >::Clear ( )
Postcondition
Any references to the contained value, obtained via dereference, are invalidated.

◆ GetValue() [1/2]

template<typename ThisValue>
ThisValue* Om::Owner< ThisValue >::GetValue ( )

◆ GetValue() [2/2]

template<typename ThisValue>
ThisValue const* Om::Owner< ThisValue >::GetValue ( ) const

◆ IsEmpty()

template<typename ThisValue>
bool Om::Owner< ThisValue >::IsEmpty ( ) const
Returns
True if empty.

◆ SetValue()

template<typename ThisValue>
template<typename TheValue >
void Om::Owner< ThisValue >::SetValue ( std::auto_ptr< TheValue >  )
Postcondition
Any references to the contained value, obtained via dereference, are invalidated.

◆ Swap()

template<typename ThisValue>
void Om::Owner< ThisValue >::Swap ( Owner< ThisValue > &  )
Postcondition
Any references to the contained value, obtained via dereference, are invalidated.

◆ UncomparableBoolean()

template<typename ThisValue>
void Om::Owner< ThisValue >::UncomparableBoolean ( ) const
private

Member Data Documentation

◆ thisValue

template<typename ThisValue>
boost::intrusive_ptr<ThisValue> Om::Owner< ThisValue >::thisValue
private

Definition at line 138 of file owner.hpp.

◆ thisWasExposed

template<typename ThisValue>
bool Om::Owner< ThisValue >::thisWasExposed
private

Definition at line 144 of file owner.hpp.


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