SEDataRequestManager.h
1 /* Distributed under the Apache License, Version 2.0.
2  See accompanying NOTICE file for details.*/
3 
4 #pragma once
5 #include "engine/SEDataRequest.h"
6 class SESubstance;
8 
9 class CDM_DECL SEDataRequestManager : public Loggable
10 {
11  friend class PBEngine;//friend the serialization class
12 public:
15 
16  void Clear();
17  void Copy(const SEDataRequestManager& src, const SESubstanceManager& subMgr);
18 
19  bool SerializeToString(std::string& output, SerializationFormat m) const;
20  bool SerializeToFile(const std::string& filename, SerializationFormat m) const;
21  bool SerializeFromString(const std::string& src, SerializationFormat m, const SESubstanceManager& subMgr);
22  bool SerializeFromFile(const std::string& filename, SerializationFormat m, const SESubstanceManager& subMgr);
23 
24  bool HasResultsFilename() const { return !m_ResultsFilename.empty(); }
25  std::string GetResultFilename() const { return m_ResultsFilename; }
26  void SetResultsFilename(const std::string& name) { m_ResultsFilename = name; }
27 
28  double GetSamplesPerSecond() const { return m_SamplesPerSecond; }
29  void SetSamplesPerSecond(double num) { m_SamplesPerSecond = num; }
30 
31  bool HasDataRequests() const { return !m_Requests.empty(); }
32  const std::vector<SEDataRequest*>& GetDataRequests() const { return m_Requests; }
33 
34  virtual bool HasDefaultDecimalFormatting() const;
35  virtual SEDecimalFormat& GetDefaultDecimalFormatting();
36  virtual void RemoveDefaultDecimalFormatting();
37 
38  virtual bool HasOverrideDecimalFormatting() const;
39  virtual SEDecimalFormat& GetOverrideDecimalFormatting();
40  virtual void RemoveOverrideDecimalFormatting();
41 
42  SEDataRequest& CopyDataRequest(const SEDataRequest& dr);
43 
44  SEDataRequest& CreateDataRequest(eDataRequest_Category category, const SEDecimalFormat* dfault = nullptr);
45  SEDataRequest& CreatePatientDataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
46  SEDataRequest& CreatePatientDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
47 
48  SEDataRequest& CreatePhysiologyDataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
49  SEDataRequest& CreatePhysiologyDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
50 
51  SEDataRequest& CreateEnvironmentDataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
52  SEDataRequest& CreateEnvironmentDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
53 
54  SEDataRequest& CreateGasCompartmentDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault = nullptr);
55  SEDataRequest& CreateGasCompartmentDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
56  SEDataRequest& CreateGasCompartmentDataRequest(const std::string& cmptName, const SESubstance& sub, const std::string& property, const SEDecimalFormat* dfault = nullptr);
57  SEDataRequest& CreateGasCompartmentDataRequest(const std::string& cmptName, const SESubstance& sub, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
58 
59  SEDataRequest& CreateLiquidCompartmentDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault = nullptr);
60  SEDataRequest& CreateLiquidCompartmentDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
61  SEDataRequest& CreateLiquidCompartmentDataRequest(const std::string& cmptName, const SESubstance& sub, const std::string& property, const SEDecimalFormat* dfault = nullptr);
62  SEDataRequest& CreateLiquidCompartmentDataRequest(const std::string& cmptName, const SESubstance& sub, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
63 
64  SEDataRequest& CreateThermalCompartmentDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault = nullptr);
65  SEDataRequest& CreateThermalCompartmentDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
66 
67  SEDataRequest& CreateTissueCompartmentDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault = nullptr);
68  SEDataRequest& CreateTissueCompartmentDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
69 
70  SEDataRequest& CreateSubstanceDataRequest(const SESubstance& sub, const std::string& property, const SEDecimalFormat* dfault = nullptr);
71  SEDataRequest& CreateSubstanceDataRequest(const SESubstance& sub, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
72 
73  SEDataRequest& CreateAnesthesiaMachineDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault = nullptr);
74  SEDataRequest& CreateAnesthesiaMachineDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
75 
76  SEDataRequest& CreateECGDataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
77  SEDataRequest& CreateECGDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
78 
79  SEDataRequest& CreateInhalerDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault = nullptr);
80  SEDataRequest& CreateInhalerDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
81 
82 protected:
83  // Methods to find data requests so we don't keep making the same one
84  SEDataRequest* FindPatientDataRequest(const std::string& property);
85  SEDataRequest* FindPhysiologyDataRequest(const std::string& property);
86  SEDataRequest* FindEnvironmentDataRequest(const std::string& property);
87  SEDataRequest* FindGasCompartmentDataRequest(const std::string& cmptName, const std::string& property);
88  SEDataRequest* FindGasCompartmentDataRequest(const std::string& cmptName, const SESubstance& sub, const std::string property);
89  SEDataRequest* FindLiquidCompartmentDataRequest(const std::string& cmptName, const std::string& property);
90  SEDataRequest* FindLiquidCompartmentDataRequest(const std::string& cmptName, const SESubstance& sub, const std::string property);
91  SEDataRequest* FindThermalCompartmentDataRequest(const std::string& cmptName, const std::string& property);
92  SEDataRequest* FindTissueCompartmentDataRequest(const std::string& cmptName, const std::string& property);
93  SEDataRequest* FindSubstanceDataRequest(const SESubstance& sub, const std::string& property);
94  SEDataRequest* FindAnesthesiaMachineDataRequest(const std::string& cmptName, const std::string& property);
95  SEDataRequest* FindECGDataRequest(const std::string& property);
96  SEDataRequest* FindInhalerDataRequest(const std::string& cmptName, const std::string& property);
97 
98  std::string m_ResultsFilename;
100  std::vector<SEDataRequest*> m_Requests;
101 
104 };
Definition: SESubstanceManager.h:8
std::string m_ResultsFilename
Definition: SEDataRequestManager.h:98
std::string GetResultFilename() const
Definition: SEDataRequestManager.h:25
Definition: Logger.h:61
static bool SerializeToString(const SEPatientConfiguration &src, std::string &output, SerializationFormat m)
Definition: PBEngine.cpp:300
static bool SerializeToFile(const SEPatientConfiguration &src, const std::string &filename, SerializationFormat m)
Definition: PBEngine.cpp:306
static bool SerializeFromFile(const std::string &filename, SEPatientConfiguration &dst, SerializationFormat m, SESubstanceManager &subMgr)
Definition: PBEngine.cpp:322
SEDecimalFormat * m_DefaultDecimalFormatting
Definition: SEDataRequestManager.h:102
bool HasDataRequests() const
Definition: SEDataRequestManager.h:31
std::vector< SEDataRequest * > m_Requests
Definition: SEDataRequestManager.h:100
double GetSamplesPerSecond() const
Definition: SEDataRequestManager.h:28
bool HasResultsFilename() const
Definition: SEDataRequestManager.h:24
Definition: Logger.h:11
Definition: PBEngine.h:24
Definition: SEDecimalFormat.h:9
Definition: SEDataRequestManager.h:9
static void Copy(const SEDataRequest &src, SEDataRequest &dst)
Definition: PBEngine.cpp:363
double m_SamplesPerSecond
Definition: SEDataRequestManager.h:99
SEDecimalFormat * m_OverrideDecimalFormatting
Definition: SEDataRequestManager.h:103
static bool SerializeFromString(const std::string &src, SEPatientConfiguration &dst, SerializationFormat m, SESubstanceManager &subMgr)
Definition: PBEngine.cpp:314
Definition: SEDataRequest.h:17
Definition: CompoundUnit.h:39
Definition: SESubstance.h:14
const std::vector< SEDataRequest * > & GetDataRequests() const
Definition: SEDataRequestManager.h:32
void SetResultsFilename(const std::string &name)
Definition: SEDataRequestManager.h:26
void SetSamplesPerSecond(double num)
Definition: SEDataRequestManager.h:29