VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
integerResource.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2018 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
8 #include <vlutil/vlMachineTypes.h>
9 #include <readerWriter/rwInt.h>
10 #include "vrfutil/simResource.h"
11 
16 #include "vrfutil/vrfutilDefines.h"
18 {
19 
20 public:
21 
24 
30  parentRegistry = NULL);
31 
34  parentRegistry = 0);
35 
38 
39 public:
41  virtual ~DtIntegerResource();
42 
44  virtual void updateAmountFromChildren();
45 
48  virtual void updateFullAmountFromChildren();
49 
51  virtual DtSimResource * clone(DtReaderWriterRegistry* parentRegistry = 0)
52  const;
53 
55  virtual DtString type() const;
56 
58  virtual void distributeAmountToChildren();
59 
62  virtual void distributeFullAmountToChildren();
63 
66  virtual void setAmount(int amount);
67  virtual int amount() const;
68 
70  virtual void deplete(int amount = 1);
71 
74  virtual void replenish(int amount = 1);
75 
76  virtual void setFullAmount(int fullAmount);
77  virtual int fullAmount() const;
78 
79  virtual DtReal percentageFull() const;
80  virtual void setPercentageFull(DtReal percent);
81 
84  virtual int constrainAmount(int amount) const;
85 
86  static DtSimResource* creator();
87 
90  virtual bool isEqual(const DtSimResource& res) const;
91 
94  virtual void merge(const DtSimResource*);
95 
96 protected:
97 
100 
101 };
virtual void setPercentageFull(DtReal percent)=0
Percent will be truncated to be between 0. and 1.
virtual DtReal percentageFull() const =0
The deriving class will also provide a function to specify the quantity (of the appropriate type) tha...
virtual DtString type() const =0
The data type of the resource. These types are defined in rsrcTypes.h.
virtual void merge(const DtSimResource *)
DtRwInt myAmount
Definition: integerResource.h:98
Definition: readerWriterRegistry.h:39
virtual void updateFullAmountFromChildren()=0
When the deriving class&#39;s setFullAmount is called, this should be called on the resources parent...
DtSimResource & operator=(const DtSimResource &orig)
assignment operator
virtual void distributeFullAmountToChildren()=0
When the deriving class&#39;s setFullAmount is called, this should be called if the resource has any chil...
virtual void distributeAmountToChildren()=0
When the deriving class&#39;s setAmount is called, this should be called if the resource has any children...
Description: Readable, Writable int.
Definition: rwInt.h:25
DtIntegerResource implements the required functions for a resource that can be measured by an integer...
Definition: integerResource.h:17
virtual bool isEqual(const DtSimResource &res) const
virtual DtSimResource * clone(DtReaderWriterRegistry *parentRegistry=0) const =0
DtSimResource is an abstract base class that can be used to create a hierarchical resource list of a ...
Definition: simResource.h:42
virtual void updateAmountFromChildren()=0
When the deriving class&#39;s setAmount is called, this should be called on the resources parent...
#define DT_DLL_vrfutil
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfutilDefines.h:34
DtRwInt myFullAmount
Definition: integerResource.h:99

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)