src/utilities/filetypes/WorkflowStepResult_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_WORKFLOWSTEPRESULT_IMPL_HPP | ||
| 7 | #define UTILITIES_FILETYPES_WORKFLOWSTEPRESULT_IMPL_HPP | ||
| 8 | |||
| 9 | #include "../UtilitiesAPI.hpp" | ||
| 10 | |||
| 11 | #include "../core/Enum.hpp" | ||
| 12 | #include "../core/Logger.hpp" | ||
| 13 | #include "../core/Path.hpp" | ||
| 14 | #include "../data/Variant.hpp" | ||
| 15 | #include "../time/DateTime.hpp" | ||
| 16 | #include "../bcl/BCLMeasure.hpp" | ||
| 17 | |||
| 18 | namespace Json { | ||
| 19 | class Value; | ||
| 20 | } | ||
| 21 | |||
| 22 | namespace openstudio { | ||
| 23 | namespace detail { | ||
| 24 | |||
| 25 | class UTILITIES_API WorkflowStepValue_Impl | ||
| 26 | { | ||
| 27 | public: | ||
| 28 | WorkflowStepValue_Impl(const std::string& name, const Variant& value); | ||
| 29 | |||
| 30 | Json::Value toJSON() const; | ||
| 31 | |||
| 32 | std::string string() const; | ||
| 33 | |||
| 34 | //@} | ||
| 35 | /** @name Getters */ | ||
| 36 | //@{ | ||
| 37 | |||
| 38 | std::string name() const; | ||
| 39 | |||
| 40 | std::string displayName() const; | ||
| 41 | |||
| 42 | boost::optional<std::string> units() const; | ||
| 43 | |||
| 44 | VariantType variantType() const; | ||
| 45 | |||
| 46 | Variant valueAsVariant() const; | ||
| 47 | |||
| 48 | bool valueAsBoolean() const; | ||
| 49 | |||
| 50 | int valueAsInteger() const; | ||
| 51 | |||
| 52 | double valueAsDouble() const; | ||
| 53 | |||
| 54 | std::string valueAsString() const; | ||
| 55 | |||
| 56 | Json::Value valueAsJSON() const; | ||
| 57 | |||
| 58 | //@} | ||
| 59 | /** @name Setters */ | ||
| 60 | //@{ | ||
| 61 | |||
| 62 | void setName(const std::string& name); | ||
| 63 | |||
| 64 | void setDisplayName(const std::string& displayName); | ||
| 65 | void resetDisplayName(); | ||
| 66 | |||
| 67 | void setUnits(const std::string& units); | ||
| 68 | void resetUnits(); | ||
| 69 | |||
| 70 | //@} | ||
| 71 | |||
| 72 | private: | ||
| 73 | REGISTER_LOGGER("openstudio.WorkflowStepValue"); | ||
| 74 | |||
| 75 | std::string m_name; | ||
| 76 | Variant m_value; | ||
| 77 | boost::optional<std::string> m_displayName; | ||
| 78 | boost::optional<std::string> m_units; | ||
| 79 | }; | ||
| 80 | |||
| 81 | class UTILITIES_API WorkflowStepResult_Impl | ||
| 82 | { | ||
| 83 | public: | ||
| 84 | WorkflowStepResult_Impl(); | ||
| 85 | |||
| 86 | Json::Value toJSON() const; | ||
| 87 | |||
| 88 | std::string string() const; | ||
| 89 | |||
| 90 | boost::optional<DateTime> startedAt() const; | ||
| 91 | |||
| 92 | boost::optional<DateTime> completedAt() const; | ||
| 93 | |||
| 94 | boost::optional<MeasureType> measureType() const; | ||
| 95 | |||
| 96 | boost::optional<std::string> measureName() const; | ||
| 97 | |||
| 98 | boost::optional<std::string> measureId() const; | ||
| 99 | |||
| 100 | boost::optional<UUID> measureUUID() const; | ||
| 101 | |||
| 102 | boost::optional<std::string> measureVersionId() const; | ||
| 103 | |||
| 104 | boost::optional<UUID> measureVersionUUID() const; | ||
| 105 | |||
| 106 | boost::optional<DateTime> measureVersionModified() const; | ||
| 107 | |||
| 108 | boost::optional<std::string> measureXmlChecksum() const; | ||
| 109 | |||
| 110 | boost::optional<std::string> measureClassName() const; | ||
| 111 | |||
| 112 | boost::optional<std::string> measureDisplayName() const; | ||
| 113 | |||
| 114 | boost::optional<std::string> measureTaxonomy() const; | ||
| 115 | |||
| 116 | boost::optional<StepResult> stepResult() const; | ||
| 117 | |||
| 118 | boost::optional<std::string> stepInitialCondition() const; | ||
| 119 | |||
| 120 | boost::optional<std::string> stepFinalCondition() const; | ||
| 121 | |||
| 122 | std::vector<std::string> stepErrors() const; | ||
| 123 | |||
| 124 | std::vector<std::string> stepWarnings() const; | ||
| 125 | |||
| 126 | std::vector<std::string> stepInfo() const; | ||
| 127 | |||
| 128 | std::vector<WorkflowStepValue> stepValues() const; | ||
| 129 | |||
| 130 | std::vector<openstudio::path> stepFiles() const; | ||
| 131 | |||
| 132 | boost::optional<std::string> stdOut() const; | ||
| 133 | |||
| 134 | boost::optional<std::string> stdErr() const; | ||
| 135 | |||
| 136 | // methods for backwards compatibility with OpenStudio 1.X | ||
| 137 | StepResult value() const; | ||
| 138 | std::vector<LogMessage> errors() const; | ||
| 139 | std::vector<LogMessage> warnings() const; | ||
| 140 | std::vector<LogMessage> info() const; | ||
| 141 | boost::optional<LogMessage> initialCondition() const; | ||
| 142 | boost::optional<LogMessage> finalCondition() const; | ||
| 143 | std::vector<Attribute> attributes() const; | ||
| 144 | |||
| 145 | void setStartedAt(const DateTime& dateTime); | ||
| 146 | void resetStartedAt(); | ||
| 147 | |||
| 148 | void setCompletedAt(const DateTime& dateTime); | ||
| 149 | void resetCompletedAt(); | ||
| 150 | |||
| 151 | bool setMeasureType(const MeasureType& measureType); | ||
| 152 | void resetMeasureType(); | ||
| 153 | |||
| 154 | bool setMeasureName(const std::string& name); | ||
| 155 | void resetMeasureName(); | ||
| 156 | |||
| 157 | bool setMeasureId(const std::string& id); | ||
| 158 | void resetMeasureId(); | ||
| 159 | |||
| 160 | bool setMeasureUUID(const UUID& uuid); | ||
| 161 | void resetMeasureUUID(); | ||
| 162 | |||
| 163 | bool setMeasureVersionId(const std::string& id); | ||
| 164 | void resetMeasureVersionId(); | ||
| 165 | |||
| 166 | bool setMeasureVersionUUID(const UUID& uuid); | ||
| 167 | void resetMeasureVersionUUID(); | ||
| 168 | |||
| 169 | bool setMeasureVersionModified(const DateTime& versionModified); | ||
| 170 | void resetMeasureVersionModified(); | ||
| 171 | |||
| 172 | bool setMeasureXmlChecksum(const std::string& checksum); | ||
| 173 | void resetMeasureXmlChecksum(); | ||
| 174 | |||
| 175 | bool setMeasureClassName(const std::string& className); | ||
| 176 | void resetMeasureClassName(); | ||
| 177 | |||
| 178 | bool setMeasureDisplayName(const std::string& displayName); | ||
| 179 | void resetMeasureDisplayName(); | ||
| 180 | |||
| 181 | bool setMeasureTaxonomy(const std::string& taxonomy); | ||
| 182 | void resetMeasureTaxonomy(); | ||
| 183 | |||
| 184 | void setStepResult(const StepResult& result); | ||
| 185 | void resetStepResult(); | ||
| 186 | |||
| 187 | void setStepInitialCondition(const std::string& initialCondition); | ||
| 188 | void resetStepInitialCondition(); | ||
| 189 | |||
| 190 | void setStepFinalCondition(const std::string& finalCondition); | ||
| 191 | void resetStepFinalCondition(); | ||
| 192 | |||
| 193 | void addStepError(const std::string& error); | ||
| 194 | void resetStepErrors(); | ||
| 195 | |||
| 196 | void addStepWarning(const std::string& warning); | ||
| 197 | void resetStepWarnings(); | ||
| 198 | |||
| 199 | void addStepInfo(const std::string& info); | ||
| 200 | void resetStepInfo(); | ||
| 201 | |||
| 202 | void addStepValue(const WorkflowStepValue& value); | ||
| 203 | void resetStepValues(); | ||
| 204 | |||
| 205 | void addStepFile(const openstudio::path& path); | ||
| 206 | void resetStepFiles(); | ||
| 207 | |||
| 208 | void setStdOut(const std::string& stdOut); | ||
| 209 | void resetStdOut(); | ||
| 210 | |||
| 211 | void setStdErr(const std::string& stdErr); | ||
| 212 | void resetStdErr(); | ||
| 213 | |||
| 214 | void showOutput() const; | ||
| 215 | |||
| 216 | private: | ||
| 217 | − | REGISTER_LOGGER("openstudio.WorkflowStepResult"); | |
| 218 | |||
| 219 | boost::optional<DateTime> m_startedAt; | ||
| 220 | boost::optional<DateTime> m_completedAt; | ||
| 221 | boost::optional<MeasureType> m_measureType; | ||
| 222 | boost::optional<std::string> m_measureName; | ||
| 223 | boost::optional<std::string> m_measureId; | ||
| 224 | boost::optional<std::string> m_measureVersionId; | ||
| 225 | boost::optional<std::string> m_measureVersionModified; | ||
| 226 | boost::optional<std::string> m_measureXmlChecksum; | ||
| 227 | boost::optional<std::string> m_measureClassName; | ||
| 228 | boost::optional<std::string> m_measureDisplayName; | ||
| 229 | boost::optional<std::string> m_measureTaxonomy; | ||
| 230 | boost::optional<StepResult> m_stepResult; | ||
| 231 | boost::optional<std::string> m_stepInitialCondition; | ||
| 232 | boost::optional<std::string> m_stepFinalCondition; | ||
| 233 | std::vector<std::string> m_stepErrors; | ||
| 234 | std::vector<std::string> m_stepWarnings; | ||
| 235 | std::vector<std::string> m_stepInfo; | ||
| 236 | std::vector<WorkflowStepValue> m_stepValues; | ||
| 237 | std::vector<openstudio::path> m_stepFiles; | ||
| 238 | boost::optional<std::string> m_stdOut; | ||
| 239 | boost::optional<std::string> m_stdErr; | ||
| 240 | }; | ||
| 241 | |||
| 242 | } // namespace detail | ||
| 243 | } // namespace openstudio | ||
| 244 | |||
| 245 | #endif // UTILITIES_FILETYPES_WORKFLOWSTEPRESULT_IMPL_HPP | ||
| 246 |