Inhaler.h
1 /**************************************************************************************
2 C:opyright 2015 Applied Research Associates, Inc.
3 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 this file except in compliance with the License. You may obtain a copy of the License
5 at:
6 http://www.apache.org/licenses/LICENSE-2.0
7 Unless required by applicable law or agreed to in writing, software distributed under
8 the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
9 CONDITIONS OF ANY KIND, either express or implied. See the License for the
10 specific language governing permissions and limitations under the License.
11 **************************************************************************************/
12 
13 #pragma once
14 #include <biogears/cdm/CommonDataModel.h>
15 #include <biogears/exports.h>
16 
17 #include <biogears/cdm/system/equipment/Inhaler/SEInhaler.h>
18 #include <biogears/engine/Controller/BioGearsSystem.h>
19 #include <biogears/schema/biogears/BioGearsEquipment.hxx>
20 
21 namespace biogears {
27 class SEGasCompartment;
28 class SELiquidCompartment;
29 class SEGasCompartment;
30 class SELiquidSubstanceQuantity;
31 class BioGears;
32 
33 class BIOGEARS_API Inhaler : public SEInhaler, public BioGearsSystem {
34  friend class BioGears;
35  friend class BioGearsEngineTest;
36 
37 protected:
38  static auto make_unique(BioGears& bg) -> std::unique_ptr<Inhaler>;
39  Inhaler(BioGears& bg);
41 
42 public:
43  virtual ~Inhaler() override;
44 
45  static size_t TypeHash() { return reinterpret_cast<size_t>(&TypeHash); }
46  static constexpr char const * const TypeTag() { return "Inhaler"; }
47  const char* classname() const override { return TypeTag(); }
48  size_t hash_code() const override { return TypeHash(); }
49 
50  void Clear() override;
51 
52  // Set members to a stable homeostatic state
53  void Initialize() override;
54 
55  // Load a state
56  bool Load(const CDM::BioGearsInhalerData& in);
57  CDM::BioGearsInhalerData* Unload() const override;
58 
59 protected:
60  void Unload(CDM::BioGearsInhalerData& data) const;
61 
62  // Set pointers and other member varialbes common to both homeostatic initialization and loading a state
63  void SetUp() override;
64 
65 public:
66  // main driver function responsible for calling the various ECG functions:
67  void PreProcess() override;
68  void Process() override;
69  void PostProcess() override;
70 
71 protected:
72  void StateChange() override;
73  void Administer();
74 
75  // Serializable member variables (Set in Initialize and in schema)
76 
77  // Stateless member variable (Set in SetUp())
78  double m_dt_s;
83 };
84 }
BioGears & m_data
Definition: Inhaler.h:40
size_t hash_code() const override
Definition: Inhaler.h:48
static constexpr char const *const TypeTag()
Definition: Inhaler.h:46
Definition: SELiquidSubstanceQuantity.h:28
Class corresponding to the BioGearsInhalerData schema type.
Definition: BioGearsEquipment.hxx:1383
SELiquidSubstanceQuantity * m_InhalerDrug
Definition: Inhaler.h:82
Definition: SELiquidCompartment.h:27
Definition: BioGearsEngineTest.h:24
static size_t TypeHash()
Definition: Inhaler.h:45
SEGasCompartment * m_Mouthpiece
Definition: Inhaler.h:79
SEGasCompartment * m_AmbientEnv
Definition: Inhaler.h:81
SELiquidCompartment * m_AerosolMouthpiece
Definition: Inhaler.h:80
const char * classname() const override
Definition: Inhaler.h:47
Manages and controls execution of all data/systems in BioGears.
Definition: BioGears.h:86
Definition: SEInhaler.h:29
double m_dt_s
Definition: Inhaler.h:78
Definition: Inhaler.h:33
Generic class for handling the BioGears stabilization methodology.
Definition: BioGearsSystem.h:23
Definition: SEElectricalCircuit.h:18
Definition: SEGasCompartment.h:24