Advanced Strategic Command
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Transferrable Class Referenceabstract

#include <servicing.h>

Inheritance diagram for Transferrable:
Inheritance graph
[legend]

Public Member Functions

 Transferrable (ResourceWatch &s, ResourceWatch &d)
 
virtual ASCString getName ()=0
 
virtual int getMax (ContainerBase *c, bool avail)=0
 get maximum amount for that unit. More...
 
virtual int getMin (ContainerBase *c, bool avail)=0
 
virtual int transfer (ContainerBase *target, int delta)=0
 
virtual int getAmount (const ContainerBase *target)=0
 
virtual void commit (const Context &context)=0
 
virtual bool isExchangable () const =0
 
virtual int getID ()=0
 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...
 
ContainerBasegetSrcContainer ()
 
ContainerBasegetDstContainer ()
 
bool setDestAmount (long amount)
 
void showAll ()
 
int setAmount (ContainerBase *target, int newamount)
 
void fill (ContainerBase *target)
 
void empty (ContainerBase *target)
 
virtual ~Transferrable ()
 

Public Attributes

sigc::signal< void, const
std::string & > 
sigSourceAmount
 
sigc::signal< void, const
std::string & > 
sigDestAmount
 

Protected Member Functions

ResourceWatchgetResourceWatch (const ContainerBase *unit)
 
ResourceWatchgetOpposingResourceWatch (const ContainerBase *unit)
 
ContainerBaseopposingContainer (const ContainerBase *unit)
 
void show (const ContainerBase *unit)
 

Protected Attributes

ResourceWatchsource
 
ResourceWatchdest
 

Detailed Description

Definition at line 48 of file servicing.h.

Constructor & Destructor Documentation

Transferrable::Transferrable ( ResourceWatch s,
ResourceWatch d 
)

Definition at line 169 of file servicing.cpp.

virtual Transferrable::~Transferrable ( )
inlinevirtual

Definition at line 89 of file servicing.h.

Member Function Documentation

virtual void Transferrable::commit ( const Context context)
pure virtual
void Transferrable::empty ( ContainerBase target)

Definition at line 204 of file servicing.cpp.

References setAmount().

void Transferrable::fill ( ContainerBase target)

Definition at line 198 of file servicing.cpp.

References getMax(), and setAmount().

virtual int Transferrable::getAmount ( const ContainerBase target)
pure virtual

Implemented in ResourceTransferrable, and AmmoTransferrable.

Referenced by setAmount(), and show().

ContainerBase * Transferrable::getDstContainer ( )

Definition at line 176 of file servicing.cpp.

References dest, and ResourceWatch::getContainer().

Referenced by setDestAmount().

virtual int Transferrable::getID ( )
pure 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

Implemented in ResourceTransferrable, and AmmoTransferrable.

virtual int Transferrable::getMax ( ContainerBase c,
bool  avail 
)
pure 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

Implemented in ResourceTransferrable, and AmmoTransferrable.

Referenced by fill().

virtual int Transferrable::getMin ( ContainerBase c,
bool  avail 
)
pure virtual
virtual ASCString Transferrable::getName ( )
pure virtual
ResourceWatch & Transferrable::getOpposingResourceWatch ( const ContainerBase unit)
protected
ResourceWatch & Transferrable::getResourceWatch ( const ContainerBase unit)
protected
ContainerBase * Transferrable::getSrcContainer ( )

Definition at line 171 of file servicing.cpp.

References ResourceWatch::getContainer(), and source.

virtual bool Transferrable::isExchangable ( ) const
pure virtual
ContainerBase * Transferrable::opposingContainer ( const ContainerBase unit)
protected
int Transferrable::setAmount ( ContainerBase target,
int  newamount 
)

Definition at line 192 of file servicing.cpp.

References getAmount(), and transfer().

Referenced by empty(), fill(), and setDestAmount().

bool Transferrable::setDestAmount ( long  amount)

Definition at line 181 of file servicing.cpp.

References getDstContainer(), and setAmount().

Referenced by TransferWidget::TransferWidget().

void Transferrable::show ( const ContainerBase unit)
protected
void Transferrable::showAll ( )

Definition at line 186 of file servicing.cpp.

References dest, ResourceWatch::getContainer(), show(), and source.

virtual int Transferrable::transfer ( ContainerBase target,
int  delta 
)
pure virtual

Implemented in ResourceTransferrable, and AmmoTransferrable.

Referenced by setAmount().

Member Data Documentation

ResourceWatch& Transferrable::dest
protected
sigc::signal<void,const std::string&> Transferrable::sigDestAmount

Definition at line 84 of file servicing.h.

Referenced by show(), and TransferWidget::TransferWidget().

sigc::signal<void,const std::string&> Transferrable::sigSourceAmount

Definition at line 83 of file servicing.h.

Referenced by show(), and TransferWidget::TransferWidget().

ResourceWatch& Transferrable::source
protected

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