#include <substance.h>
Inheritance diagram for TSubstanceSet:
Public Methods | |
TSubstanceSet (void) | |
~TSubstanceSet (void) | |
TSubstanceSet (const TSubstanceSet &Set2) | |
bool | operator== (const TSubstanceSet &Set2) const |
bool | operator!= (const TSubstanceSet &Set2) const |
TSubstanceSet & | operator= (const TSubstanceSet &Set2) |
void | Clear (void) |
TOSVal | TotalSpace (const uint2 uCClass) const |
TOSVal | AvailableSpace (const uint2 uCClass) const |
TOSVal | UsedSpace (const uint2 uCClass) const |
bool | HasEnough (const TSubstanceSet &Set2, const int4 iNum=1, const int4 iDenom=1) const |
bool | Add (const TSubstanceSet &Set2, const int4 iNum=1, const int4 iDenom=1) |
bool | Remove (const TSubstanceSet &Set, const int4 iNum=1, const int4 iDenom=1) |
bool | HasEnough (const TSubstance &Subst, const int4 iNum=1, const int4 iDenom=1) const |
bool | Add (const TSubstance &Subst, const int4 iNum=1, const int4 iDenom=1) |
bool | Remove (const TSubstance &Subst, const int4 iNum=1, const int4 iDenom=1) |
const TSubstance * | operator[] (const TSubstanceType *Type) const |
const TPEList< TSubstance > & | Content (void) const |
bool | load (TDataPackageList *in, const string &sIdentifier, bool bUnique=true) |
bool | save (TDataPackageList *out, const string &sIdentifier, bool bUnique=true) const |
Protected Methods | |
TSubstance * | FindSubstance (const TSubstanceType *type) const |
void | DeleteSubstance (TSubstance *Subst) |
Protected Attributes | |
TPEList< TSubstance > | fContains |
Friends | |
ostream & | operator<< (ostream &os, const TSubstanceSet &Set) |
Substance set class. Instances of this class represent groups of substances. Substances of the same type are automatically added, so you can't have two ironoum amounts: they'll be added.
Please check TSubstance for an overview of the substance classes.
|
Constructor: builds an empty set. |
|
Non-virtual destructor, TSubstanceSet is not meant for derivation (you can derive it but must not use TSubstanceSet* to point to a derived object). |
|
Copy constructor: duplication of Sets is legal. |
|
Adds to the Set the given substance set. Set2 is left untouched. The new set is added iNum/iDenom times. The default values for both iNum and iDenom are 1.
|
|
Adds to the Set the amount specifies by Set2. Set2 is left untouched. The new set is added iNum/iDenom times. The default values for both iNum and iDenom are 1.
|
|
Determine the size offered/taken by all substances (acts like "remaining cargo space").
Reimplemented in TSubstanceHold. |
|
Clear the set, eliminating all elements it contains. Reimplemented in TSubstanceHold. |
|
Provide access to the internal vector. This is dangerous and will either be eliminated or replaced with a safe implemetation. |
|
Delete a TSubstance object from the internal vector. |
|
Locate a TSubstance in the internal vector. |
|
Check if the Set has enough of the specified substance. In any case the set is left untouched.
|
|
Check if the Set has enough substances to allow a removal of the amount specified by Set2 * iNum / iDenom. In any case the set is left untouched.
|
|
With the method Load you can load a TSubstanceSet object from the data packages in the list. For more information look in the documentation of TLinkable.
Reimplemented in TSubstanceHold. |
|
Assignment operator: duplication of Sets is legal. |
|
Compare operator |
|
Access a specified type of substance directly (read mode).
|
|
Remove a specified substance from the set. If the Set does not contain enough substances to allow the removal of the amount given by Subst * iNum / iDenom the function returns false and no action is taken. If the Set contains enough substance, then it is removed and the function returns true.
|
|
Remove is used to subtract sets. If the Set does not contain enough substances to allow the removal of the amount given by Set2 * iNum / iDenom the function returns false and no action is taken. If the Set contains enough substances, then they are removed and the function returns true.
|
|
With the method Save you can save a TSubstanceSet object from the data packages in the list. For more information look in the documentation of TLinkable.
Reimplemented in TSubstanceHold. |
|
Determine the size "offered" by negative-sized substances (positive-sized are ignored).
Reimplemented in TSubstanceHold. |
|
Determine the size taken by all positive-sized substances (acts like "how much stuff is stored").
Reimplemented in TSubstanceHold. |
|
TSubstanceSet output function, provides stream-compatible output for TSubstanceSet objects. It writes a human-readable string representation of the Set object to the stream.
|