library of assembled shared sources |
http://lass.cocamware.com |
#include <smart_ptr_policies.h>
Public Types | |
typedef IntrusiveCounter< T, CounterType, referenceCounter > | TSelf |
typedef CounterType | TCount |
Protected Member Functions | |
template<typename TStorage > | |
void | init (TStorage &pointee) |
template<typename TStorage > | |
void | dispose (TStorage &pointee) |
template<typename TStorage > | |
void | increment (TStorage &pointee) |
template<typename TStorage > | |
bool | decrement (TStorage &pointee) |
template<typename TStorage > | |
TCount | count (TStorage &pointee) const |
void | swap (TSelf &) |
This comes from "C++ Templates, The Complete Guide" by David Vandevoorde and Nicolai M. Josuttis. See their
MemberReferenceCount
policy.The DefaultCounter policy puts the reference counter outside the managed object. That's great in most cases, because that way, the managed type doesn't have to be designed to be used with our SharedPtr. However, in some cases it is more interesting to put the reference counter inside the managed object. You can use the IntrusiveCounter policy to use such a reference counter with our SharedPtr.
struct Foo { std::string blablabla; int referenceCount; }; typedef lass::util::SharedPtr < Foo, lass::util::ObjectStorage, lass::util::IntrusiveCounter < Foo, // the managed type (containing the counter) int, // type of the counter &Foo::referenceCount // pointer to the counter > > TFooPtr; TFooPtr foo(new Foo);
Definition at line 418 of file smart_ptr_policies.h.
typedef IntrusiveCounter<T, CounterType, referenceCounter> lass::util::IntrusiveCounter< T, CounterType, referenceCounter >::TSelf |
Definition at line 422 of file smart_ptr_policies.h.
typedef CounterType lass::util::IntrusiveCounter< T, CounterType, referenceCounter >::TCount |
Definition at line 423 of file smart_ptr_policies.h.
void lass::util::IntrusiveCounter< T, CounterType, referenceCounter >::init | ( | TStorage & | pointee | ) | [inline, protected] |
void lass::util::IntrusiveCounter< T, CounterType, referenceCounter >::dispose | ( | TStorage & | pointee | ) | [inline, protected] |
void lass::util::IntrusiveCounter< T, CounterType, referenceCounter >::increment | ( | TStorage & | pointee | ) | [inline, protected] |
Definition at line 438 of file smart_ptr_policies.h.
References lass::util::atomicCompareAndSwap(), and LASS_ASSERT.
bool lass::util::IntrusiveCounter< T, CounterType, referenceCounter >::decrement | ( | TStorage & | pointee | ) | [inline, protected] |
Definition at line 451 of file smart_ptr_policies.h.
References lass::util::atomicCompareAndSwap(), and LASS_ASSERT.
TCount lass::util::IntrusiveCounter< T, CounterType, referenceCounter >::count | ( | TStorage & | pointee | ) | const [inline, protected] |
void lass::util::IntrusiveCounter< T, CounterType, referenceCounter >::swap | ( | TSelf & | ) | [inline, protected] |
Definition at line 471 of file smart_ptr_policies.h.
Generated on Mon Nov 10 14:22:17 2008 for Library of Assembled Shared Sources by 1.5.7.1 |