src/model/OutputTableAnnual.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_OUTPUTTABLEANNUAL_HPP | ||
| 7 | #define MODEL_OUTPUTTABLEANNUAL_HPP | ||
| 8 | |||
| 9 | #include <model/ModelAPI.hpp> | ||
| 10 | #include "ModelObject.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | namespace model { | ||
| 14 | |||
| 15 | class Schedule; | ||
| 16 | |||
| 17 | namespace detail { | ||
| 18 | |||
| 19 | class OutputTableAnnual_Impl; | ||
| 20 | |||
| 21 | } // namespace detail | ||
| 22 | |||
| 23 | class MODEL_API AnnualVariableGroup | ||
| 24 | { | ||
| 25 | public: | ||
| 26 | AnnualVariableGroup(std::string variableorMeterorEMSVariableorField, std::string aggregationType = "SumOrAverage", int digitsAfterDecimal = 2); | ||
| 27 | |||
| 28 | std::string variableorMeterorEMSVariableorField() const; | ||
| 29 | std::string aggregationType() const; | ||
| 30 | int digitsAfterDecimal() const; | ||
| 31 | |||
| 32 | bool isAggregationTypeAdvanced() const; | ||
| 33 | |||
| 34 | // Only checks on variableorMeterorEMSVariableorField and aggregationType, not digitsAfterDecimal | ||
| 35 | bool operator==(const AnnualVariableGroup& other) const; | ||
| 36 | bool operator!=(const AnnualVariableGroup& other) const; | ||
| 37 | |||
| 38 | private: | ||
| 39 | std::string m_variableorMeterorEMSVariableorField; | ||
| 40 | std::string m_aggregationType; | ||
| 41 | int m_digitsAfterDecimal; | ||
| 42 | − | REGISTER_LOGGER("openstudio.model.AnnualVariableGroup"); | |
| 43 | }; | ||
| 44 | |||
| 45 | // Overload operator<< | ||
| 46 | MODEL_API std::ostream& operator<<(std::ostream& out, const openstudio::model::AnnualVariableGroup& annualVariableGroup); | ||
| 47 | |||
| 48 | /** OutputTableAnnual is a ModelObject that wraps the OpenStudio IDD object 'OS:Output:Table:Annual'. */ | ||
| 49 | class MODEL_API OutputTableAnnual : public ModelObject | ||
| 50 | { | ||
| 51 | public: | ||
| 52 | /** @name Constructors and Destructors */ | ||
| 53 | //@{ | ||
| 54 | |||
| 55 | explicit OutputTableAnnual(const Model& model); | ||
| 56 | |||
| 57 | 9 | virtual ~OutputTableAnnual() override = default; | |
| 58 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 59 | ✗ | OutputTableAnnual(const OutputTableAnnual& other) = default; | |
| 60 | 1 | OutputTableAnnual(OutputTableAnnual&& other) = default; | |
| 61 | ✗ | OutputTableAnnual& operator=(const OutputTableAnnual&) = default; | |
| 62 | ✗ | OutputTableAnnual& operator=(OutputTableAnnual&&) = default; | |
| 63 | |||
| 64 | //@} | ||
| 65 | |||
| 66 | static IddObjectType iddObjectType(); | ||
| 67 | |||
| 68 | static std::vector<std::string> aggregationTypeValues(); | ||
| 69 | static std::vector<std::string> validAggregationTypes(); | ||
| 70 | static bool isAggregationTypeValid(const std::string& aggregationType); | ||
| 71 | static bool isAggregationTypeAdvanced(const std::string& aggregationType); | ||
| 72 | static const std::vector<std::string>& advancedAggregationTypes(); | ||
| 73 | |||
| 74 | /** @name Getters */ | ||
| 75 | //@{ | ||
| 76 | |||
| 77 | boost::optional<std::string> filter() const; | ||
| 78 | |||
| 79 | boost::optional<Schedule> schedule() const; | ||
| 80 | |||
| 81 | //@} | ||
| 82 | /** @name Setters */ | ||
| 83 | //@{ | ||
| 84 | |||
| 85 | bool setFilter(const std::string& filter); | ||
| 86 | |||
| 87 | void resetFilter(); | ||
| 88 | |||
| 89 | bool setSchedule(Schedule& schedule); | ||
| 90 | |||
| 91 | void resetSchedule(); | ||
| 92 | |||
| 93 | //@} | ||
| 94 | /** @name Other */ | ||
| 95 | //@{ | ||
| 96 | |||
| 97 | // Handle this object's extensible fields. | ||
| 98 | |||
| 99 | std::vector<AnnualVariableGroup> annualVariableGroups() const; | ||
| 100 | |||
| 101 | unsigned int numberofAnnualVariableGroups() const; | ||
| 102 | |||
| 103 | boost::optional<unsigned> annualVariableGroupIndex(const AnnualVariableGroup& annualVariableGroup) const; | ||
| 104 | boost::optional<AnnualVariableGroup> getAnnualVariableGroup(unsigned groupIndex) const; | ||
| 105 | |||
| 106 | bool addAnnualVariableGroup(const AnnualVariableGroup& annualVariableGroup); | ||
| 107 | |||
| 108 | // Convenience fucntion that will create a AnnualVariableGroup | ||
| 109 | bool addAnnualVariableGroup(std::string variableorMeterorEMSVariableorField, std::string aggregationType = "SumOrAverage", | ||
| 110 | int digitsAfterDecimal = 2); | ||
| 111 | |||
| 112 | bool addAnnualVariableGroups(const std::vector<AnnualVariableGroup>& annualVariableGroups); | ||
| 113 | bool removeAnnualVariableGroup(unsigned groupIndex); | ||
| 114 | void removeAllAnnualVariableGroups(); | ||
| 115 | |||
| 116 | //@} | ||
| 117 | protected: | ||
| 118 | /// @cond | ||
| 119 | using ImplType = detail::OutputTableAnnual_Impl; | ||
| 120 | |||
| 121 | explicit OutputTableAnnual(std::shared_ptr<detail::OutputTableAnnual_Impl> impl); | ||
| 122 | |||
| 123 | friend class detail::OutputTableAnnual_Impl; | ||
| 124 | friend class Model; | ||
| 125 | friend class IdfObject; | ||
| 126 | friend class openstudio::detail::IdfObject_Impl; | ||
| 127 | /// @endcond | ||
| 128 | private: | ||
| 129 | REGISTER_LOGGER("openstudio.model.OutputTableAnnual"); | ||
| 130 | }; | ||
| 131 | |||
| 132 | /** \relates OutputTableAnnual*/ | ||
| 133 | using OptionalOutputTableAnnual = boost::optional<OutputTableAnnual>; | ||
| 134 | |||
| 135 | /** \relates OutputTableAnnual*/ | ||
| 136 | using OutputTableAnnualVector = std::vector<OutputTableAnnual>; | ||
| 137 | |||
| 138 | } // namespace model | ||
| 139 | } // namespace openstudio | ||
| 140 | |||
| 141 | #endif // MODEL_OUTPUTTABLEANNUAL_HPP | ||
| 142 |