GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 66.7% 12 / 0 / 18
Functions: 75.0% 9 / 0 / 12
Branches: 7.1% 1 / 0 / 14

src/utilities/idd/IddEnums.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 UTILITIES_IDD_IDDENUMS_HPP
7 #define UTILITIES_IDD_IDDENUMS_HPP
8
9 #include "../UtilitiesAPI.hpp"
10 #include "../core/Enum.hpp"
11
12 #include <boost/optional.hpp>
13
14 #include <vector>
15 #include <set>
16
17 namespace openstudio {
18
19 /** \class IddFileType
20 * \brief Enumeration of the types of \link openstudio::IddFile IddFile\endlink available
21 * through OpenStudio.
22 *
23 * UserCustom \link openstudio::IddFile IddFiles\endlink are loaded directly from disk, and
24 * typically correspond to old or under-development versions of EnergyPlus or OpenStudio. The
25 * rest of the enumeration values designate subsets of the \link openstudio::IddFactory
26 * IddFactory\endlink (the current versions of the EnergyPlus and OpenStudio IDDs, and all
27 * objects in the factory). */
28 #ifdef SWIG
29 // cppcheck-suppress syntaxError
30 OPENSTUDIO_ENUM(IddFileType, )
31 #else
32 struct UTILITIES_API IddFileType : public ::EnumBase<IddFileType>
33 {
34 public:
35 enum domain : int;
36
37 12 IddFileType() : EnumBase<IddFileType>(0) {}
38 4049 IddFileType(const std::string& t_name) : EnumBase<IddFileType>(t_name) {}
39 5893899 IddFileType(int t_value) : EnumBase<IddFileType>(t_value) {}
40
41 ✗ static std::string enumName() {
42 ✗ return "IddFileType";
43 }
44
45 6945 domain value() const {
46 6945 return static_cast<domain>(EnumBase<IddFileType>::integer_value());
47 }
48
49 private:
50 friend class EnumBase<IddFileType>;
51 using PT = std::pair<std::string, int>;
52 using VecType = std::vector<PT>;
53 static VecType buildStringVec(bool isd);
54 };
55
56 ✗ inline std::ostream& operator<<(std::ostream& os, const IddFileType& e) {
57 ✗ return os << e.valueName() << "(" << e.value() << ")";
58 }
59
60 using OptionalIddFileType = boost::optional<IddFileType>;
61 #endif
62 /** \relates IddFileType */
63 using IddFileTypeVector = std::vector<IddFileType>;
64 /** \relates IddFileType */
65 using IddFileTypeSet = std::set<IddFileType>;
66
67 /** \relates IddFileType */
68 using OptionalIddFileTypeVector = boost::optional<std::vector<IddFileType>>;
69 /** \relates IddFileType */
70 using OptionalIddFileTypeSet = boost::optional<std::set<IddFileType>>;
71
72 /** \class IddObjectType
73 * \brief Enumeration of the \link openstudio::IddObject IddObject\endlink types available
74 * through the \link openstudio::IddFactory IddFactory\endlink.
75 * \details Catchall is the default constructed \link openstudio::IddObject IddObject\endlink
76 * type. UserCustom is the default type for \link openstudio::IddObject IddObjects\endlink
77 * constructed by \link openstudio::IddObject::load IddObject::load\endlink. UserCustom objects
78 * must be referenced by name through an \link openstudio::IddFile IddFile\endlink or \link
79 * openstudio::IddFileAndFactoryWrapper IddFileAndFactoryWrapper\endlink. They cannot be
80 * accessed through the \link openstudio::IddFactory IddFactory\endlink (by name or
81 * type). CommentOnly is a convenience object for capturing standalone comments in IDFs. All other
82 * types are derived from the IDD files used to create \link openstudio::IddFactory
83 * IddFactory\endlink. See the OPENSTUDIO_ENUM documentation in utilities/core/Enum.hpp.
84 * */
85 #ifdef SWIG
86 OPENSTUDIO_ENUM(IddObjectType, )
87 #else
88 struct UTILITIES_API IddObjectType : public ::EnumBase<IddObjectType>
89 {
90 public:
91 enum domain : int;
92
93 160 IddObjectType() : EnumBase<IddObjectType>(0) {}
94 395371 IddObjectType(const std::string& t_name) : EnumBase<IddObjectType>(t_name) {}
95 20581194 IddObjectType(int t_value) : EnumBase<IddObjectType>(t_value) {}
96
97 9 static std::string enumName() {
98
1/1
✓ Branch 1 taken 9 times.
18 return "IddObjectType";
99 }
100
101 378692 domain value() const {
102 378692 return static_cast<domain>(EnumBase<IddObjectType>::integer_value());
103 }
104
105 private:
106 friend class EnumBase<IddObjectType>;
107 using PT = std::pair<std::string, int>;
108 using VecType = std::vector<PT>;
109 static VecType buildStringVec(bool isd);
110 };
111
112 ✗ inline std::ostream& operator<<(std::ostream& os, const IddObjectType& e) {
113 ✗ return os << e.valueName() << "(" << e.value() << ")";
114 }
115
116 using OptionalIddObjectType = boost::optional<IddObjectType>;
117 #endif
118 /** \relates IddObjectType */
119 using IddObjectTypeVector = std::vector<IddObjectType>;
120 /** \relates IddObjectType */
121 using IddObjectTypeSet = std::set<IddObjectType>;
122
123 /** \relates IddObjectType */
124 using OptionalIddObjectTypeVector = boost::optional<std::vector<IddObjectType>>;
125 /** \relates IddObjectType */
126 using OptionalIddObjectTypeSet = boost::optional<std::set<IddObjectType>>;
127
128 } // namespace openstudio
129
130 #endif // UTILITIES_IDD_IDDENUMS_HXX
131