VR-Forces 4.0.4 Class Documentation
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
DtIntegerResource Class Reference

Contains the DtIntegerResource class declaration. More...

Inheritance diagram for DtIntegerResource:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtIntegerResource ()
 Default constructor; used by resource factory.
 DtIntegerResource (const DtString &resourceName, DtReaderWriterRegistry *parentRegistry=NULL)
 constructor
 DtIntegerResource (const DtIntegerResource &orig, DtReaderWriterRegistry *parentRegistry=0)
 copy constructor
virtual ~DtIntegerResource ()
 destructor
virtual void updateAmountFromChildren ()
 This is called when a child's value changes (or a new child is added).
virtual void updateFullAmountFromChildren ()
 When the deriving class's setFullAmount is called, this should be called on the resources parent.
virtual DtSimResourceclone (DtReaderWriterRegistry *parentRegistry=0) const
 Make a copy of myself.
virtual DtString type () const
 The data type of the resource. These types are defined in rsrcTypes.h.
virtual void distributeAmountToChildren ()
 This is called when my amount changes (via setAmount()).
virtual void distributeFullAmountToChildren ()
 When the deriving class's setFullAmount is called, this should be called if the resource has any children.
virtual void setAmount (int amount)
 Amount is set to the amount specified, but will not go over full amount or less than 0.
virtual int amount () const
virtual void deplete (int amount=1)
 Amount is reduced by the amount specified, but will not go below 0.
virtual void replenish (int amount=1)
 Amount is increased by the amount specified, but will not go above full amount.
virtual void setFullAmount (int fullAmount)
virtual int fullAmount () const
virtual DtReal percentageFull () const
 The deriving class will also provide a function to specify the quantity (of the appropriate type) that indicates a full/complete load of the resource.
virtual void setPercentageFull (DtReal percent)
 Percent will be truncated to be between 0. and 1.
virtual int constrainAmount (int amount) const
 If amount < 0, returns 0.
virtual bool isEqual (const DtSimResource &res) const
 Returns true if myAmount and myFullAmount are the same as the resource coming in.

Static Public Member Functions

static DtSimResourcecreator ()

Protected Member Functions

DtIntegerResourceoperator= (const DtIntegerResource &orig)
 assignment operator; not implemented

Protected Attributes

DtRwInt myAmount
DtRwInt myFullAmount

Detailed Description

Contains the DtIntegerResource class declaration.

DtIntegerResource implements the required functions for a resource that can be measured by an integer value (such as main gun rounds, bandages, fan belts, and so on).


Constructor & Destructor Documentation

Default constructor; used by resource factory.

DtIntegerResource::DtIntegerResource ( const DtString resourceName,
DtReaderWriterRegistry parentRegistry = NULL 
)

constructor

The resource name is the name that will be used to look up the resource in the resource manager.

copy constructor

destructor


Member Function Documentation

DtIntegerResource& DtIntegerResource::operator= ( const DtIntegerResource orig) [protected]

assignment operator; not implemented

virtual void DtIntegerResource::updateAmountFromChildren ( ) [virtual]

This is called when a child's value changes (or a new child is added).

Implements DtSimResource.

When the deriving class's setFullAmount is called, this should be called on the resources parent.

Implements DtSimResource.

virtual DtSimResource* DtIntegerResource::clone ( DtReaderWriterRegistry parentRegistry = 0) const [virtual]

Make a copy of myself.

Implements DtSimResource.

Reimplemented in DtMunitionResource.

virtual DtString DtIntegerResource::type ( ) const [virtual]

The data type of the resource. These types are defined in rsrcTypes.h.

Implements DtSimResource.

Reimplemented in DtMunitionResource.

This is called when my amount changes (via setAmount()).

Implements DtSimResource.

When the deriving class's setFullAmount is called, this should be called if the resource has any children.

Implements DtSimResource.

virtual void DtIntegerResource::setAmount ( int  amount) [virtual]

Amount is set to the amount specified, but will not go over full amount or less than 0.

virtual int DtIntegerResource::amount ( ) const [virtual]
virtual void DtIntegerResource::deplete ( int  amount = 1) [virtual]

Amount is reduced by the amount specified, but will not go below 0.

virtual void DtIntegerResource::replenish ( int  amount = 1) [virtual]

Amount is increased by the amount specified, but will not go above full amount.

virtual void DtIntegerResource::setFullAmount ( int  fullAmount) [virtual]
virtual int DtIntegerResource::fullAmount ( ) const [virtual]
virtual DtReal DtIntegerResource::percentageFull ( ) const [virtual]

The deriving class will also provide a function to specify the quantity (of the appropriate type) that indicates a full/complete load of the resource.

PercentageFull will return 0. to 1., amount / fullAmount Note: 1. is returned if full amount is <= 0.

Implements DtSimResource.

virtual void DtIntegerResource::setPercentageFull ( DtReal  percent) [virtual]

Percent will be truncated to be between 0. and 1.

Implements DtSimResource.

virtual int DtIntegerResource::constrainAmount ( int  amount) const [virtual]

If amount < 0, returns 0.

Else if amount > fullAmount, returns fullAmount. Else, returns amount.

Reimplemented in DtMunitionResource.

virtual bool DtIntegerResource::isEqual ( const DtSimResource res) const [virtual]

Returns true if myAmount and myFullAmount are the same as the resource coming in.

Reimplemented from DtSimResource.


Member Data Documentation


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

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)