Oracle Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.1.2)

E26041-01

FinalHandle Class Template Reference

#include <coherence/lang/FinalHandle.hpp>

Inherits MemberHandle< T >.

List of all members.


Detailed Description

template<class T>
class coherence::lang::FinalHandle< T >

FinalHandle is an immutable thread-safe handle used by an Object to reference its non-const child Objects.

FinalHandles may either be initialized with a value at construction-time, or thereafter via the initialize() function. A FinalHandle may be initialized only if the following conditions hold:

For example:

 class Foo
   : public class_spec<Foo>
   {
   friend class factory<Foo>;

   protected:
     Foo()
       : f_hBar(self()) // construction without initialization
       {}

   public:
     void setBar(Bar::Handle hBar)
       {
       initialize(f_hBar, hBar); // post-construction initialization
       }

   private:
     FinalHandle<Bar> f_hBar;
   };

FinalHandles transfer the constness of their parent Object. When a FinalHandle is accessed from within a const method of the enclosing "parent" class, it will only provide const access to the Object which it references. If the enclosing Object becomes only accessed via views the FinalHandle will also automatically, and permanently switch its reference type from a handle to a view.

Note: In the rare case that a FinalHandle is declared via the mutable keyword, the FinalHandle must be informed of this fact by setting fMutable to true during construction. A mutable FinalHandle will will return Handles from const methods of the class it is a data member of. The FinalHandle cannot be reassigned to reference another object.

Author:
mf 2008.12.01
See also:
FinalView

FinalHolder


Public Types

typedef 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.

Public Member Functions

 FinalHandle (const Object &oGuardian)
 Construct a new FinalHandle referencing NULL via a handle.
 FinalHandle (const Object &oGuardian, const ValueHandle &that)
 Construct a new FinalHandle referencing specified Object.
 FinalHandle (const Object &oGuardian, const ValueHandle &that, bool fMutable)
 Construct a new FinalHandle referencing specified Object.
 operator ValueView () const
 Return a View to the referenced Object.
 operator ValueHandle ()
 Return a Handle to the referenced Object.
template<class PT>
 o () const
 Return a View to the referenced Object.
template<class PT>
 o ()
 Return a Handle to the referenced Object.
template<class PT>
 o () const
 Return a TypedHolder to the referenced Object.
template<class PT>
 o ()
 Return a TypedHolder to the referenced Object.
const T * operator-> () const
 Dereference the FinalHandle.
T * operator-> ()
 Dereference the FinalHandle.

Protected Member Functions

virtual size64_t retained () const
 Return the deep byte size of any managed objects held by this SmartMember.
void initialize (ValueHandle that)
 Initialize the value of a FinalHandle after it is constructed.

Constructor & Destructor Documentation

FinalHandle ( const Object oGuardian  )  [inline]

Construct a new FinalHandle referencing NULL via a handle.

Parameters:
oGuardian the object that protects this member

FinalHandle ( const Object oGuardian,
const ValueHandle that 
) [inline]

Construct a new FinalHandle referencing specified Object.

Parameters:
oGuardian the object that protects this member
that the object to reference

FinalHandle ( const Object oGuardian,
const ValueHandle that,
bool  fMutable 
) [inline]

Construct a new FinalHandle referencing specified Object.

Parameters:
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


Member Function Documentation

operator ValueView (  )  const [inline]

Return a View to the referenced Object.

Returns:
a View to the referenced Object

Reimplemented from MemberHandle.

operator ValueHandle (  )  [inline]

Return a Handle to the referenced Object.

Returns:
a Handle to the referenced Object

Reimplemented from MemberHandle.

o (  )  const [inline]

Return a View to the referenced Object.

Returns:
a View to the referenced Object

Reimplemented from MemberHandle.

o (  )  [inline]

Return a Handle to the referenced Object.

Returns:
a Handle to the referenced Object

Reimplemented from MemberHandle.

o (  )  const [inline]

Return a TypedHolder to the referenced Object.

Returns:
a TypedHolder to the referenced Object

Reimplemented from MemberHandle.

o (  )  [inline]

Return a TypedHolder to the referenced Object.

Returns:
a TypedHolder to the referenced Object

Reimplemented from MemberHandle.

const T* operator-> (  )  const [inline]

Dereference the FinalHandle.

Returns:
a const pointer to the referenced Object

Reimplemented from MemberHandle.

T* operator-> (  )  [inline]

Dereference the FinalHandle.

Returns:
a const pointer to the referenced Object

Reimplemented from MemberHandle.

void initialize ( ValueHandle  that  )  [inline, protected]

Initialize the value of a FinalHandle after it is constructed.

A FinalHandle may be initialized only if the following conditions hold:

Parameters:
that the value to initialize this FinalHandle to


The documentation for this class was generated from the following file:
Copyright © 2000, 2013, Oracle and/or its affiliates. All rights reserved.