src/model/ScheduleTypeLimits.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_SCHEDULETYPELIMITS_HPP | ||
| 7 | #define MODEL_SCHEDULETYPELIMITS_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "ResourceObject.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | class Unit; | ||
| 14 | |||
| 15 | namespace model { | ||
| 16 | |||
| 17 | namespace detail { | ||
| 18 | |||
| 19 | class ScheduleTypeLimits_Impl; | ||
| 20 | |||
| 21 | } // namespace detail | ||
| 22 | |||
| 23 | /** ScheduleTypeLimits is a ResourceObject that wraps the OpenStudio IDD object 'OS:ScheduleTypeLimits'. | ||
| 24 | * Once attached to an object of type ScheduleBase, it defines the units and bounds for that object's | ||
| 25 | * values. */ | ||
| 26 | class MODEL_API ScheduleTypeLimits : public ResourceObject | ||
| 27 | { | ||
| 28 | public: | ||
| 29 | /** @name Constructors and Destructors */ | ||
| 30 | //@{ | ||
| 31 | |||
| 32 | explicit ScheduleTypeLimits(const Model& model); | ||
| 33 | |||
| 34 | 67884 | virtual ~ScheduleTypeLimits() override = default; | |
| 35 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 36 | 2386 | ScheduleTypeLimits(const ScheduleTypeLimits& other) = default; | |
| 37 | 37443 | ScheduleTypeLimits(ScheduleTypeLimits&& other) = default; | |
| 38 | ✗ | ScheduleTypeLimits& operator=(const ScheduleTypeLimits&) = default; | |
| 39 | 1 | ScheduleTypeLimits& operator=(ScheduleTypeLimits&&) = default; | |
| 40 | |||
| 41 | //@} | ||
| 42 | |||
| 43 | static IddObjectType iddObjectType(); | ||
| 44 | |||
| 45 | static std::vector<std::string> numericTypeValues(); | ||
| 46 | |||
| 47 | static std::vector<std::string> unitTypeValues(); | ||
| 48 | |||
| 49 | // std::string by val on purpose (boost::to_lower) | ||
| 50 | static boost::optional<Unit> units(std::string unitType, bool returnIP = false); | ||
| 51 | |||
| 52 | /** @name Getters */ | ||
| 53 | //@{ | ||
| 54 | |||
| 55 | boost::optional<double> lowerLimitValue() const; | ||
| 56 | |||
| 57 | boost::optional<double> upperLimitValue() const; | ||
| 58 | |||
| 59 | boost::optional<std::string> numericType() const; | ||
| 60 | |||
| 61 | std::string unitType() const; | ||
| 62 | |||
| 63 | bool isUnitTypeDefaulted() const; | ||
| 64 | |||
| 65 | boost::optional<Unit> units(bool returnIP = false) const; | ||
| 66 | |||
| 67 | //@} | ||
| 68 | /** @name Setters */ | ||
| 69 | //@{ | ||
| 70 | |||
| 71 | // ETH@20120919 TODO: Have these setters fail if they are going to invalidate the current | ||
| 72 | // use of a ScheduleBase object. | ||
| 73 | |||
| 74 | bool setLowerLimitValue(double lowerLimitValue); | ||
| 75 | |||
| 76 | void resetLowerLimitValue(); | ||
| 77 | |||
| 78 | bool setUpperLimitValue(double upperLimitValue); | ||
| 79 | |||
| 80 | void resetUpperLimitValue(); | ||
| 81 | |||
| 82 | bool setNumericType(const std::string& numericType); | ||
| 83 | |||
| 84 | void resetNumericType(); | ||
| 85 | |||
| 86 | bool setUnitType(const std::string& unitType); | ||
| 87 | |||
| 88 | void resetUnitType(); | ||
| 89 | |||
| 90 | //@} | ||
| 91 | protected: | ||
| 92 | /// @cond | ||
| 93 | using ImplType = detail::ScheduleTypeLimits_Impl; | ||
| 94 | |||
| 95 | explicit ScheduleTypeLimits(std::shared_ptr<detail::ScheduleTypeLimits_Impl> impl); | ||
| 96 | |||
| 97 | friend class detail::ScheduleTypeLimits_Impl; | ||
| 98 | friend class Model; | ||
| 99 | friend class IdfObject; | ||
| 100 | friend class openstudio::detail::IdfObject_Impl; | ||
| 101 | /// @endcond | ||
| 102 | private: | ||
| 103 | REGISTER_LOGGER("openstudio.model.ScheduleTypeLimits"); | ||
| 104 | }; | ||
| 105 | |||
| 106 | /** \relates ScheduleTypeLimits */ | ||
| 107 | using OptionalScheduleTypeLimits = boost::optional<ScheduleTypeLimits>; | ||
| 108 | |||
| 109 | /** \relates ScheduleTypeLimits */ | ||
| 110 | using ScheduleTypeLimitsVector = std::vector<ScheduleTypeLimits>; | ||
| 111 | |||
| 112 | /** Returns true if candidate is compatible with parentLimits, that is, if it is the same | ||
| 113 | * type and has bounds that are as least as strict as parentLimits's. | ||
| 114 | * \relates ScheduleTypeLimits */ | ||
| 115 | MODEL_API bool isCompatible(const ScheduleTypeLimits& parentLimits, const ScheduleTypeLimits& candidate); | ||
| 116 | |||
| 117 | } // namespace model | ||
| 118 | } // namespace openstudio | ||
| 119 | |||
| 120 | #endif // MODEL_SCHEDULETYPELIMITS_HPP | ||
| 121 |