VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
simResourceManager.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2024 MaK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
11 #include "vrfutil/vrfutilDefines.h"
14 
18 
19 class DT_DLL_vrfutil DtSimResourceManager : public DtRwTemplatedListPtr<DtSimResource, true>
20 {
21 
22 public:
23 
26 
29  parentRegistry = 0);
30 
32  parentRegistry = 0);
33 
36 
38  virtual ~DtSimResourceManager() override;
39 
41  virtual DtSimResource* addResource(const DtEntityType&, double amount, int bin = 0);
42  virtual DtSimResource* addResource(const DtSimResource&);
43 
45  virtual bool removeResource(const DtEntityType&, int bin = 0);
46 
47  virtual DtSimResource* lookupResource(const DtEntityType& resourceName, int bin = 0);
48  virtual const DtSimResource* lookupResource(const DtEntityType& resourceName, int bin = 0) const;
49 
51  virtual std::vector<DtSimResource*> lookupResources(const std::vector<DtEntityType>& types, int bin = 0);
52  virtual std::vector<const DtSimResource*> lookupResources(const std::vector<DtEntityType>& types, int bin = 0) const;
53 
57  virtual const char* readerWriterType() const override;
58 
60  virtual void clear();
61 
64  virtual void merge(const DtSimResourceManager&);
65  virtual void merge(const DtSimResourceList&);
66 
68  static const char* theXmlType();
69 
70  virtual const char* xmlType() const override
71  {
72  return theXmlType();
73  }
74 
76  virtual void restoreResources(int bin = 0);
77  virtual void restoreFrom(const DtSimResourceManager&);
78 
79  virtual std::list<DtEntityType> getResourceTypes(const std::vector<DtEntityType>& types, double greaterThanAmount = 0, int bin = 0) const;
80 
81  virtual DtRwTemplatedListPtr& operator=(const DtRwTemplatedListPtr& orig) override;
83  virtual bool operator==(const DtRwTemplatedListPtr& orig) const override;
85  bool operator==(const DtSimResourceManager&) const;
86 
87  virtual std::shared_ptr<DtSimResourceList> resources(int bin = 0);
88  virtual std::shared_ptr<const DtSimResourceList> resources(int bin = 0) const;
89 
90  virtual std::vector<DtSimResource*> allResources();
91  virtual std::vector<const DtSimResource*> allResources() const;
92 
94  virtual void setKeepOriginalRWNames(bool);
95  bool keepOriginalRWNames() const
96  {
97  return myKeepOriginalRWNames;
98  }
99 
101  virtual std::vector<int> bins() const;
102 
103 public:
104  virtual void preGetSelf() override;
105  virtual void postGetSelf() override;
106  virtual void prePutSelf() override;
107  virtual void postPutSelf() override;
108 
109 protected:
110  typedef std::map<int, std::shared_ptr<DtSimResourceList>> ResourceByBinMap;
112  bool myKeepOriginalRWNames = true;
113 };
virtual DtRwTemplatedListPtr & operator=(const DtRwTemplatedListPtr &orig)
virtual void prePutSelf()
Called before either version of put self (file or environment). Default is no-op. ...
This class allows one to collect and compare strings using an index number instead of having to do st...
Definition: symbolString.h:27
virtual void postGetSelf()
Called after either version of getSelf (mtl or environment). Default is no-op.
class DtSimResourceManager:
Definition: simResourceManager.h:19
static const char * theXmlType()
Definition: rwTemplatedList.h:109
Definition: readerWriterRegistry.h:39
ResourceByBinMap myResourceByBinMap
Definition: simResourceManager.h:111
virtual void preGetSelf()
Called before either version of get self (file or environment). Default is no-op. ...
class DtSimResourceList:
Definition: simResourceList.h:18
std::map< int, std::shared_ptr< DtSimResourceList > > ResourceByBinMap
Definition: simResourceManager.h:110
DtSimResource is a class which will define a SISO Enumeration to use as a resource and the quantity o...
Definition: simResource.h:32
Definition: rwTemplatedList.h:34
virtual bool operator==(const DtRwTemplatedListPtr &) const
Equivalence operators.
virtual const char * readerWriterType() const override
Used to supply a string type that this reader writer type is. This can be used in place of dynamic-ca...
#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
bool keepOriginalRWNames() const
Definition: simResourceManager.h:95
virtual const char * xmlType() const override
Routines to archive/dearchive from an XML Environment.
Definition: simResourceManager.h:70
virtual void postPutSelf()
Called after either version of put self (file or environment). Default is no-op.

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)