src/model/GenericModelObject.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_GENERICMODELOBJECT_HPP | ||
| 7 | #define MODEL_GENERICMODELOBJECT_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "ModelObject.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | namespace model { | ||
| 14 | namespace detail { | ||
| 15 | class GenericModelObject_Impl; | ||
| 16 | } // namespace detail | ||
| 17 | |||
| 18 | /** GenericModelObject is a generic interface for \link ModelObject ModelObjects\endlink | ||
| 19 | * that do not yet have a customized interface. */ | ||
| 20 | |||
| 21 | /** GenericModelObject derives from ModelObject and is a generic interface to any OpenStudio IDD object.. | ||
| 22 | * | ||
| 23 | * GenericModelObject is different from all other \link ModelObject ModelObjects \endlink in that | ||
| 24 | * it does not wrap a specific OpenStudio IDD object. Instead it is a generic wrapper that can hold | ||
| 25 | * OpenStudio IDD objects of any type. When objects are added to Model, a large switch statement is | ||
| 26 | * used to construct wrappers of the correct type for each new object. If the type of a newly added | ||
| 27 | * object has not yet been wrapped by a specific ModelObject then a GenericModelObject is used to hold | ||
| 28 | * a reference to the data. GenericModelObject is planned to be deprecated once all OpenStudio IDD types | ||
| 29 | * are wrapped by specific \link ModelObject ModelObjects \endlink, this class only exists in the interim | ||
| 30 | * so translation to and from EnergyPlus via the implicit translator does not lose data objects. | ||
| 31 | * | ||
| 32 | */ | ||
| 33 | class MODEL_API GenericModelObject : public ModelObject | ||
| 34 | { | ||
| 35 | public: | ||
| 36 | ✗ | virtual ~GenericModelObject() override = default; | |
| 37 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 38 | ✗ | GenericModelObject(const GenericModelObject& other) = default; | |
| 39 | ✗ | GenericModelObject(GenericModelObject&& other) = default; | |
| 40 | ✗ | GenericModelObject& operator=(const GenericModelObject&) = default; | |
| 41 | ✗ | GenericModelObject& operator=(GenericModelObject&&) = default; | |
| 42 | |||
| 43 | protected: | ||
| 44 | /// @cond | ||
| 45 | |||
| 46 | using ImplType = detail::GenericModelObject_Impl; | ||
| 47 | |||
| 48 | friend class Model; | ||
| 49 | friend class openstudio::IdfObject; | ||
| 50 | |||
| 51 | // constructor | ||
| 52 | explicit GenericModelObject(std::shared_ptr<detail::GenericModelObject_Impl> impl); | ||
| 53 | |||
| 54 | private: | ||
| 55 | REGISTER_LOGGER("openstudio.model.GenericModelObject"); | ||
| 56 | |||
| 57 | /// @endcond | ||
| 58 | }; | ||
| 59 | |||
| 60 | // optional GenericModelObject | ||
| 61 | using OptionalGenericModelObject = boost::optional<GenericModelObject>; | ||
| 62 | |||
| 63 | // vector of GenericModelObject | ||
| 64 | using GenericModelObjectVector = std::vector<GenericModelObject>; | ||
| 65 | |||
| 66 | } // namespace model | ||
| 67 | } // namespace openstudio | ||
| 68 | |||
| 69 | #endif //MODEL_GENERICMODELOBJECT_HPP | ||
| 70 |