Class: TModelPointerTo

Declaration: CompoundDocument.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TModelPointer

Inherited By:

None.

Purpose:

Typesafe template wrapper for TModelPointer. Provides operator* and operator->. Clients should declare an instance of this class to be const for read-only access to the model, and non-const for write access to the model. If this is done, then the compiler automatically calls the appropriate (const or non-const) version of the dereferencing and indirection operators. Note: The model is not locked until the first access. This is necessary because the type of lock (read or write) cannot be determined until the appropriate indirection operator (const or non-const) has been called.

Instantiation:

Always allocate on the stack.

Deriving Classes:

Do not derive from this class.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Other Considerations:

None.

Member Function: TModelPointerTo::TModelPointerTo

TModelPointerTo (const TModelReference &)

Interface Category:

API.

Purpose:

Constructs a smart pointer to model. Doesn't lock model until first access.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TModelPointerTo::~TModelPointerTo

~ TModelPointerTo ()

Interface Category:

API.

Purpose:

Destructor. Unlocks the model if it has been locked.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TModelPointerTo::operator->

  1. const AModel * operator ->() const
  2. AModel * operator ->()

Interface Category:

API.

Purpose:

  1. Locks model for reading. Looks up and returns a const pointer to the model.
  2. Locks model for writing. Looks up and returns a non-const pointer to the model.

Calling Context:

  1. Clients that want read access to the model.
  2. Clients that want write access to the model.

Parameters:

Return Value:

Returns a pointer to the locked model.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

The model stays locked until the TModelPointerTo is destroyed.

Member Function: TModelPointerTo::operator*

  1. const AModel & operator * () const
  2. AModel & operator * ()

Interface Category:

API.

Purpose:

  1. Locks model for reading. Looks up and returns a const reference to the model.
  2. Locks model for writing. Looks up and returns a non-const pointer to the model.

Calling Context:

  1. Clients that want read access to the model.
  2. Clients that want write access to the model.

Parameters:

Return Value:

Returns a reference to the locked model.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

The model stays locked until the TModelPointerTo is destroyed.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.