GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 0 / 1 / 1
Functions: -% 0 / 1 / 1
Branches: -% 0 / 1 / 1

src/utilities/filetypes/WorkflowJSON_Impl.hpp
Line Branch Exec Source
1 /***********************************************************************************************************************
2 * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC.
3 * See also https://openstudio.net/license
4 ***********************************************************************************************************************/
5
6 #ifndef UTILITIES_FILETYPES_WORKFLOWJSON_IMPL_HPP
7 #define UTILITIES_FILETYPES_WORKFLOWJSON_IMPL_HPP
8
9 #include "../UtilitiesAPI.hpp"
10
11 #include "WorkflowStep.hpp"
12 #include "RunOptions.hpp"
13
14 #include "../core/Path.hpp"
15
16 #include <nano/nano_signal_slot.hpp>
17
18 #include <json/json.h>
19
20 namespace openstudio {
21
22 class DateTime;
23 class WorkflowJSON;
24 class BCLMeasure;
25
26 namespace detail {
27
28 class UTILITIES_API WorkflowJSON_Impl
29 {
30 public:
31 WorkflowJSON_Impl();
32
33 WorkflowJSON_Impl(const std::string& s);
34
35 WorkflowJSON_Impl(const openstudio::path& p);
36
37 // Note: I'm keeping this one because I don't want to bother writting the copy/move constructors and assignment operators to handle the connection
38 // of the nano signals
39 WorkflowJSON clone() const;
40
41 Json::Value toJSON(bool includeHash = true) const;
42
43 std::string string(bool includeHash = true) const;
44
45 std::string hash() const;
46
47 // cppcheck-suppress functionStatic
48 std::string computeHash() const;
49
50 bool checkForUpdates();
51
52 bool save() const;
53
54 bool saveAs(const openstudio::path& p);
55
56 void reset();
57
58 void start();
59
60 unsigned currentStepIndex() const;
61
62 boost::optional<WorkflowStep> currentStep() const;
63
64 bool incrementStep();
65
66 boost::optional<std::string> completedStatus() const;
67
68 void setCompletedStatus(const std::string& status);
69
70 boost::optional<DateTime> createdAt() const;
71
72 boost::optional<DateTime> startedAt() const;
73
74 boost::optional<DateTime> updatedAt() const;
75
76 boost::optional<DateTime> completedAt() const;
77
78 boost::optional<std::string> eplusoutErr() const;
79
80 void setEplusoutErr(const std::string& eplusoutErr);
81
82 boost::optional<openstudio::path> oswPath() const;
83
84 bool setOswPath(const openstudio::path& path, bool emitChange);
85
86 openstudio::path oswDir() const;
87
88 bool setOswDir(const openstudio::path& path);
89
90 openstudio::path rootDir() const;
91 openstudio::path absoluteRootDir() const;
92 bool setRootDir(const openstudio::path& path);
93
94 openstudio::path runDir() const;
95 openstudio::path absoluteRunDir() const;
96
97 bool setRunDir(const openstudio::path& path);
98
99 openstudio::path outPath() const;
100 openstudio::path absoluteOutPath() const;
101
102 std::vector<openstudio::path> filePaths() const;
103 std::vector<openstudio::path> absoluteFilePaths() const;
104
105 bool addFilePath(const openstudio::path& path);
106 void resetFilePaths();
107
108 boost::optional<openstudio::path> findFile(const openstudio::path& file) const;
109 boost::optional<openstudio::path> findFile(const std::string& fileName) const;
110
111 std::vector<openstudio::path> measurePaths() const;
112 std::vector<openstudio::path> absoluteMeasurePaths() const;
113
114 bool addMeasurePath(const openstudio::path& path);
115 void resetMeasurePaths();
116
117 boost::optional<openstudio::path> findMeasure(const openstudio::path& measureDir) const;
118 boost::optional<openstudio::path> findMeasure(const std::string& measureDirName) const;
119
120 boost::optional<openstudio::path> seedFile() const;
121
122 void resetSeedFile();
123
124 bool setSeedFile(const openstudio::path& seedFile);
125
126 boost::optional<openstudio::path> seedModelicaFile() const;
127
128 boost::optional<std::string> seedModelicaModel() const;
129
130 bool setSeedModelicaFile(const openstudio::path& modelicaSeedFile);
131
132 void resetSeedModelicaFile();
133
134 std::vector<openstudio::path> modelicaPackages() const;
135
136 bool setModelicaPackages(const std::vector<openstudio::path>& packages);
137
138 void resetModelicaPackages();
139
140 boost::optional<openstudio::path> weatherFile() const;
141
142 bool setWeatherFile(const openstudio::path& weatherFile);
143
144 void resetWeatherFile();
145
146 std::vector<WorkflowStep> workflowSteps() const;
147
148 bool setWorkflowSteps(const std::vector<WorkflowStep>& workflowSteps);
149
150 void resetWorkflowSteps();
151
152 std::vector<MeasureStep> getMeasureSteps(const MeasureType& measureType) const;
153
154 std::vector<std::pair<unsigned, MeasureStep>> getMeasureStepsWithIndex(const MeasureType& measureType) const;
155
156 bool setMeasureSteps(const MeasureType& measureType, const std::vector<MeasureStep>& steps);
157
158 boost::optional<BCLMeasure> getBCLMeasure(const MeasureStep& step) const;
159
160 boost::optional<BCLMeasure> getBCLMeasureByUUID(const UUID& id) const;
161
162 boost::optional<BCLMeasure> addMeasure(const BCLMeasure& bclMeasure);
163
164 boost::optional<RunOptions> runOptions() const;
165
166 bool setRunOptions(const RunOptions& options);
167
168 void resetRunOptions();
169
170 // Emitted on any change
171 Nano::Signal<void()> onChange;
172
173 bool validateMeasures() const;
174
175 private:
176 − REGISTER_LOGGER("openstudio.WorkflowJSON");
177
178 void onUpdate();
179
180 void parseSteps();
181
182 void disconnectSteps();
183
184 void connectSteps();
185
186 void parseRunOptions();
187
188 void disconnectRunOptions();
189
190 void connectRunOptions();
191
192 // synchronize m_measureTypes with m_steps
193 void setMeasureTypes();
194
195 openstudio::path m_oswDir;
196 openstudio::path m_oswFilename;
197 Json::Value m_value;
198 // cppcheck-suppress unusedStructMember
199 std::vector<WorkflowStep> m_steps;
200 // cppcheck-suppress unusedStructMember
201 std::vector<int> m_measureTypes;
202 boost::optional<RunOptions> m_runOptions;
203 };
204
205 } // namespace detail
206 } // namespace openstudio
207
208 #endif //UTILITIES_FILETYPES_WORKFLOWJSON_IMPL_HPP
209