SEInhaler.h
1 /**************************************************************************************
2 Copyright 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/system/SESystem.h>
15 #include <biogears/schema/cdm/PatientActions.hxx>
16 #include <biogears/schema/biogears/BioGearsEquipment.hxx>
17 
18 namespace biogears {
19 class Serializer;
20 class SESubstance;
21 class SESubstanceManager;
22 class SEInhalerConfiguration;
23 class SEScalarVolume;
24 class VolumeUnit;
25 class SEScalarMass;
26 class MassUnit;
27 class SEScalarFraction;
28 
29 class BIOGEARS_API SEInhaler : public SESystem {
30 protected:
31 public:
32  SEInhaler(SESubstanceManager& substances);
33  ~SEInhaler() override;
34 
35  static size_t TypeHash() { return reinterpret_cast<size_t>(&TypeHash); }
36  static constexpr char const * const TypeTag() { return "SEInhaler"; }
37  const char* classname() const override { return TypeTag(); }
38  size_t hash_code() const override { return TypeHash(); }
39 
40  void Clear() override;
41 
50  const SEScalar* GetScalar(const char* name) override;
51  const SEScalar* GetScalar(const std::string& name) override;
52 
53  bool Load(const CDM::InhalerData& in);
54  CDM::InhalerData* Unload() const override;
55  Tree<const char*> GetPhysiologyRequestGraph() const override;
56 protected:
57  void Unload(CDM::InhalerData& data) const;
58 
64  virtual void StateChange() {} //TODO: Refactor the need for this definiiton;
65  void Merge(const SEInhaler& from);
66  void ProcessConfiguration(const SEInhalerConfiguration& config);
67 
68 public:
69  bool Load(const std::string& file);
70 
71  CDM::enumOnOff::value GetState() const;
72  void SetState(CDM::enumOnOff::value name);
73  bool HasState() const;
74  void InvalidateState();
75 
76  bool HasMeteredDose() const;
77  SEScalarMass& GetMeteredDose();
78  double GetMeteredDose(const MassUnit& unit) const;
79 
80  bool HasNozzleLoss() const;
81  SEScalarFraction& GetNozzleLoss();
82  double GetNozzleLoss() const;
83 
84  bool HasSpacerVolume() const;
85  SEScalarVolume& GetSpacerVolume();
86  double GetSpacerVolume(const VolumeUnit& unit) const;
87 
88  bool HasSubstance() const;
89  void SetSubstance(const SESubstance* sub);
90  SESubstance* GetSubstance() const;
91 
92 protected:
93  std::stringstream m_ss;
94 
100 
102 };
103 }
const SESubstance * m_Substance
Definition: SEInhaler.h:99
const char * classname() const override
Definition: SEInhaler.h:37
Definition: SEScalar.h:33
Definition: SEInhalerConfiguration.h:21
Definition: SESystem.h:27
Definition: SEScalarMass.h:38
CDM::enumOnOff::value m_State
Definition: SEInhaler.h:95
static constexpr char const *const TypeTag()
Definition: SEInhaler.h:36
Definition: SEScalarFraction.h:18
std::stringstream m_ss
Definition: SEInhaler.h:93
SEScalarMass * m_MeteredDose
Definition: SEInhaler.h:96
SESubstanceManager & m_Substances
Definition: SEInhaler.h:101
Definition: SEScalarVolume.h:18
Definition: SEScalarVolume.h:37
Definition: SESubstance.h:49
SEScalarVolume * m_SpacerVolume
Definition: SEInhaler.h:98
static size_t TypeHash()
Definition: SEInhaler.h:35
Class corresponding to the InhalerData schema type.
Definition: Inhaler.hxx:684
Definition: SEInhaler.h:29
value
Underlying enum type.
Definition: Properties.hxx:2070
virtual void StateChange()
Definition: SEInhaler.h:64
Definition: SESubstanceManager.h:23
Definition: SEScalarMass.h:18
Definition: SEElectricalCircuit.h:18
SEScalarFraction * m_NozzleLoss
Definition: SEInhaler.h:97
size_t hash_code() const override
Definition: SEInhaler.h:38