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

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.