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

TLinkUpdate Class Reference

Updates link objects during the loading process. More...

#include <link.h>

Collaboration diagram for TLinkUpdate:

Collaboration graph
[legend]
List of all members.

Public Methods

 ~TLinkUpdate ()
bool checkConsistency ()
void commitUpdate (TLinkable *pNew, const TObjectID &OldID)
void deleteUpdateRequest (const TLinkBase *pLink)
void requestUpdate (TLinkBase *pLink)
void reset ()

Static Public Methods

TLinkUpdate * instance ()

Protected Methods

 TLinkUpdate ()

Private Methods

void showMap ()
void showUpdateList ()

Private Attributes

map< TObjectID, TLinkable *> fMap
TLinkBaseList fUpdateList

Static Private Attributes

TLinkUpdate * fInstance

Detailed Description

Updates link objects during the loading process.

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, TLink, TLinkable, TObjectID
A link consists (as described in TLink, TLinkBase) consists of two parts, the ID of the dest object and the address of the object. During the loading process a link loads only the ID of the dest object since the dest object might not even be there during loading time. All loaded links and linkable objects register themselves (automatically, you don't have to care about the details) in TLinkUpdate which than cares about updating the links.

For details please read the RFC "Object ID Handling".


Constructor & Destructor Documentation

TLinkUpdate::~TLinkUpdate  
 

Calls checkConsistency to ensure that everything is o.k.

TLinkUpdate::TLinkUpdate   [protected]
 

Constructor made protected to ensure that the users of this class can only create exactly one instance.

See also:
instance


Member Function Documentation

bool TLinkUpdate::checkConsistency  
 

Checks if the class really updated all links which requested an update. This method should be called after all objects are loaded.

Returns:
true no problems during update, otherwise false.

void TLinkUpdate::commitUpdate TLinkable   pNew,
const TObjectID   OldID
 

When a new TLinkable object is read the pointer to the object and the old ID of the object are send to LinkUpdate. These information are then stored in a map. If one of the links in the UpdateList points to the old ID than this link is updated and removed from the list.

Parameters:
pNew  Pointer to the new object.
OldID  The ID the object had before.

void TLinkUpdate::deleteUpdateRequest const TLinkBase   pLink
 

In case the link does not need an update any more the request is deleted from the UpdateList.

Parameters:
pLink  The link that does not need an update anymore.

TLinkUpdate* TLinkUpdate::instance   [static]
 

Returns:
The unique instance of TLinkUpdate.

void TLinkUpdate::requestUpdate TLinkBase   pLink
 

Requests an update for a link. If Map already provides the needed information the link is immediately updated. Otherwise the pointer is added to the UpdateList and has to wait for the update.

Parameters:
pLink  The link that needs an update.

void TLinkUpdate::reset  
 

Resets the class to the initial state. You should know what you are doing!


Member Data Documentation

TLinkUpdate* TLinkUpdate::fInstance [static, private]
 

The global (and unique) instance of TUniverse

map<TObjectID, TLinkable*> TLinkUpdate::fMap [private]
 

A map that stores for all old ID the new pointer to the object.

TLinkBaseList TLinkUpdate::fUpdateList [private]
 

The list of links which need an update.


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