SEDataRequestManager.h
1/* Distributed under the Apache License, Version 2.0.
2 See accompanying NOTICE file for details.*/
3
4#pragma once
5#include "cdm/engine/SEDataRequest.h"
6class SESubstance;
8
9class CDM_DECL SEDataRequestManager : public Loggable
10{
11 friend class PBEngine;//friend the serialization class
12public:
15
16 void Clear();
17 void Copy(const SEDataRequestManager& src);
18
19 bool SerializeToString(std::string& output, eSerializationFormat m) const;
20 bool SerializeToFile(const std::string& filename) const;
21 bool SerializeFromString(const std::string& src, eSerializationFormat m);
22 bool SerializeFromFile(const std::string& filename);
23
24 // Only serialize our data requests, for portability
25 bool SerializeDataRequestsToString(std::string& output, eSerializationFormat m) const;
26 bool SerializeDataRequestsToFile(const std::string& filename) const;
27 bool SerializeDataRequestsFromString(const std::string& src, eSerializationFormat m);
28 bool SerializeDataRequestsFromFile(const std::string& filename);
29 bool MergeDataRequestFile(const std::string& filename);
30
31 bool HasResultsFilename() const { return !m_ResultsFilename.empty(); }
32 std::string GetResultFilename() const { return m_ResultsFilename; }
33 void SetResultsFilename(const std::string& name) { m_ResultsFilename = name; }
34
35 double GetSamplesPerSecond() const { return m_SamplesPerSecond; }
36 void SetSamplesPerSecond(double num) { m_SamplesPerSecond = num; }
37
38 bool HasDataRequests() const { return !m_Requests.empty(); }
39 std::vector<SEDataRequest*>& GetDataRequests() { return m_Requests; }
40 const std::vector<SEDataRequest*>& GetDataRequests() const { return m_Requests; }
41
42 virtual bool HasDefaultDecimalFormatting() const;
43 virtual SEDecimalFormat& GetDefaultDecimalFormatting();
44 virtual void RemoveDefaultDecimalFormatting();
45
46 virtual bool HasOverrideDecimalFormatting() const;
47 virtual SEDecimalFormat& GetOverrideDecimalFormatting();
48 virtual void RemoveOverrideDecimalFormatting();
49
50 SEDataRequest* FindDataRequest(const std::string& header) const;
51
52 SEDataRequest& CopyDataRequest(const SEDataRequest& dr);
53
54 SEDataRequest& CreateDataRequest(eDataRequest_Category category, const SEDecimalFormat* dfault = nullptr);
55 SEDataRequest& CreatePatientDataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
56 SEDataRequest& CreatePatientDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
57
58 SEDataRequest& CreatePhysiologyDataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
59 SEDataRequest& CreatePhysiologyDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
60
61 SEDataRequest& CreateEnvironmentDataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
62 SEDataRequest& CreateEnvironmentDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
63
64 SEDataRequest& CreateActionDataRequest(const std::string& actionName, const std::string& property, const SEDecimalFormat* dfault = nullptr);
65 SEDataRequest& CreateActionDataRequest(const std::string& actionName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
66 SEDataRequest& CreateActionCompartmentDataRequest(const std::string& actionName, const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault = nullptr);
67 SEDataRequest& CreateActionCompartmentDataRequest(const std::string& actionName, const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
68 SEDataRequest& CreateActionSubstanceDataRequest(const std::string& actionName, const std::string& substance, const std::string& property, const SEDecimalFormat* dfault = nullptr);
69 SEDataRequest& CreateActionSubstanceDataRequest(const std::string& actionName, const std::string& substance, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
70
71 SEDataRequest& CreateGasCompartmentDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault = nullptr);
72 SEDataRequest& CreateGasCompartmentDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
73 SEDataRequest& CreateGasCompartmentDataRequest(const std::string& cmptName, const std::string& substance, const std::string& property, const SEDecimalFormat* dfault = nullptr);
74 SEDataRequest& CreateGasCompartmentDataRequest(const std::string& cmptName, const std::string& substance, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
75
76 SEDataRequest& CreateLiquidCompartmentDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault = nullptr);
77 SEDataRequest& CreateLiquidCompartmentDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
78 SEDataRequest& CreateLiquidCompartmentDataRequest(const std::string& cmptName, const std::string& substance, const std::string& property, const SEDecimalFormat* dfault = nullptr);
79 SEDataRequest& CreateLiquidCompartmentDataRequest(const std::string& cmptName, const std::string& substance, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
80
81 SEDataRequest& CreateThermalCompartmentDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault = nullptr);
82 SEDataRequest& CreateThermalCompartmentDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
83
84 SEDataRequest& CreateTissueCompartmentDataRequest(const std::string& cmptName, const std::string& property, const SEDecimalFormat* dfault = nullptr);
85 SEDataRequest& CreateTissueCompartmentDataRequest(const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
86 SEDataRequest& CreateTissueCompartmentDataRequest(const std::string& cmptName, const std::string& substance, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
87
88 SEDataRequest& CreateSubstanceDataRequest(const std::string& substance, const std::string& property, const SEDecimalFormat* dfault = nullptr);
89 SEDataRequest& CreateSubstanceDataRequest(const std::string& substance, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
90 SEDataRequest& CreateSubstanceDataRequest(const std::string& substance, const std::string& cmptName, const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
91
92 SEDataRequest& CreateAnesthesiaMachineDataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
93 SEDataRequest& CreateAnesthesiaMachineDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
94
95 SEDataRequest& CreateECGDataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
96 SEDataRequest& CreateECGDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
97
98 SEDataRequest& CreateECMODataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
99 SEDataRequest& CreateECMODataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
100
101 SEDataRequest& CreateInhalerDataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
102 SEDataRequest& CreateInhalerDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
103
104 SEDataRequest& CreateMechanicalVentilatorDataRequest(const std::string& property, const SEDecimalFormat* dfault = nullptr);
105 SEDataRequest& CreateMechanicalVentilatorDataRequest(const std::string& property, const CCompoundUnit& unit, const SEDecimalFormat* dfault = nullptr);
106
107protected:
108 // Methods to find data requests so we don't keep making the same one
109 SEDataRequest* FindDataRequest(const SEDataRequest& dr);
110 SEDataRequest* FindPatientDataRequest(const std::string& property);
111 SEDataRequest* FindPhysiologyDataRequest(const std::string& property);
112 SEDataRequest* FindEnvironmentDataRequest(const std::string& property);
113 SEDataRequest* FindActionDataRequest(const std::string& actionName, const std::string& cmptName, const std::string& substance, const std::string& property);
114 SEDataRequest* FindGasCompartmentDataRequest(const std::string& cmptName, const std::string& property);
115 SEDataRequest* FindGasCompartmentDataRequest(const std::string& cmptName, const std::string& substance, const std::string& property);
116 SEDataRequest* FindLiquidCompartmentDataRequest(const std::string& cmptName, const std::string& property);
117 SEDataRequest* FindLiquidCompartmentDataRequest(const std::string& cmptName, const std::string& substance, const std::string& property);
118 SEDataRequest* FindThermalCompartmentDataRequest(const std::string& cmptName, const std::string& property);
119 SEDataRequest* FindTissueCompartmentDataRequest(const std::string& cmptName, const std::string& property);
120 SEDataRequest* FindSubstanceDataRequest(const std::string& substance, const std::string& property);
121 SEDataRequest* FindAnesthesiaMachineDataRequest(const std::string& property);
122 SEDataRequest* FindECGDataRequest(const std::string& property);
123 SEDataRequest* FindECMODataRequest(const std::string& property);
124 SEDataRequest* FindInhalerDataRequest(const std::string& property);
125 SEDataRequest* FindMechanicalVentilatorDataRequest(const std::string& property);
126
127 SEDataRequest& CopyDataRequest(const SEDataRequest& src, bool updateExisting);
128 void Remove(const SEDataRequest& dr);
129
130 std::string m_ResultsFilename;
132 std::vector<SEDataRequest*> m_Requests;
133
136};
Definition: CompoundUnit.h:40
Definition: Logger.h:23
Definition: Logger.h:71
Definition: PBEngine.h:31
static bool SerializeFromString(const std::string &src, LogMessages &dst, eSerializationFormat m, Logger *logger)
Definition: PBEngine.cpp:135
static void Copy(const SEDataRequest &src, SEDataRequest &dst)
Definition: PBEngine.cpp:513
static bool SerializeFromFile(const std::string &filename, SEPatientConfiguration &dst, const SESubstanceManager &subMgr)
Definition: PBEngine.cpp:466
static bool SerializeToString(const LogMessages &src, std::string &output, eSerializationFormat m, Logger *logger)
Definition: PBEngine.cpp:163
static bool SerializeToFile(const SEPatientConfiguration &src, const std::string &filename)
Definition: PBEngine.cpp:452
Definition: SEDataRequest.h:18
Definition: SEDataRequestManager.h:10
std::vector< SEDataRequest * > & GetDataRequests()
Definition: SEDataRequestManager.h:39
double GetSamplesPerSecond() const
Definition: SEDataRequestManager.h:35
bool HasDataRequests() const
Definition: SEDataRequestManager.h:38
void SetSamplesPerSecond(double num)
Definition: SEDataRequestManager.h:36
std::string m_ResultsFilename
Definition: SEDataRequestManager.h:130
void SetResultsFilename(const std::string &name)
Definition: SEDataRequestManager.h:33
SEDecimalFormat * m_DefaultDecimalFormatting
Definition: SEDataRequestManager.h:134
SEDecimalFormat * m_OverrideDecimalFormatting
Definition: SEDataRequestManager.h:135
const std::vector< SEDataRequest * > & GetDataRequests() const
Definition: SEDataRequestManager.h:40
std::string GetResultFilename() const
Definition: SEDataRequestManager.h:32
double m_SamplesPerSecond
Definition: SEDataRequestManager.h:131
std::vector< SEDataRequest * > m_Requests
Definition: SEDataRequestManager.h:132
bool HasResultsFilename() const
Definition: SEDataRequestManager.h:31
Definition: SEDecimalFormat.h:10
Definition: SESubstance.h:15
Definition: SESubstanceManager.h:9

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.