src/utilities/filetypes/WorkflowStep_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_WORKFLOWSTEP_IMPL_HPP | ||
| 7 | #define UTILITIES_FILETYPES_WORKFLOWSTEP_IMPL_HPP | ||
| 8 | |||
| 9 | #include "../UtilitiesAPI.hpp" | ||
| 10 | |||
| 11 | #include "WorkflowStepResult.hpp" | ||
| 12 | |||
| 13 | #include "../core/Logger.hpp" | ||
| 14 | #include "../core/Path.hpp" | ||
| 15 | #include "../data/Variant.hpp" | ||
| 16 | #include "../bcl/BCLMeasure.hpp" | ||
| 17 | |||
| 18 | #include <json/json.h> | ||
| 19 | |||
| 20 | #include <nano/nano_signal_slot.hpp> | ||
| 21 | |||
| 22 | namespace openstudio { | ||
| 23 | namespace detail { | ||
| 24 | |||
| 25 | class UTILITIES_API WorkflowStep_Impl | ||
| 26 | { | ||
| 27 | public: | ||
| 28 | WorkflowStep_Impl(); | ||
| 29 | |||
| 30 | 299 | virtual ~WorkflowStep_Impl() = default; | |
| 31 | |||
| 32 | std::string string() const; | ||
| 33 | virtual Json::Value toJSON() const = 0; | ||
| 34 | |||
| 35 | boost::optional<WorkflowStepResult> result() const; | ||
| 36 | |||
| 37 | void setResult(const WorkflowStepResult& result); | ||
| 38 | |||
| 39 | void resetResult(); | ||
| 40 | |||
| 41 | // Emitted on any change | ||
| 42 | Nano::Signal<void()> onChange; | ||
| 43 | |||
| 44 | protected: | ||
| 45 | void onUpdate(); | ||
| 46 | |||
| 47 | private: | ||
| 48 | // configure logging | ||
| 49 | REGISTER_LOGGER("openstudio.WorkflowStep"); | ||
| 50 | |||
| 51 | boost::optional<WorkflowStepResult> m_result; | ||
| 52 | }; | ||
| 53 | |||
| 54 | class UTILITIES_API MeasureStep_Impl : public WorkflowStep_Impl | ||
| 55 | { | ||
| 56 | public: | ||
| 57 | MeasureStep_Impl(const std::string& measureDirName); | ||
| 58 | |||
| 59 | virtual Json::Value toJSON() const override; | ||
| 60 | |||
| 61 | std::string measureDirName() const; | ||
| 62 | bool setMeasureDirName(const std::string& measureDirName); | ||
| 63 | |||
| 64 | boost::optional<std::string> name() const; | ||
| 65 | bool setName(const std::string& name); | ||
| 66 | void resetName(); | ||
| 67 | |||
| 68 | boost::optional<std::string> description() const; | ||
| 69 | bool setDescription(const std::string& description); | ||
| 70 | void resetDescription(); | ||
| 71 | |||
| 72 | boost::optional<std::string> modelerDescription() const; | ||
| 73 | bool setModelerDescription(const std::string& modelerDescription); | ||
| 74 | void resetModelerDescription(); | ||
| 75 | |||
| 76 | std::map<std::string, Variant> arguments() const; | ||
| 77 | boost::optional<Variant> getArgument(const std::string& name) const; | ||
| 78 | |||
| 79 | void setArgument(const std::string& name, const Variant& value); | ||
| 80 | void setArgument(const std::string& name, bool value); | ||
| 81 | void setArgument(const std::string& name, double value); | ||
| 82 | void setArgument(const std::string& name, int value); | ||
| 83 | void setArgument(const std::string& name, const std::string& value); | ||
| 84 | |||
| 85 | void removeArgument(const std::string& name); | ||
| 86 | |||
| 87 | void clearArguments(); | ||
| 88 | |||
| 89 | private: | ||
| 90 | // configure logging | ||
| 91 | REGISTER_LOGGER("openstudio.MeasureStep"); | ||
| 92 | |||
| 93 | std::string m_measureDirName; | ||
| 94 | boost::optional<std::string> m_name; | ||
| 95 | boost::optional<std::string> m_description; | ||
| 96 | boost::optional<std::string> m_modelerDescription; | ||
| 97 | std::map<std::string, Variant> m_arguments; | ||
| 98 | }; | ||
| 99 | |||
| 100 | } // namespace detail | ||
| 101 | } // namespace openstudio | ||
| 102 | |||
| 103 | #endif //UTILITIES_FILETYPES_WORKFLOWSTEP_IMPL_HPP | ||
| 104 |