GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 80.0% 4 / 0 / 5
Functions: 80.0% 4 / 0 / 5
Branches: -% 0 / 0 / 0

src/model/ScheduleCompact.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_SCHEDULECOMPACT_HPP
7 #define MODEL_SCHEDULECOMPACT_HPP
8
9 #include "ModelAPI.hpp"
10 #include "Schedule.hpp"
11
12 namespace openstudio {
13 namespace model {
14
15 namespace detail {
16 class ScheduleCompact_Impl;
17 } // namespace detail
18
19 /** ScheduleCompact is a Schedule that wraps the OpenStudio IDD object 'OS:Schedule:Compact'. */
20 class MODEL_API ScheduleCompact : public Schedule
21 {
22 public:
23 /** @name Constructors and Destructors */
24 //@{
25
26 /** Creates an empty (no values set for any days) ScheduleCompact. */
27 explicit ScheduleCompact(const Model& model);
28
29 /** Creates a ScheduleCompact with constantValue applied to the entire year. */
30 ScheduleCompact(const Model& model, double constantValue);
31
32 /** Creates a ScheduleCompact with constantValue applied to the entire year, if
33 * scheduleTypeLimits() and the units are compatible. Otherwise creates an empty
34 * ScheduleCompact. */
35 743 virtual ~ScheduleCompact() override = default;
36 // Default the copy and move operators because the virtual dtor is explicit
37 17 ScheduleCompact(const ScheduleCompact& other) = default;
38 33 ScheduleCompact(ScheduleCompact&& other) = default;
39 2 ScheduleCompact& operator=(const ScheduleCompact&) = default;
40 ✗ ScheduleCompact& operator=(ScheduleCompact&&) = default;
41
42 //@}
43
44 static IddObjectType iddObjectType();
45
46 /** @name Setters */
47 //@{
48
49 /** Clears all existing data and sets the data so that value will be applied to the entire
50 * year. */
51 bool setToConstantValue(double value);
52
53 /** If value can be converted to scheduleTypeLimit()'s units, then all existing data is cleared
54 * and value is set (after unit conversion, if necessary). */
55
56 //@}
57 /** @name Queries */
58 //@{
59
60 /** Returns true if this ScheduleCompact has a single value applied to the entire year.
61 * (Roughly--the text fields are not checked.) */
62 bool isConstantValue() const;
63
64 /** Returns this ScheduleCompact's constant value, if this ScheduleCompact conforms to that
65 * pattern. Otherwise returns boost::none (evaluates to false). */
66 boost::optional<double> constantValue() const;
67
68 //@}
69 protected:
70 using ImplType = detail::ScheduleCompact_Impl;
71
72 friend class Model;
73 friend class openstudio::IdfObject;
74
75 // constructor
76 explicit ScheduleCompact(std::shared_ptr<detail::ScheduleCompact_Impl> impl);
77
78 private:
79 REGISTER_LOGGER("openstudio.model.ScheduleCompact");
80 };
81
82 /** \relates ScheduleCompact */
83 using OptionalScheduleCompact = boost::optional<ScheduleCompact>;
84
85 /** \relates ScheduleCompact */
86 using ScheduleCompactVector = std::vector<ScheduleCompact>;
87
88 } // namespace model
89 } // namespace openstudio
90
91 #endif // MODEL_SCHEDULECOMPACT_HPP
92