Advanced Strategic Command
Public Member Functions | List of all members
ResourceTransferrable Class Reference
Inheritance diagram for ResourceTransferrable:
Inheritance graph
[legend]

Public Member Functions

 ResourceTransferrable (int resource, ResourceWatch &src, ResourceWatch &dst, bool isExchangable=true)
 
ASCString getName ()
 
int getID ()
 the id is used to identify the transferrable when serializng to disk. In each service operation, the id must be unique through all transferrables More...
 
int getMax (ContainerBase *c, bool avail)
 get maximum amount for that unit. More...
 
int getMin (ContainerBase *c, bool avail)
 
int getAmount (const ContainerBase *target)
 
int getAvail (const ContainerBase *target)
 
int transfer (ContainerBase *target, int delta)
 
bool isExchangable () const
 
void commit (const Context &context)
 
- Public Member Functions inherited from Transferrable
 Transferrable (ResourceWatch &s, ResourceWatch &d)
 
ContainerBasegetSrcContainer ()
 
ContainerBasegetDstContainer ()
 
bool setDestAmount (long amount)
 
void showAll ()
 
int setAmount (ContainerBase *target, int newamount)
 
void fill (ContainerBase *target)
 
void empty (ContainerBase *target)
 
virtual ~Transferrable ()
 

Additional Inherited Members

- Public Attributes inherited from Transferrable
sigc::signal< void, const
std::string & > 
sigSourceAmount
 
sigc::signal< void, const
std::string & > 
sigDestAmount
 
- Protected Member Functions inherited from Transferrable
ResourceWatchgetResourceWatch (const ContainerBase *unit)
 
ResourceWatchgetOpposingResourceWatch (const ContainerBase *unit)
 
ContainerBaseopposingContainer (const ContainerBase *unit)
 
void show (const ContainerBase *unit)
 
- Protected Attributes inherited from Transferrable
ResourceWatchsource
 
ResourceWatchdest
 

Detailed Description

Definition at line 239 of file servicing.cpp.

Constructor & Destructor Documentation

ResourceTransferrable::ResourceTransferrable ( int  resource,
ResourceWatch src,
ResourceWatch dst,
bool  isExchangable = true 
)

Member Function Documentation

void ResourceTransferrable::commit ( const Context context)
virtual
int ResourceTransferrable::getAmount ( const ContainerBase target)
virtual

Implements Transferrable.

Definition at line 348 of file servicing.cpp.

References ResourceWatch::amount(), Transferrable::getResourceWatch(), and Resources::resource().

Referenced by commit().

int ResourceTransferrable::getAvail ( const ContainerBase target)
int ResourceTransferrable::getID ( )
virtual

the id is used to identify the transferrable when serializng to disk. In each service operation, the id must be unique through all transferrables

Implements Transferrable.

Definition at line 320 of file servicing.cpp.

int ResourceTransferrable::getMax ( ContainerBase c,
bool  avail 
)
virtual

get maximum amount for that unit.

Parameters
cthe container for which the maximum amount is calculated
availIf true, the amount is limited by the resources which can actually provided by the other unit. If false, return the storage capacity

Implements Transferrable.

Definition at line 325 of file servicing.cpp.

References getAvail(), Transferrable::getOpposingResourceWatch(), Transferrable::getResourceWatch(), ResourceWatch::limit(), min(), and Resources::resource().

int ResourceTransferrable::getMin ( ContainerBase c,
bool  avail 
)
virtual
ASCString ResourceTransferrable::getName ( )
virtual

Implements Transferrable.

Definition at line 315 of file servicing.cpp.

References Resources::name().

bool ResourceTransferrable::isExchangable ( ) const
virtual

Implements Transferrable.

Definition at line 371 of file servicing.cpp.

int ResourceTransferrable::transfer ( ContainerBase target,
int  delta 
)
virtual

The documentation for this class was generated from the following file: