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

Contains the DtRealResource class declaration. More...

Inheritance diagram for DtRealResource:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtRealResource ()
 default constructor
 DtRealResource (const DtString &resourceName, DtReaderWriterRegistry *parentRegistry=0)
 real constructor
 DtRealResource (const DtRealResource &orig, DtReaderWriterRegistry *parentRegistry=0)
 copy constructor
virtual ~DtRealResource ()
 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 (DtReal amount)
 Amount is set to the amount specified, but will not go over full amount or less than 0.
virtual DtReal amount () const
virtual void deplete (DtReal amount)
 Amount is reduced by the amount specified, but will not go below 0.
virtual void replenish (DtReal amount)
 Amount is increased by the amount specified, but will not go above full amount.
virtual void setFullAmount (DtReal fullAmount)
virtual DtReal 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 DtReal constrainAmount (DtReal 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

DtRealResourceoperator= (const DtRealResource &orig)
 assignment operator; not implemented

Protected Attributes

DtRwReal myAmount
DtRwReal myFullAmount

Detailed Description

Contains the DtRealResource class declaration.

DtRealResource implements the required functions for a resource that can be measured by a real, continuous value (such as fuel).


Constructor & Destructor Documentation

default constructor

DtRealResource::DtRealResource ( const DtString resourceName,
DtReaderWriterRegistry parentRegistry = 0 
)

real constructor

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

DtRealResource::DtRealResource ( const DtRealResource orig,
DtReaderWriterRegistry parentRegistry = 0 
)

copy constructor

virtual DtRealResource::~DtRealResource ( ) [virtual]

destructor


Member Function Documentation

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

assignment operator; not implemented

virtual void DtRealResource::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* DtRealResource::clone ( DtReaderWriterRegistry parentRegistry = 0) const [virtual]

Make a copy of myself.

Implements DtSimResource.

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

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

Implements DtSimResource.

virtual void DtRealResource::distributeAmountToChildren ( ) [virtual]

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 DtRealResource::setAmount ( DtReal  amount) [virtual]

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

virtual DtReal DtRealResource::amount ( ) const [virtual]
virtual void DtRealResource::deplete ( DtReal  amount) [virtual]

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

virtual void DtRealResource::replenish ( DtReal  amount) [virtual]

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

virtual void DtRealResource::setFullAmount ( DtReal  fullAmount) [virtual]
virtual DtReal DtRealResource::fullAmount ( ) const [virtual]
virtual DtReal DtRealResource::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 DtRealResource::setPercentageFull ( DtReal  percent) [virtual]

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

Implements DtSimResource.

virtual DtReal DtRealResource::constrainAmount ( DtReal  amount) const [virtual]

If amount < 0, returns 0.

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

static DtSimResource* DtRealResource::creator ( ) [static]
virtual bool DtRealResource::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)