Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

TLink Class Template Reference

The class for setting links to objects. More...

#include <link.h>

Inheritance diagram for TLink:

Inheritance graph
[legend]
Collaboration diagram for TLink:

Collaboration graph
[legend]
List of all members.

Public Methods

 TLink ()
 TLink (const TObjectID &DestID)
 TLink (X *p)
 TLink (const TLink< X > &link)
 operator X * () const
X * operator-> () const
X * getPointerToDest () const
virtual int2 getType () const
void setDest (X *p)
virtual void setNull ()

Private Methods

virtual void setDest (TLinkable *)

Friends

class TLinkUpdate

Detailed Description

template<class X>
class TLink< X >

The class for setting links to objects.

Author:
Marco Krohn <marco.krohn@gmx.de>
Version:
Id:
link.h,v 1.38 2002/05/15 08:30:55 ishark Exp
See also:
TLinkBase
This template class handles FIXME.

See TLinkBase for more general information about links.


Member Function Documentation

template<class X>
X* TLink< X >::getPointerToDest   const [inline]
 

Converts the pointer (to a TLinkable) to a pointer to the real object. If the conversion fails the method calls the Fatal function.

Returns:
A pointer to the object or 0 if the link points to nowhere.

template<class X>
virtual int2 TLink< X >::getType   const [inline, virtual]
 

Returns:
The type of the link, that means TLinkBase::LINK in this case.
See also:
TLinkBase::getType()

Reimplemented from TLinkBase.

Reimplemented in TDoubleLink.

template<class X>
TLink< X >::operator X *   const [inline]
 

Casts the link to a pointer. Note: this method is similar to getPointerToDest with the exception that an error message is triggered if the dest pointer is zero.

Parameters:
The  pointer to the dest object

template<class X>
X* TLink< X >::operator->   const [inline]
 

This allows using a link in the same way as a pointer. E.g. the following code is exactly doing what you would expect:

   TFoo f;      // derived from TLinkable
   link<TFoo> l( &f );
   l->aMethodOfTFoo();
 

Returns:
A pointer to the dest object.

template<class X>
virtual void TLink< X >::setDest TLinkable   p [inline, private, virtual]
 

Makes the implementation of TLinkBase::setDest private. This is neccessary because we now need the exact type of the destination object (otherwise it would be possible to pass an pointer to an object with the wrong (!=X) type. Note that there is another setDest method with correct type checking.

Reimplemented from TLinkBase.

template<class X>
void TLink< X >::setDest X *    p [inline]
 

Sets a link to an object type of X.

Parameters:
A  pointer to the object which should be linked.

template<class X>
virtual void TLink< X >::setNull   [inline, virtual]
 

See also:
TLinkBase::setNull()

Reimplemented from TLinkBase.


The documentation for this class was generated from the following file:
Generated on Thu Jun 20 18:13:26 2002 for Stellar Legacy by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001