#include <substance.h>
Inheritance diagram for TSubstanceType:
Public Methods | |
TSubstanceType (const string &name, const string &abbrev, const uint2 cclass, const int2 usize, const int2 umass, const bool update=false) | |
virtual | ~TSubstanceType (void) |
const string & | Name (void) const |
const string & | Abbrev (void) const |
const uint2 | Id (void) const |
const uint2 | CargoClass (void) const |
const int2 | UnitSize (void) const |
const int2 | UnitMass (void) const |
const bool | Updatable (void) const |
virtual TSubstance * | Create (const TOSVal &iAmount=1) |
virtual TOSVal | Update (TSubstance *substance, const TOSVal &available_space) |
virtual bool | load (TDataPackageList *in) |
virtual bool | save (TDataPackageList *out) const |
Static Public Methods | |
const uint4 | NumberSubstances (void) |
const uint2 | NumberCargoClasses (void) |
TSubstanceType * | FindById (const SubstanceId Id) |
TSubstanceType * | FindByName (const string &Name) |
Private Methods | |
TSubstanceType (const TSubstanceType &) | |
TSubstanceType & | operator= (const TSubstanceType &) |
Private Attributes | |
string | fName |
string | fAbbrev |
SubstanceId | fId |
uint2 | fCargoClass |
int2 | fUnitSize |
int2 | fUnitMass |
bool | fUpdatable |
Static Private Attributes | |
vector< TSubstanceType *> | fSubstanceTable |
uint2 | fCargoClasses |
Substance type class. Instances of this class represent substances with the same set of properties. Every substance type is automatically assigned an id which can be used in place of the name for faster operation. Substance parameters such as size, mass, etc. are stored here. The class can be used as a base class for the introduction of types which require more parameters than the one currently available.
Please check TSubstance for an overview of the substance classes.
|
The TSubstanceType constructor is used to define a new type of substance to be used. All properties must be specified at creation and are *constant*.
|
|
Destructor, virtual to allow derivation. |
|
Read-accessor to Substance abbreviated name.
|
|
Read-accessor to Substance cargo class.
|
|
Substance creator. This function is used to create a specified amount of the substance. It replaces the TSubstance class constructor.
|
|
Class-wide member to obtain a pointer to the SubstanceType corresponding to a specified ID number.
|
|
Class-wide member to obtain a pointer to the SubstanceType corresponding to a specified substance name.
|
|
Read-accessor to Substance ID number.
|
|
The method Load loads a TSubstanceType object from the data packages in the list. For more information look in the documentation of the ancestors of TSubstanceType from where this method is inherited.
Reimplemented from TLinkable. |
|
Read-accessor to Substance name.
|
|
Class-wide member to return the total number of different cargo classes defined.
|
|
Class-wide member to return the total number of Substances currently defined.
|
|
The method Save saves a TSubstanceType by adding the data packages to the list. For more information look in the documentation of the ancestors of TSubstanceType, because the method Save is inherited from there.
Reimplemented from TLinkable. |
|
Read-accessor to Substance mass / unit.
|
|
Read-accessor to Substance size / unit.
|
|
Determine if the Substance Type requires updates of substance objects.
|
|
Default update method for the substance. If a group of substance types share the same time-evolution properties then one can put the update function here and have all the objects call this function for update (default behaviour). If the update depends on some weird, substance object-dependent value then one should consider deriving from TSubstance and replacing the Update function down there.
|