Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
None.
Inherited By:
TAliasTo
TInstanceOf
TOnlyPointerTo
TPointerToReferenceCounted
Purpose:
TPointerTo is the abstract base class of the safe pointer wrappers. It contains a pointer to an object. It can be dereferenced (operator * or operator ->) like a regular pointer; but if it contains NIL (0), dereferencing it throws an exception.
Instantiation:
TPointerTo is an abstract class and cannot be instantiated.
Deriving Classes:
The classes TAliasTo, TInstanceOf, and TOnlyPointerTo are all derived from TPointerTo. Each of these derived classes implements an ownership policy; that is, a convention for what code is responsible for destroying the object to which this object points (and returning its storage to the heap):
TAliasTo does not own the object to which it points.
TInstanceOf owns the object to which it points, permanently.
TOnlyPointerTo owns the object to which it points, but may transfer ownership to another TOnlyPointerTo.
TPointerToReferenceCounted shares the object to which it points with other pointers. The object keeps track of the number of pointers to it.
Concurrency:
Not multithread safe.
Resource Use:
No special requirements.
Other Considerations:
None.
Member Function: TPointerTo::GetAlias
AType * GetAlias () const
Interface Category:
API.
Purpose:
Returns a copy of the pointer contained by this object.
Calling Context:
Call this function directly to obtain a alias to the object (if any) to which this object points.
Parameters:
Return Value:
A copy of the pointer contained by this object.
Exceptions:
Throws no exceptions.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TPointerTo::IsValid
bool IsValid () const
Interface Category:
API.
Purpose:
Return true if the pointer contained by this object in not NIL (0).
Calling Context:
Call this function directly to determine if the pointer contained by this object is NIL.
Parameters:
Return Value:
Returns true if the pointer contained by this object in not NIL.
Exceptions:
Throws no exceptions.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TPointerTo::Validate
void Validate () const
Interface Category:
API.
Purpose:
Throws an exception if this object contains a NIL pointer.
Calling Context:
Call this function directly in any context that requires a TPointerTo to be non-NIL, including TPointerTo::operator* and TPointerTo::operator->.
Parameters:
Return Value:
None.
Exceptions:
Throws ThrowInvalidUseOfNILPointer if this object contains a NIL pointer.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TPointerTo::operator->
AType * operator ->() const
Interface Category:
API.
Purpose:
Supports access to members of the object (if any) to which this object points.
Calling Context:
Call this function directly when the dereferencing operator is used with this object.
Parameters:
Return Value:
A pointer to the object (if any) to which this object points.
Exceptions:
Propagates ThrowInvalidUseOfNILPointer if this object contains a NIL pointer.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TPointerTo::operator*
AType & operator * () const
Interface Category:
API.
Purpose:
Supports access to the object (if any) to which this object points.
Calling Context:
Call this function directly when the indirection operator is used with this object.
Parameters:
Return Value:
A reference to the object (if any) to which this object points.
Exceptions:
Propagates ThrowInvalidUseOfNILPointer if this object contains a NIL pointer.
Concurrency:
Not multithread safe.
Other Considerations:
None.
TPointerTo (AType * alias =NIL)
Interface Category:
API.
Purpose:
Initializes the pointer contained in this object.
Calling Context:
Call this function directly.
Parameters:
- AType * alias =NIL -The initial value of the pointer.
Return Value:
None.
Exceptions:
Throws no exceptions.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TPointerTo::operator=
void operator =(AType * assign)
Interface Category:
API.
Purpose:
Changes the pointer contained in this object.
Calling Context:
Call this function directly.
Parameters:
- AType * assign -The new value of the pointer.
Return Value:
None.
Exceptions:
Throws no exceptions.
Concurrency:
Not multithread safe.
Other Considerations:
None.
~ TPointerTo ()
Interface Category:
API.
Purpose:
Sets the pointer contained in this object to NIL. The object (if any) to which this object pointed is not affected.
Calling Context:
Call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TPointerTo::Orphan
AType * Orphan ()
Interface Category:
API.
Purpose:
Returns a copy of the pointer contained in this object, and changes this object to contain NIL.
Calling Context:
Call this function directly.
Parameters:
Return Value:
A copy of the pointer that this object used to contain.
Exceptions:
Throws no exceptions.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.