src/model/SpaceLoadInstance.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_SPACELOADINSTANCE_HPP | ||
| 7 | #define MODEL_SPACELOADINSTANCE_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "SpaceLoad.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | namespace model { | ||
| 14 | |||
| 15 | class SpaceLoadDefinition; | ||
| 16 | |||
| 17 | namespace detail { | ||
| 18 | class SpaceLoadInstance_Impl; | ||
| 19 | } | ||
| 20 | |||
| 21 | /** SpaceLoadInstance is an abstract class derived from SpaceLoad. \link SpaceLoadInstance | ||
| 22 | * SpaceLoadInstances \endlink instantiate a given SpaceLoadDefinition in a Space or SpaceType | ||
| 23 | * by defining a multiplier and a schedule. | ||
| 24 | */ | ||
| 25 | class MODEL_API SpaceLoadInstance : public SpaceLoad | ||
| 26 | { | ||
| 27 | public: | ||
| 28 | 9600 | virtual ~SpaceLoadInstance() override = default; | |
| 29 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 30 | 432 | SpaceLoadInstance(const SpaceLoadInstance& other) = default; | |
| 31 | 3748 | SpaceLoadInstance(SpaceLoadInstance&& other) = default; | |
| 32 | ✗ | SpaceLoadInstance& operator=(const SpaceLoadInstance&) = default; | |
| 33 | 391 | SpaceLoadInstance& operator=(SpaceLoadInstance&&) = default; | |
| 34 | |||
| 35 | /** Returns the definition of this instance. **/ | ||
| 36 | SpaceLoadDefinition definition() const; | ||
| 37 | |||
| 38 | /** Sets the definition of this instance. **/ | ||
| 39 | bool setDefinition(const SpaceLoadDefinition& definition); | ||
| 40 | |||
| 41 | /** Ensures that no other instances share this instances definition. **/ | ||
| 42 | void makeUnique(); | ||
| 43 | |||
| 44 | /** Gets the multiplier for this space instance, defaults to 1. **/ | ||
| 45 | double multiplier() const; | ||
| 46 | |||
| 47 | /** Returns true if the multiplier is defaulted. **/ | ||
| 48 | bool isMultiplierDefaulted() const; | ||
| 49 | |||
| 50 | /** Returns the floor area associated with this space load instance. | ||
| 51 | If this space load is associated with a single space then that space's floor area is returned. | ||
| 52 | If this space load is associated with a space type then the sum of all space floor area in that space type is returned. | ||
| 53 | Space and SpaceLoadInstance multipliers are included in the result **/ | ||
| 54 | double floorArea() const; | ||
| 55 | |||
| 56 | /** Returns the number of instances this space load instance represents. | ||
| 57 | Space and SpaceLoadInstance multipliers are included in the result **/ | ||
| 58 | int quantity() const; | ||
| 59 | |||
| 60 | protected: | ||
| 61 | /** @name Constructors and Destructors */ | ||
| 62 | //@{ | ||
| 63 | |||
| 64 | /// Constructs a new SpaceLoadInstance object in the model. | ||
| 65 | SpaceLoadInstance(IddObjectType type, const SpaceLoadDefinition& definition); | ||
| 66 | |||
| 67 | //@} | ||
| 68 | |||
| 69 | /// @cond | ||
| 70 | |||
| 71 | using ImplType = detail::SpaceLoadInstance_Impl; | ||
| 72 | |||
| 73 | friend class Model; | ||
| 74 | friend class openstudio::IdfObject; | ||
| 75 | friend class detail::SpaceLoadInstance_Impl; | ||
| 76 | |||
| 77 | explicit SpaceLoadInstance(std::shared_ptr<detail::SpaceLoadInstance_Impl> impl); | ||
| 78 | |||
| 79 | private: | ||
| 80 | REGISTER_LOGGER("openstudio.model.SpaceLoadInstance"); | ||
| 81 | |||
| 82 | /// @endcond | ||
| 83 | }; | ||
| 84 | |||
| 85 | /** \relates SpaceLoadInstance */ | ||
| 86 | using OptionalSpaceLoadInstance = boost::optional<SpaceLoadInstance>; | ||
| 87 | |||
| 88 | /** \relates SpaceLoadInstance */ | ||
| 89 | using SpaceLoadInstanceVector = std::vector<SpaceLoadInstance>; | ||
| 90 | |||
| 91 | } // namespace model | ||
| 92 | } // namespace openstudio | ||
| 93 | |||
| 94 | #endif // MODEL_SPACELOADINSTANCE_HPP | ||
| 95 |