src/model/PythonPluginInstance.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 MODEL_PYTHONPLUGININSTANCE_HPP | ||
| 7 | #define MODEL_PYTHONPLUGININSTANCE_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "ResourceObject.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | |||
| 14 | namespace model { | ||
| 15 | |||
| 16 | class ExternalFile; | ||
| 17 | |||
| 18 | namespace detail { | ||
| 19 | |||
| 20 | class PythonPluginInstance_Impl; | ||
| 21 | |||
| 22 | } // namespace detail | ||
| 23 | |||
| 24 | /** PythonPluginInstance is a ResourceObject that wraps the OpenStudio IDD object 'OS:PythonPlugin:Instance'. */ | ||
| 25 | class MODEL_API PythonPluginInstance : public ResourceObject | ||
| 26 | { | ||
| 27 | public: | ||
| 28 | /** @name Constructors and Destructors */ | ||
| 29 | //@{ | ||
| 30 | |||
| 31 | PythonPluginInstance(const ExternalFile& externalfile, const std::string& pluginClassName); | ||
| 32 | |||
| 33 | 40 | virtual ~PythonPluginInstance() override = default; | |
| 34 | |||
| 35 | //@} | ||
| 36 | |||
| 37 | static IddObjectType iddObjectType(); | ||
| 38 | |||
| 39 | /** @name Getters */ | ||
| 40 | //@{ | ||
| 41 | |||
| 42 | ExternalFile externalFile() const; | ||
| 43 | |||
| 44 | bool runDuringWarmupDays() const; | ||
| 45 | bool isRunDuringWarmupDaysDefaulted() const; | ||
| 46 | |||
| 47 | std::string pluginClassName() const; | ||
| 48 | |||
| 49 | //@} | ||
| 50 | /** @name Setters */ | ||
| 51 | //@{ | ||
| 52 | |||
| 53 | bool setRunDuringWarmupDays(bool runDuringWarmupDays); | ||
| 54 | void resetRunDuringWarmupDays(); | ||
| 55 | |||
| 56 | bool setPluginClassName(const std::string& pluginClassName); | ||
| 57 | |||
| 58 | //@} | ||
| 59 | /** @name Other */ | ||
| 60 | //@{ | ||
| 61 | |||
| 62 | /** Helper that will return whether the pluginClassName can be found in the linked file */ | ||
| 63 | bool findPluginClassNameInFile(const std::string& pluginClassName) const; | ||
| 64 | |||
| 65 | std::vector<std::string> validPluginClassNamesInFile() const; | ||
| 66 | |||
| 67 | //@} | ||
| 68 | protected: | ||
| 69 | /// @cond | ||
| 70 | using ImplType = detail::PythonPluginInstance_Impl; | ||
| 71 | |||
| 72 | explicit PythonPluginInstance(std::shared_ptr<detail::PythonPluginInstance_Impl> impl); | ||
| 73 | |||
| 74 | friend class Model; | ||
| 75 | friend class IdfObject; | ||
| 76 | friend class openstudio::detail::IdfObject_Impl; | ||
| 77 | /// @endcond | ||
| 78 | private: | ||
| 79 | − | REGISTER_LOGGER("openstudio.model.PythonPluginInstance"); | |
| 80 | }; | ||
| 81 | |||
| 82 | /** \relates PythonPluginInstance*/ | ||
| 83 | using OptionalPythonPluginInstance = boost::optional<PythonPluginInstance>; | ||
| 84 | |||
| 85 | /** \relates PythonPluginInstance*/ | ||
| 86 | using PythonPluginInstanceVector = std::vector<PythonPluginInstance>; | ||
| 87 | |||
| 88 | } // namespace model | ||
| 89 | } // namespace openstudio | ||
| 90 | |||
| 91 | #endif // MODEL_PYTHONPLUGININSTANCE_HPP | ||
| 92 |