ResourceTransferrable Class Reference

Inheritance diagram for ResourceTransferrable:

Inheritance graph
[legend]
List of all members.

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
int getMax (ContainerBase *c, bool avail)
 get maximum amount for that unit.
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)

Detailed Description

Definition at line 239 of file servicing.cpp.


Constructor & Destructor Documentation

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

Definition at line 308 of file servicing.cpp.

References Transferrable::dest, ResourceWatch::sigChanged, and Transferrable::source.


Member Function Documentation

ASCString ResourceTransferrable::getName (  )  [virtual]

Implements Transferrable.

Definition at line 315 of file servicing.cpp.

References Resources::name().

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:
c the container for which the maximum amount is calculated
avail If 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]

Implements Transferrable.

Definition at line 336 of file servicing.cpp.

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

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  ) 

Definition at line 353 of file servicing.cpp.

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

Referenced by getMax(), getMin(), and transfer().

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

Implements Transferrable.

Definition at line 358 of file servicing.cpp.

References getAvail(), Transferrable::getOpposingResourceWatch(), ResourceWatch::getResource(), Transferrable::getResourceWatch(), min(), Transferrable::opposingContainer(), and ResourceWatch::putResource().

bool ResourceTransferrable::isExchangable (  )  const [virtual]

Implements Transferrable.

Definition at line 371 of file servicing.cpp.

void ResourceTransferrable::commit ( const Context context  )  [virtual]

Implements Transferrable.

Definition at line 376 of file servicing.cpp.

References Transferrable::dest, getAmount(), ResourceWatch::getContainer(), ContainerBase::getResource(), maxint, and Transferrable::source.


The documentation for this class was generated from the following file:
Generated on Mon May 21 01:47:24 2012 for Advanced Strategic Command by  doxygen 1.5.1