src/measure/OSOutput.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 MEASURE_OSOUTPUT_HPP | ||
| 7 | #define MEASURE_OSOUTPUT_HPP | ||
| 8 | |||
| 9 | #include "MeasureAPI.hpp" | ||
| 10 | |||
| 11 | #include "../utilities/idf/Workspace.hpp" | ||
| 12 | #include "../utilities/idd/IddEnums.hpp" | ||
| 13 | #include "../utilities/core/Path.hpp" | ||
| 14 | #include "../utilities/core/Enum.hpp" | ||
| 15 | #include "../utilities/core/Logger.hpp" | ||
| 16 | |||
| 17 | namespace Json { | ||
| 18 | class Value; | ||
| 19 | } | ||
| 20 | |||
| 21 | namespace openstudio { | ||
| 22 | namespace measure { | ||
| 23 | |||
| 24 | // clang-format off | ||
| 25 | |||
| 26 | /** \class OSOutputType | ||
| 27 | * \brief Listing of OSOutput data types, values match OSArgumentType. | ||
| 28 | * \details See the OPENSTUDIO_ENUM documentation in utilities/core/Enum.hpp. The actual | ||
| 29 | * macro call is: | ||
| 30 | * \code | ||
| 31 | OPENSTUDIO_ENUM(OSOutputType, | ||
| 32 | ((Boolean)(Bool)(0)) | ||
| 33 | ((Double)(Double)(1)) | ||
| 34 | ((Integer)(Int)(3)) | ||
| 35 | ((String)(String)(4)) | ||
| 36 | ); | ||
| 37 | * \endcode */ | ||
| 38 |
8/22openstudio::measure::OSOutputType::buildStringVec[abi:cxx11](bool):
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 12 not taken.
✓ Branch 17 taken 4 times.
✓ Branch 20 taken 4 times.
✓ Branch 23 taken 3 times.
✓ Branch 24 taken 2 times.
✓ Branch 25 taken 1 time.
✓ Branch 26 taken 1 time.
✗ Branch 27 not taken.
✓ Branch 28 taken 1 time.
openstudio::measure::OSOutputType::enumName[abi:cxx11]():
✗ Branch 1 not taken.
openstudio::measure::operator<<(std::ostream&, openstudio::measure::OSOutputType const&):
✗ Branch 1 not taken.
✗ Branch 4 not taken.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
|
14 | OPENSTUDIO_ENUM(OSOutputType, |
| 39 | ((Boolean)(Bool)(0)) | ||
| 40 | ((Double)(Double)(1)) | ||
| 41 | ((Integer)(Int)(3)) | ||
| 42 | ((String)(String)(4)) | ||
| 43 | ); | ||
| 44 | |||
| 45 | // clang-format on | ||
| 46 | |||
| 47 | /** OSOutput is an output of an OSMeasure. **/ | ||
| 48 | class MEASURE_API OSOutput | ||
| 49 | { | ||
| 50 | public: | ||
| 51 | /** @name Constructors and Destructors */ | ||
| 52 | //@{ | ||
| 53 | |||
| 54 | OSOutput(); | ||
| 55 | OSOutput(const std::string& name, const OSOutputType& type, bool modelDependent); | ||
| 56 | |||
| 57 | //@} | ||
| 58 | |||
| 59 | /** Creates an OSOutput for bool values. */ | ||
| 60 | static OSOutput makeBoolOutput(const std::string& name, bool modelDependent = false); | ||
| 61 | |||
| 62 | /** Creates an OSOutput for double values. */ | ||
| 63 | static OSOutput makeDoubleOutput(const std::string& name, bool modelDependent = false); | ||
| 64 | |||
| 65 | /** Creates an OSOutput for int values. */ | ||
| 66 | static OSOutput makeIntegerOutput(const std::string& name, bool modelDependent = false); | ||
| 67 | |||
| 68 | /** Creates an OSOutput for string values. */ | ||
| 69 | static OSOutput makeStringOutput(const std::string& name, bool modelDependent = false); | ||
| 70 | |||
| 71 | /** @name Getters */ | ||
| 72 | //@{ | ||
| 73 | |||
| 74 | /** Returns the name of this output. */ | ||
| 75 | std::string name() const; | ||
| 76 | |||
| 77 | /** Returns the display name of this output. */ | ||
| 78 | std::string displayName() const; | ||
| 79 | |||
| 80 | /** Returns the short name of this output. */ | ||
| 81 | std::string shortName() const; | ||
| 82 | |||
| 83 | /** Returns the description of this output. */ | ||
| 84 | boost::optional<std::string> description() const; | ||
| 85 | |||
| 86 | /** Returns this output's type. */ | ||
| 87 | OSOutputType type() const; | ||
| 88 | |||
| 89 | /** Returns the units of this output. */ | ||
| 90 | boost::optional<std::string> units() const; | ||
| 91 | |||
| 92 | /** Returns true if this output's properties can changed based on the specific model used in the | ||
| 93 | * measure. */ | ||
| 94 | bool modelDependent() const; | ||
| 95 | |||
| 96 | //@} | ||
| 97 | /** @name Setters */ | ||
| 98 | //@{ | ||
| 99 | |||
| 100 | /** Set the display name of this output. */ | ||
| 101 | void setDisplayName(const std::string& displayName); | ||
| 102 | |||
| 103 | /** Set the short name of this output. */ | ||
| 104 | void setShortName(const std::string& shortName); | ||
| 105 | |||
| 106 | /** Set the description of this output. */ | ||
| 107 | void setDescription(const std::string& description); | ||
| 108 | |||
| 109 | /** Set the units for this output. */ | ||
| 110 | void setUnits(const std::string& units); | ||
| 111 | |||
| 112 | //@} | ||
| 113 | /** @name Serialization */ | ||
| 114 | //@{ | ||
| 115 | |||
| 116 | /** Prints output data for debugging purposes. */ | ||
| 117 | std::string print() const; | ||
| 118 | |||
| 119 | Json::Value toJSON() const; | ||
| 120 | std::string toJSONString() const; | ||
| 121 | |||
| 122 | //@} | ||
| 123 | private: | ||
| 124 | REGISTER_LOGGER("openstudio.measure.OSOutput"); | ||
| 125 | |||
| 126 | std::string m_name; | ||
| 127 | std::string m_displayName; | ||
| 128 | std::string m_shortName; | ||
| 129 | boost::optional<std::string> m_description; | ||
| 130 | OSOutputType m_type; | ||
| 131 | boost::optional<std::string> m_units; | ||
| 132 | bool m_modelDependent; | ||
| 133 | }; | ||
| 134 | |||
| 135 | /** \relates OSOutput */ | ||
| 136 | using OptionalOSOutput = boost::optional<OSOutput>; | ||
| 137 | |||
| 138 | /** \relates OSOutput */ | ||
| 139 | using OSOutputVector = std::vector<OSOutput>; | ||
| 140 | |||
| 141 | /** Prints argument data to ostream for debugging purposes. \relates OSOutput */ | ||
| 142 | MEASURE_API std::ostream& operator<<(std::ostream& os, const OSOutput& arg); | ||
| 143 | |||
| 144 | } // namespace measure | ||
| 145 | } // namespace openstudio | ||
| 146 | |||
| 147 | #endif // MEASURE_OSOUTPUT_HPP | ||
| 148 |