Pulse adds COVID-19 Simulation Support
×
SESubstanceManager.h
1 /* Distributed under the Apache License, Version 2.0.
2  See accompanying NOTICE file for details.*/
3 
4 #pragma once
5 class SESubstance;
7 
8 class CDM_DECL SESubstanceManager : public Loggable
9 {
10 public:
11  SESubstanceManager(Logger* logger);
12  virtual ~SESubstanceManager();
13 
14  // Will clear (see below) and refresh all substance to their original content
15  // *NOTE* If you have added custom substances (not on disk)
16  // They will still be in the sub mgr, but all properties will be invalid
17  // It is your responsibility to reset them to their original values
18  virtual bool LoadSubstanceDirectory(const std::string& data_dir="./");
19 
20  virtual const std::vector<SESubstance*>& GetSubstances();
21  virtual const std::vector<const SESubstance*>& GetSubstances() const;
22  virtual bool HasSubstance(const std::string& name) const;
23  virtual SESubstance* GetSubstance(const std::string& name);
24  virtual const SESubstance* GetSubstance(const std::string& name) const;
25 
26  virtual bool IsActive(const SESubstance& substance) const;
27  virtual const std::vector<SESubstance*>& GetActiveSubstances();
28  virtual const std::vector<const SESubstance*>& GetActiveSubstances() const;
29  virtual void AddActiveSubstance(const SESubstance& substance);
30  virtual void RemoveActiveSubstance(const SESubstance& substance);
31  virtual void RemoveActiveSubstances(const std::vector<SESubstance*>& substances);
32  virtual void RemoveActiveSubstances();
33 
34  virtual const std::vector<SESubstance*>& GetActiveGases();
35  virtual const std::vector<const SESubstance*>& GetActiveGases() const;
36  virtual const std::vector<SESubstance*>& GetActiveLiquids();
37  virtual const std::vector<const SESubstance*>& GetActiveLiquids() const;
38 
39  virtual const std::vector<SESubstanceCompound*>& GetCompounds();
40  virtual const std::vector<const SESubstanceCompound*>& GetCompounds() const;
41  virtual bool HasCompound(const std::string& name) const;
42  virtual SESubstanceCompound* GetCompound(const std::string& name);
43  virtual const SESubstanceCompound* GetCompound(const std::string& name) const;
44 
45  virtual bool IsActive(const SESubstanceCompound& compound) const;
46  virtual const std::vector<SESubstanceCompound*>& GetActiveCompounds();
47  virtual const std::vector<const SESubstanceCompound*>& GetActiveCompounds() const;
48  virtual void AddActiveCompound(const SESubstanceCompound& compound);
49  virtual void RemoveActiveCompound(const SESubstanceCompound& compound);
50  virtual void RemoveActiveCompounds(const std::vector<SESubstanceCompound*>& compounds);
51 
52 protected:
53  // The sub mgr is designed to keep the pointers of all subs (and their components)
54  // at the same address as when they were first allocated.
55  // This clear preserves all addresses.
56  // This clear method will just invalidate all properties of all substances.
57  // Substances will keep their name and have "no properties"
58  // All substance component (ex. clearance) properties will also be invalidated.
59  //
60  // It is your responsibility to set the substance properties back to something
61  // (i.e. Just use LoadSubstanceDirectory)
62  virtual void Clear();
63 
64  // I am making all these vectors of SESubstances,
65  // Usually these are passed to methods that take a
66  // vector of substances, and a vector of drugs won't be accepted
67  // I could do some crazy template methods that will auto convert
68  // these to substance vectors, but I think that would be too
69  // slow for the amount of times we call stuff
70  // So for now, these will just be substance vectors
71  // If we want drug vectors, I can rename methods to
72  // std::vector<SESubstance*>* GetActiveDrugSubstances
73  // std::vector<SEDrug*>* GetActiveDrugs()
74  // But I don't see a need for that yet...
75  // So will just leave it as it now
76 
77  std::vector<SESubstance*> m_Substances;
78  std::vector<const SESubstance*> m_cSubstances;
79  std::vector<SESubstance*> m_ActiveSubstances;
80  std::vector<const SESubstance*> m_cActiveSubstances;
81  std::vector<SESubstance*> m_ActiveGases;
82  std::vector<const SESubstance*> m_cActiveGases;
83  std::vector<SESubstance*> m_ActiveLiquids;
84  std::vector<const SESubstance*> m_cActiveLiquids;
85 
86  std::vector<SESubstanceCompound*> m_Compounds;
87  std::vector<const SESubstanceCompound*> m_cCompounds;
88  std::vector<SESubstanceCompound*> m_ActiveCompounds;
89  std::vector<const SESubstanceCompound*> m_cActiveCompounds;
90 };
std::vector< SESubstanceCompound * > m_Compounds
Definition: SESubstanceManager.h:86
Definition: SESubstanceManager.h:8
std::vector< SESubstance * > m_ActiveSubstances
Definition: SESubstanceManager.h:79
Definition: Logger.h:75
std::vector< const SESubstance * > m_cActiveLiquids
Definition: SESubstanceManager.h:84
std::vector< const SESubstance * > m_cActiveGases
Definition: SESubstanceManager.h:82
std::vector< SESubstance * > m_ActiveLiquids
Definition: SESubstanceManager.h:83
Definition: Logger.h:21
std::vector< const SESubstance * > m_cActiveSubstances
Definition: SESubstanceManager.h:80
std::vector< const SESubstance * > m_cSubstances
Definition: SESubstanceManager.h:78
Definition: SESubstanceCompound.h:9
std::vector< SESubstanceCompound * > m_ActiveCompounds
Definition: SESubstanceManager.h:88
std::vector< const SESubstanceCompound * > m_cActiveCompounds
Definition: SESubstanceManager.h:89
std::vector< const SESubstanceCompound * > m_cCompounds
Definition: SESubstanceManager.h:87
std::vector< SESubstance * > m_ActiveGases
Definition: SESubstanceManager.h:81
Definition: SESubstance.h:14
std::vector< SESubstance * > m_Substances
Definition: SESubstanceManager.h:77

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.