ECG.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/CommonDataModel.h>
15 #include <biogears/exports.h>
16 
17 #include <biogears/cdm/system/equipment/ElectroCardioGram/SEElectroCardioGram.h>
18 #include <biogears/cdm/system/equipment/ElectroCardioGram/SEElectroCardioGramInterpolator.h>
19 #include <biogears/schema/biogears/BioGearsEnvironment.hxx>
20 #include <biogears/engine/Controller/BioGears.h>
21 #include <biogears/engine/Controller/BioGearsSystem.h>
22 
23 namespace biogears {
29 class BIOGEARS_API ECG : public SEElectroCardioGram, public BioGearsSystem {
30  friend class BioGears;
31  friend class BioGearsEngineTest;
32 
33 protected:
34  static auto make_unique(BioGears& bg) -> std::unique_ptr<ECG>;
35  ECG(BioGears& bg);
37 
38 public:
39  virtual ~ECG() override;
40 
41  static size_t TypeHash() { return reinterpret_cast<size_t>(&TypeHash); }
42  static constexpr char const * const TypeTag() { return "ECG"; }
43  const char* classname() const override { return TypeTag(); }
44  size_t hash_code() const override { return TypeHash(); }
45 
46  void Clear() override;
47 
48  // Set members to a stable homeostatic state
49  void Initialize() override;
50 
51  // Load a state
52  virtual bool Load(const CDM::BioGearsElectroCardioGramData& in);
53  virtual CDM::BioGearsElectroCardioGramData* Unload() const override;
54 
55 protected:
56  virtual void Unload(CDM::BioGearsElectroCardioGramData& data) const;
57 
58  // Set pointers and other member varialbes common to both homeostatic initialization and loading a state
59  void SetUp() override;
60 
61 public:
62  // main driver function responsible for calling the various ECG functions:
63  void PreProcess() override;
64  void Process() override;
65  void PostProcess() override;
66 
67 protected:
68  // Serializable member variables (Set in Initialize and in schema)
72 
73  // Stateless member variable (Set in SetUp())
74  double m_dt_s;
75 };
76 }
Definition: SEElectroCardioGramInterpolator.h:24
Generic ECG machine to assess the heart rhythm.
Definition: ECG.h:29
Definition: SEElectroCardioGram.h:21
const char * classname() const override
Definition: ECG.h:43
SEElectroCardioGramInterpolator m_interpolator
Definition: ECG.h:71
SEScalarTime m_heartRhythmPeriod
Definition: ECG.h:70
BioGears & m_data
Definition: ECG.h:36
static constexpr char const *const TypeTag()
Definition: ECG.h:42
Definition: SEScalarTime.h:37
size_t hash_code() const override
Definition: ECG.h:44
Definition: BioGearsEngineTest.h:24
static size_t TypeHash()
Definition: ECG.h:41
double m_dt_s
Definition: ECG.h:74
Manages and controls execution of all data/systems in BioGears.
Definition: BioGears.h:86
SEScalarTime m_heartRhythmTime
Definition: ECG.h:69
Generic class for handling the BioGears stabilization methodology.
Definition: BioGearsSystem.h:23
Definition: SEElectricalCircuit.h:18
Class corresponding to the BioGearsElectroCardioGramData schema type.
Definition: BioGearsEquipment.hxx:1091