#include <coherence/lang/MemberHolder.hpp>
Inherits SmartMember.
Inherited by FinalHolder.
MemberHolder can safely be used in place of View but adds the ability to attempt a safe down cast to a Handle. This differs from the C++ const_cast in that the down cast will only succeed if the MemberHolder had been assigned from a Handle, an assignment from a View results in a MemberHolder whose down cast operation will throw a ClassCastException.
MemberHolder is not for general use, instead it is a convenience handle type which can be used for container like classes, which need to be able to contain both Handles and Views.
Note: In the rare case that a MemberHolder is declared via the mutable keyword, the MemberHolder must be informed of this fact by setting fMutable to true during construction.
Public Types | ||||
typedef const T | ValueType | |||
The type of the values the holder can reference. | ||||
typedef T::Handle | ValueHandle | |||
The Handle type for the referenced Object. | ||||
typedef T::View | ValueView | |||
The View type for the referenced Object. | ||||
typedef T::Holder | ValueHolder | |||
The Holder type for the referenced Object. | ||||
typedef TypedHolder< T > | GetType | |||
Result type for a non-const get operation. | ||||
Public Member Functions | ||||
MemberHolder (const Object &oGuardian) | ||||
Construct a new MemberHolder referencing NULL via a handle. | ||||
MemberHolder (const Object &oGuardian, const TypedHolder< T > &that) | ||||
Construct a new MemberHolder referencing the specified Object. | ||||
MemberHolder (const Object &oGuardian, const TypedHolder< T > &that, bool fMutable) | ||||
Construct a new MemberHolder referencing the specified Object. | ||||
~MemberHolder () | ||||
Destroy the MemberHolder. | ||||
MemberHolder & | operator= (const MemberHolder &that) | |||
Assign this MemberHolder to reference the same Object (and in the same manner) as the specified MemberHolder. | ||||
MemberHolder & | operator= (const TypedHolder< T > &that) | |||
Assign this MemberHolder to reference the same Object (and in the same manner) as the specified MemberHolder. | ||||
operator ValueView () const | ||||
Return a View to the referenced Object. | ||||
template<class PT> | ||||
o () const | ||||
Return a View to the referenced Object. | ||||
template<class PT> | ||||
o () const | ||||
Return a TypedHolder to the referenced Object. | ||||
ValueView | operator-> () const | |||
Dereference the MemberHolder. | ||||
const T & | operator * () const | |||
Dereference this handle, returning T& . | ||||
Protected Member Functions | ||||
MemberHolder () | ||||
Construct a MemberHolder without any associated guardian. | ||||
virtual void | onEscape (bool fEscaped) const | |||
Event called when the guarding Object's escape state changes. Derived implementations of this method should include a delegation call to their super class onEscape() method, after they've done their own processing of the event.
| ||||
virtual size64_t | retained () const | |||
Return the deep byte size of any managed objects held by this SmartMember. | ||||
void | set (const TypedHolder< T > &that, SynchronizedMemberWriteBlock *pSync=NULL) | |||
Set the Holder to reference an Object via a View. | ||||
void | setEscaped (const TypedHolder< T > &that, SynchronizedMemberWriteBlock *pSync=NULL) | |||
Set the escaped Holder to reference an Object via a View. | ||||
TypedHolder< T > | get (SynchronizedMemberReadBlock *pSync=NULL) const | |||
Return a TypedHolder referencing the same Object as this MemberHolder. | ||||
TypedHolder< T > | getEscaped (SynchronizedMemberReadBlock *pSync=NULL) const | |||
Return a TypedHolder referencing the same Object as this MemberHolder. | ||||
void | performAction (Action nAction) const | |||
Perform the specified action. | ||||
Protected Attributes | ||||
T * | m_po | |||
The referenced Object. |
MemberHolder | ( | const Object & | oGuardian | ) | [inline] |
Construct a new MemberHolder referencing NULL via a handle.
oGuardian | the object that protects this member |
MemberHolder | ( | const Object & | oGuardian, | |
const TypedHolder< T > & | that | |||
) | [inline] |
Construct a new MemberHolder referencing the specified Object.
oGuardian | the object that protects this member | |
that | the Object to reference |
MemberHolder | ( | const Object & | oGuardian, | |
const TypedHolder< T > & | that, | |||
bool | fMutable | |||
) | [inline] |
Construct a new MemberHolder referencing the specified Object.
oGuardian | the object that protects this member | |
that | the Object to reference | |
fMutable | true if the member is declared as mutable, false if declared as const |
MemberHolder | ( | ) | [inline, protected] |
Construct a MemberHolder without any associated guardian.
The new MemberHolder is not usable until the guardian is specified.
MemberHolder& operator= | ( | const MemberHolder< T > & | that | ) | [inline] |
Assign this MemberHolder to reference the same Object (and in the same manner) as the specified MemberHolder.
that | the object to reference |
MemberHolder& operator= | ( | const TypedHolder< T > & | that | ) | [inline] |
Assign this MemberHolder to reference the same Object (and in the same manner) as the specified MemberHolder.
that | the object to reference |
operator ValueView | ( | ) | const [inline] |
Return a View to the referenced Object.
Reimplemented in FinalHolder, FinalHolder< coherence::util::ConverterCollections::ConverterQueryMap >, FinalHolder< coherence::util::Set >, FinalHolder< coherence::net::cache::OldCache >, FinalHolder< coherence::util::ConverterCollections::ConverterInvocableMap >, FinalHolder< coherence::util::SafeHashMap >, FinalHolder< coherence::util::List >, FinalHolder< coherence::util::Iterator >, FinalHolder< coherence::util::SortedBag >, FinalHolder< coherence::util::Map::Entry >, FinalHolder< coherence::util::Collection >, FinalHolder< coherence::util::ConverterCollections::ConverterConcurrentMap >, FinalHolder< coherence::lang::Object >, FinalHolder< coherence::util::Map >, and FinalHolder< coherence::util::ListIterator >.
o | ( | ) | const [inline] |
Return a View to the referenced Object.
Reimplemented in FinalHolder, FinalHolder, FinalHolder< coherence::util::ConverterCollections::ConverterQueryMap >, FinalHolder< coherence::util::ConverterCollections::ConverterQueryMap >, FinalHolder< coherence::util::Set >, FinalHolder< coherence::util::Set >, FinalHolder< coherence::net::cache::OldCache >, FinalHolder< coherence::net::cache::OldCache >, FinalHolder< coherence::util::ConverterCollections::ConverterInvocableMap >, FinalHolder< coherence::util::ConverterCollections::ConverterInvocableMap >, FinalHolder< coherence::util::SafeHashMap >, FinalHolder< coherence::util::SafeHashMap >, FinalHolder< coherence::util::List >, FinalHolder< coherence::util::List >, FinalHolder< coherence::util::Iterator >, FinalHolder< coherence::util::Iterator >, FinalHolder< coherence::util::SortedBag >, FinalHolder< coherence::util::SortedBag >, FinalHolder< coherence::util::Map::Entry >, FinalHolder< coherence::util::Map::Entry >, FinalHolder< coherence::util::Collection >, FinalHolder< coherence::util::Collection >, FinalHolder< coherence::util::ConverterCollections::ConverterConcurrentMap >, FinalHolder< coherence::util::ConverterCollections::ConverterConcurrentMap >, FinalHolder< coherence::lang::Object >, FinalHolder< coherence::lang::Object >, FinalHolder< coherence::util::Map >, FinalHolder< coherence::util::Map >, FinalHolder< coherence::util::ListIterator >, and FinalHolder< coherence::util::ListIterator >.
o | ( | ) | const [inline] |
Return a TypedHolder to the referenced Object.
Reimplemented in FinalHolder, FinalHolder, FinalHolder< coherence::util::ConverterCollections::ConverterQueryMap >, FinalHolder< coherence::util::ConverterCollections::ConverterQueryMap >, FinalHolder< coherence::util::Set >, FinalHolder< coherence::util::Set >, FinalHolder< coherence::net::cache::OldCache >, FinalHolder< coherence::net::cache::OldCache >, FinalHolder< coherence::util::ConverterCollections::ConverterInvocableMap >, FinalHolder< coherence::util::ConverterCollections::ConverterInvocableMap >, FinalHolder< coherence::util::SafeHashMap >, FinalHolder< coherence::util::SafeHashMap >, FinalHolder< coherence::util::List >, FinalHolder< coherence::util::List >, FinalHolder< coherence::util::Iterator >, FinalHolder< coherence::util::Iterator >, FinalHolder< coherence::util::SortedBag >, FinalHolder< coherence::util::SortedBag >, FinalHolder< coherence::util::Map::Entry >, FinalHolder< coherence::util::Map::Entry >, FinalHolder< coherence::util::Collection >, FinalHolder< coherence::util::Collection >, FinalHolder< coherence::util::ConverterCollections::ConverterConcurrentMap >, FinalHolder< coherence::util::ConverterCollections::ConverterConcurrentMap >, FinalHolder< coherence::lang::Object >, FinalHolder< coherence::lang::Object >, FinalHolder< coherence::util::Map >, FinalHolder< coherence::util::Map >, FinalHolder< coherence::util::ListIterator >, and FinalHolder< coherence::util::ListIterator >.
ValueView operator-> | ( | ) | const [inline] |
Dereference the MemberHolder.
Reimplemented in FinalHolder, FinalHolder< coherence::util::ConverterCollections::ConverterQueryMap >, FinalHolder< coherence::util::Set >, FinalHolder< coherence::net::cache::OldCache >, FinalHolder< coherence::util::ConverterCollections::ConverterInvocableMap >, FinalHolder< coherence::util::SafeHashMap >, FinalHolder< coherence::util::List >, FinalHolder< coherence::util::Iterator >, FinalHolder< coherence::util::SortedBag >, FinalHolder< coherence::util::Map::Entry >, FinalHolder< coherence::util::Collection >, FinalHolder< coherence::util::ConverterCollections::ConverterConcurrentMap >, FinalHolder< coherence::lang::Object >, FinalHolder< coherence::util::Map >, and FinalHolder< coherence::util::ListIterator >.
const T& operator * | ( | ) | const [inline] |
Dereference this handle, returning T&
.
T&
reference to the referenced ObjectNullPointerException | if the this handle is NULL |
void set | ( | const TypedHolder< T > & | that, | |
SynchronizedMemberWriteBlock * | pSync = NULL | |||
) | [inline, protected] |
void setEscaped | ( | const TypedHolder< T > & | that, | |
SynchronizedMemberWriteBlock * | pSync = NULL | |||
) | [inline, protected] |
TypedHolder<T> get | ( | SynchronizedMemberReadBlock * | pSync = NULL |
) | const [inline, protected] |
Return a TypedHolder referencing the same Object as this MemberHolder.
pSync | the sync block to delegate to or NULL to create one |
TypedHolder<T> getEscaped | ( | SynchronizedMemberReadBlock * | pSync = NULL |
) | const [inline, protected] |
Return a TypedHolder referencing the same Object as this MemberHolder.
pSync | the sync block to delegate to or NULL to create one |
void performAction | ( | Action | nAction | ) | const [inline, protected] |
Perform the specified action.
nAction | the action to perform |