#include <coherence/lang/MemberHolder.hpp>
Inherits SmartMember.
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 convience handle type which can be used for container like classes, which need to be able to contain both Handles and Views.
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 TypedHolder< T > | GetType |
| Result type for a non-const get operation. | |
Public Member Functions | |
| MemberHolder (Object &oParent) | |
| Construct a new MemberHolder referencing NULL via a handle. | |
| template<class DT> | |
| MemberHolder (Object &oParent, const TypedHandle< DT > &th) | |
| Construct a new MemberHolder refrencing specified Object via a Handle or View. | |
| template<class DT> | |
| MemberHolder (Object &oParent, const TypedHolder< DT > &th) | |
| Construct a new MemberHolder refrencing the same Object (and in the same manner) as the specified TypedHolder. | |
| template<class DT> | |
| MemberHolder (Object &oParent, const MemberHolder< DT > &that) | |
| Construct a new MemberHolder refrencing the same Object (and in the same manner) as the specified MemberHolder. | |
| ~MemberHolder () | |
| Destroy the MemberHolder. | |
| MemberHolder & | operator= (const MemberHolder &that) |
| Assign this MemberHolder to refrence the same Object (and in the same manner) as the specified MemberHolder. | |
| template<class DT> | |
| MemberHolder & | operator= (const MemberHolder< DT > &mh) |
| Assign this MemberHolder to refrence the same Object (and in the same manner) as the specified MemberHolder. | |
| template<class DT> | |
| MemberHolder & | operator= (const TypedHolder< DT > &th) |
| Assign this MemberHolder to refrence the same Object (and in the same manner) as the specified MemberHolder. | |
| template<class DT> | |
| MemberHolder & | operator= (const TypedHandle< DT > &h) |
| Assign this MemberHolder to refrence the same Object (and in the same manner) as the specified MemberHolder. | |
| MemberHolder & | operator= (const T *cp) |
| Assign this MemberHolder to refrence the same Object (and in the same manner) as the specified pointer. | |
| 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 |
| Derefrence the MemberHolder. | |
| template<class AT> | |
| bool | operator== (const MemberHolder< AT > &mh) const |
| Compare the supplied holder to this holder. | |
| template<class AT> | |
| bool | operator!= (const MemberHolder< AT > &mh) const |
| Compare the supplied holder to this holder. | |
| template<class AT> | |
| bool | operator== (const TypedHolder< AT > &th) const |
| Compare the supplied holder to this holder. | |
| template<class AT> | |
| bool | operator!= (const TypedHolder< AT > &th) const |
| Compare the supplied holder to this holder. | |
| template<class AT> | |
| bool | operator== (const TypedHandle< AT > &h) const |
| Compare the supplied handle to this holder. | |
| template<class AT> | |
| bool | operator!= (const TypedHandle< AT > &h) const |
| Compare the supplied handle to this holder. | |
| bool | operator== (const Object *cpThat) const |
| Compare the supplied pointer to this holder. | |
| bool | operator!= (const Object *cpThat) const |
| Compare the supplied pointer to this holder. | |
Protected Member Functions | |
| MemberHolder () | |
| Construct a MemberHolder without any associated parent. | |
| void | setView (const TypedHandle< const T > &v, SynchronizedMemberWriteBlock *pSync=NULL) |
| Set the Holder to reference an Object via a View. | |
| void | setHandle (const TypedHandle< T > &h, SynchronizedMemberWriteBlock *pSync=NULL) |
| Set the Holder to reference an Object via a Handle. | |
| template<class DT> | |
| void | set (const TypedHolder< DT > &th, SynchronizedMemberWriteBlock *pSync=NULL) |
| Set the MemberHolder to reference the same Object as the specified TypedHolder. | |
| TypedHolder< T > | get (SynchronizedMemberReadBlock *pSync=NULL) const |
| Return a TypedHolder referencing the same Object as this MemberHolder. | |
| MemberHolder | ( | Object & | oParent, | |
| const TypedHandle< DT > & | th | |||
| ) | [inline] |
Construct a new MemberHolder refrencing specified Object via a Handle or View.
As a Handle is used, the MemberHolder can be used with the cast() method to retrieve the Handle from the Holder.
| oParent | the self() on the object this data member is a member of | |
| th | a Handle or View to the Object to reference |
| MemberHolder | ( | Object & | oParent, | |
| const TypedHolder< DT > & | th | |||
| ) | [inline] |
Construct a new MemberHolder refrencing the same Object (and in the same manner) as the specified TypedHolder.
| oParent | the self() on the object this data member is a member of | |
| th | the TypedHolder to initialize from |
| MemberHolder | ( | Object & | oParent, | |
| const MemberHolder< DT > & | that | |||
| ) | [inline] |
Construct a new MemberHolder refrencing the same Object (and in the same manner) as the specified MemberHolder.
| oParent | the self() on the object this data member is a member of | |
| that | the MemberHolder to initialize from |
| MemberHolder | ( | ) | [inline, protected] |
Construct a MemberHolder without any associated parent.
The new MemberHolder is not useable until the parent is specified.
| MemberHolder& operator= | ( | const MemberHolder< T > & | that | ) | [inline] |
Assign this MemberHolder to refrence the same Object (and in the same manner) as the specified MemberHolder.
| that | the MemberHolder to assign from |
| MemberHolder& operator= | ( | const MemberHolder< DT > & | mh | ) | [inline] |
Assign this MemberHolder to refrence the same Object (and in the same manner) as the specified MemberHolder.
| mh | the TypedHolder to assign from |
| MemberHolder& operator= | ( | const TypedHolder< DT > & | th | ) | [inline] |
Assign this MemberHolder to refrence the same Object (and in the same manner) as the specified MemberHolder.
| th | the TypedHolder to assign from |
| MemberHolder& operator= | ( | const TypedHandle< DT > & | h | ) | [inline] |
Assign this MemberHolder to refrence the same Object (and in the same manner) as the specified MemberHolder.
| h | the TypedHandle to assign from |
| MemberHolder& operator= | ( | const T * | cp | ) | [inline] |
Assign this MemberHolder to refrence the same Object (and in the same manner) as the specified pointer.
| cp | the pointer to assign from |
| operator ValueView | ( | ) | const [inline] |
| o | ( | ) | const [inline] |
| o | ( | ) | const [inline] |
| ValueView operator-> | ( | ) | const [inline] |
| bool operator== | ( | const MemberHolder< AT > & | mh | ) | const [inline] |
Compare the supplied holder to this holder.
| mh | the holder to compare against |
| bool operator!= | ( | const MemberHolder< AT > & | mh | ) | const [inline] |
Compare the supplied holder to this holder.
| mh | the holder to compare against |
| bool operator== | ( | const TypedHolder< AT > & | th | ) | const [inline] |
Compare the supplied holder to this holder.
| th | the holder to compare against |
| bool operator!= | ( | const TypedHolder< AT > & | th | ) | const [inline] |
Compare the supplied holder to this holder.
| th | the holder to compare against |
| bool operator== | ( | const TypedHandle< AT > & | h | ) | const [inline] |
Compare the supplied handle to this holder.
| h | the handle to compare against |
| bool operator!= | ( | const TypedHandle< AT > & | h | ) | const [inline] |
Compare the supplied handle to this holder.
| h | the handle to compare against |
| bool operator== | ( | const Object * | cpThat | ) | const [inline] |
Compare the supplied pointer to this holder.
| cpThat | the pointer to compare against |
| bool operator!= | ( | const Object * | cpThat | ) | const [inline] |
Compare the supplied pointer to this holder.
| cpThat | the pointer to compare against |
| void setView | ( | const TypedHandle< const T > & | v, | |
| SynchronizedMemberWriteBlock * | pSync = NULL | |||
| ) | [inline, protected] |
| void setHandle | ( | const TypedHandle< T > & | h, | |
| SynchronizedMemberWriteBlock * | pSync = NULL | |||
| ) | [inline, protected] |
| void set | ( | const TypedHolder< DT > & | th, | |
| SynchronizedMemberWriteBlock * | pSync = NULL | |||
| ) | [inline, protected] |
Set the MemberHolder to reference the same Object as the specified TypedHolder.
| th | the TypedHolder to copy | |
| pSync | the sync block to delegate to or NULL to create one |
| 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 |