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

TSubstanceHold Class Reference

Substance handling classes: substance Hold. More...

#include <substance.h>

Inheritance diagram for TSubstanceHold:

Inheritance graph
[legend]
Collaboration diagram for TSubstanceHold:

Collaboration graph
[legend]
List of all members.

Public Methods

 TSubstanceHold (void)
 ~TSubstanceHold (void)
 TSubstanceHold (const TSubstanceHold &Hold2)
TSubstanceHold & operator= (const TSubstanceHold &Hold2)
TOSVal TotalSpace (const uint2 uCClass) const
TOSVal AvailableSpace (const uint2 uCClass) const
TOSVal UsedSpace (const uint2 uCClass) const
void Clear (void)
void Empty (void)
bool GetAllFrom (TSubstanceHold *Hold2)
bool GetFrom (TSubstanceHold *Hold2, const TSubstanceSet &MaxAbsolute, const TSubstanceSet &MaxRelative)
bool SplitOff (TSubstanceHold *Hold2)
bool CanAdd (const TSubstanceSet &Set) const
bool Add (const TSubstanceSet &Set2, TSubstanceSet *Added)
bool CanRemove (const TSubstanceSet &Set, const int4 iNum=1, const int4 iDenom=1) const
bool Remove (const TSubstanceSet &Set, TSubstanceSet *Removed, const int4 iNum=1, const int4 iDenom=1)
bool CanAdd (const TSubstance &Subst) const
bool Add (const TSubstance &Subst, TSubstance *Added)
bool CanRemove (const TSubstance &Subst, const int4 iNum=1, const int4 iDenom=1) const
bool Remove (const TSubstance &Subst, TSubstance *Removed, const int4 iNum=1, const int4 iDenom=1)
void UpdateCargo (void)
bool load (TDataPackageList *in, const string &sIdentifier, bool bUnique=true)
bool save (TDataPackageList *out, const string &sIdentifier, bool bUnique=true) const

Private Methods

void In (const TSubstance &s)
void Out (const TSubstance &s, const int4 iNum, const int4 iDenom)

Private Attributes

vector< TOSValfTotalSpace
vector< TOSValfAvailSpace

Friends

ostream & operator<< (ostream &os, const TSubstanceHold &Hold)

Detailed Description

Substance handling classes: substance Hold.

Substance hold class. This function is derived from TSubstanceSet, but you should act as if it weren't :) It provides similar operation, but guarantees that the total size (positive-sized and negative-sized substances) for a specified cargo class is megative, i.e. you cannot put in more stuff than the space to hold it.

Please check TSubstance for an overview of the substance classes.

Version:
Id:
substance.h,v 1.10 2002/06/03 11:48:24 mkrohn5 Exp
See also:
TSubstanceType,TSubstance,TSubstanceSet


Member Function Documentation

TOSVal TSubstanceHold::AvailableSpace const uint2    uCClass const
 

Determine the size offered/taken by all substances (acts like "remaining cargo space").

Returns:
the opposite of the total size (i.e. a positive number) of all substances.
Parameters:
uCClass  cargo class to be examined.

Reimplemented from TSubstanceSet.

void TSubstanceHold::Clear void   
 

Clear the set, eliminating all elements it contains.

Reimplemented from TSubstanceSet.

bool TSubstanceHold::load TDataPackageList   in,
const string &    sIdentifier,
bool    bUnique = true
 

With the method Load you can load a TSubstanceHold object from the data packages in the list. For more information look in the documentation of TLinkable.

Parameters:
in  the list of data packages
sIdentifier  the string this item pack is saved under
bUnique  bool value whether the indentifiers have to be unique
Returns:
true means that everything was loaded correctly, otherwise this method will return false.
See also:
TLinkable

Reimplemented from TSubstanceSet.

bool TSubstanceHold::save TDataPackageList   out,
const string &    sIdentifier,
bool    bUnique = true
const
 

With the method Save you can save a TSubstanceHold object from the data packages in the list. For more information look in the documentation of TLinkable.

Parameters:
in  the list of data packages
sIdentifier  the string this item pack is to be saved under
bUnique  bool value whether the indentifiers have to be unique
Returns:
true means that everything was saved correctly, otherwise this method will return false.
See also:
TLinkable

Reimplemented from TSubstanceSet.

TOSVal TSubstanceHold::TotalSpace const uint2    uCClass const
 

Determine the size "offered" by negative-sized substances (positive-sized are ignored).

Returns:
the opposite of the total size (i.e. a positive number) of negative-sized substances.
Parameters:
uCClass  cargo class to be examined.

Reimplemented from TSubstanceSet.

TOSVal TSubstanceHold::UsedSpace const uint2    uCClass const
 

Determine the size taken by all positive-sized substances (acts like "how much stuff is stored").

Returns:
the the total size (i.e. a positive number) of all positive-sized substances.
Parameters:
uCClass  cargo class to be examined.

Reimplemented from TSubstanceSet.


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