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

TWaypoint Class Reference

Stores waypoints. More...

#include <waypoint.h>

Collaboration diagram for TWaypoint:

Collaboration graph
[legend]
List of all members.

Public Methods

 TWaypoint ()
 TWaypoint (const TWaypoint &wp)
 TWaypoint (TStellarObject *stellarObject, double speed=0)
 TWaypoint (const TPoint &pos, double speed=0)
const TPointgetPos () const
TStellarObjectgetStellarObject () const
double getWantedSpeed () const
bool isStellarObject () const
bool load (TDataPackageList *in, const string &identifier, bool unique=true)
TWaypoint & operator= (const TWaypoint &wp)
bool operator== (const TWaypoint &src) const
void reset ()
bool save (TDataPackageList *out, const string &identifier, bool unique=true) const
void setPos (const TPoint &pos)
void setStellarObject (TStellarObject *stellarObject)
void setWantedSpeed (double speed)

Private Attributes

TLink< TStellarObjectfLinkStObj
TPoint fPos
double fWantedSpeed

Detailed Description

Stores waypoints.

Author:
Marco Krohn, <marco.krohn@gmx.de>
Version:
Id:
waypoint.h,v 1.9 2002/06/07 00:39:20 mkrohn5 Exp
See also:
TPoint, TStellarObject
A waypoint is either a point in space or a stellar object plus the information about the wanted speed to approach the point. If the waypoint was initialized as a point in space the waypoint will always stay the same. In contrary to a waypoint which was set to a stellar object. These waypoints will always return the position of the stellar object so the getPos return value depends on the position of the stellar object.


Constructor & Destructor Documentation

TWaypoint::TWaypoint  
 

Initializes the data with 0.

TWaypoint::TWaypoint const TWaypoint &    wp
 

Copy constructor.

TWaypoint::TWaypoint TStellarObject   stellarObject,
double    speed = 0
 

Calls setStellarObject to initialize the waypoint.

TWaypoint::TWaypoint const TPoint   pos,
double    speed = 0
 

Calls setPos and setWantedSpeed to initialize the waypoint.

Parameters:
pos  A point in space.
speed  The speed in units of the light speed.


Member Function Documentation

const TPoint& TWaypoint::getPos   const
 

Returns:
The position of the waypoint in space. If the waypoint was initialized with a stellar object the return value is the position of the stellar object.

TStellarObject* TWaypoint::getStellarObject   const
 

Returns:
The pointer to the stellar object or 0 if isStellarObject returns false.

double TWaypoint::getWantedSpeed   const
 

Returns:
The wanted speed of the stellar object.

bool TWaypoint::isStellarObject   const
 

Returns:
true if the waypoint was initialized with a stellar object, otherwise false.

bool TWaypoint::load TDataPackageList   in,
const string &    identifier,
bool    unique = true
 

Loads a TWaypoint object from a list of data packages. Note that a successful load will delete the datapackage from the data package list as well as the datapackage itself.

Parameters:
in  The input stream of data packages.
identifier  The identifier to look for.
unique  Loads the data only if the identifier is unique.
Returns:
true means that everything was loaded correctly, otherwise this method will return false.

TWaypoint& TWaypoint::operator= const TWaypoint &    wp
 

Assignment operator is simply doing an element by element copy.

Parameters:
wp  The waypoint to assign from.
Returns:
The new object.

bool TWaypoint::operator== const TWaypoint &    src const
 

Compares waypoints.

Parameters:
src  Waypoint to compare with.
Returns:
true if objects settings are identical otherwise false.

void TWaypoint::reset  
 

Sets fPos and fLinkStObj to null.

bool TWaypoint::save TDataPackageList   out,
const string &    identifier,
bool    unique = true
const
 

Creates the data packages of a TWaypoint object and adds them to the data package list.

Parameters:
out  The list of data packages.
identifier  The identifier which is used to store and find the data.
unique  If set to true the method will check if the identifier was already used in the data package list.
Returns:
true if everything worked fine, otherwise false (e.g. if the identifier was already used in the data package list).

void TWaypoint::setPos const TPoint   pos
 

Initializes the waypoint with an ordinary point in space.

Parameters:
pos  A point in space.

void TWaypoint::setStellarObject TStellarObject   stellarObject
 

Initializes the waypoint with an stellar object.

Parameters:
stellarObject  The stellar object the waypoint is set to.

void TWaypoint::setWantedSpeed double    speed
 

Sets the wanted speed to approach a destination.

Parameters:
speed  The wanted speed in units of the light speed.


Member Data Documentation

TLink<TStellarObject> TWaypoint::fLinkStObj [private]
 

The position is determined by a stellar object if and only if fLinkStObj is not set to null.

TPoint TWaypoint::fPos [private]
 

The position of the object. This value is only valid if fLinkStObj is set to null.

double TWaypoint::fWantedSpeed [private]
 

The wanted speed to approach the destination.


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