GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 42.9% 3 / 0 / 7
Functions: 42.9% 3 / 0 / 7
Branches: 59.1% 13 / 0 / 22

src/utilities/idd/IddFieldProperties.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_IDDFIELDPROPERTIES_HPP
7 #define UTILITIES_IDD_IDDFIELDPROPERTIES_HPP
8
9 #include "../UtilitiesAPI.hpp"
10 #include "../core/Enum.hpp"
11 #include <boost/optional.hpp>
12
13 #include <string>
14 #include <vector>
15
16 namespace openstudio {
17
18 // Disable clang-format for OPENSTUDIO_ENUM call, since clang-format will mess it up
19 // (eg: 'object-list' becomes 'object - list')
20 // clang-format off
21
22 /** \class IddFieldType
23 * \brief Enumeration of IDF field types as defined by the possible values for the IDD \\type
24 * flag. See the OPENSTUDIO_ENUM documentation in utilities/core/Enum.hpp. The actual macro
25 * call is:
26 * \code
27 OPENSTUDIO_ENUM(IddFieldType,
28 ((UnknownType)(unknown))
29 ((IntegerType)(integer))
30 ((RealType)(real))
31 ((AlphaType)(alpha))
32 ((ChoiceType)(choice))
33 ((NodeType)(node))
34 ((ObjectListType)(object-list))
35 ((ExternalListType)(external-list))
36 ((URLType)(url))
37 ((HandleType)(handle))
38 );
39 * \endcode */
40
13/22
openstudio::IddFieldType::buildStringVec[abi:cxx11](bool):
✓ Branch 0 taken 40030 times.
✓ Branch 1 taken 40030 times.
✓ Branch 3 taken 40030 times.
✓ Branch 6 taken 40030 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 40030 times.
✓ Branch 12 taken 40030 times.
✓ Branch 17 taken 40030 times.
✓ Branch 20 taken 40030 times.
✓ Branch 23 taken 72054 times.
✓ Branch 24 taken 16012 times.
✓ Branch 25 taken 8006 times.
✓ Branch 26 taken 8006 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 8006 times.
openstudio::IddFieldType::enumName[abi:cxx11]():
✗ Branch 1 not taken.
openstudio::operator<<(std::ostream&, openstudio::IddFieldType 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.
41276723 OPENSTUDIO_ENUM(IddFieldType,
41 ((UnknownType)(unknown))
42 ((IntegerType)(integer))
43 ((RealType)(real))
44 ((AlphaType)(alpha))
45 ((ChoiceType)(choice))
46 ((NodeType)(node))
47 ((ObjectListType)(object-list))
48 ((ExternalListType)(external-list))
49 ((URLType)(url))
50 ((HandleType)(handle))
51 );
52
53 // clang-format on
54
55 /** IddFieldProperties describes the properties of an IddField object, as specified by
56 * IDD markup. */
57 struct UTILITIES_API IddFieldProperties
58 {
59 public:
60 /** Default constructor. */
61 IddFieldProperties();
62
63 /** Returns true if no properties other than type are set. */
64 bool isGeneric() const;
65
66 /** Returns true if all underlying data is exactly equal. */
67 bool operator==(const IddFieldProperties& other) const;
68
69 /** Negation of operator== */
70 bool operator!=(const IddFieldProperties& other) const;
71
72 /** Field type (alpha, numeric, various flavors of alpha providing links to other objects
73 * and files). */
74 IddFieldType type;
75
76 /** Field notes collected into one string. */
77 std::string note;
78
79 /** True if this field is required (must be filled in for the IdfObject to be valid). */
80 bool required;
81
82 /** True if the field data is autosizable. */
83 bool autosizable;
84
85 /** True if the field autocalculatable. */
86 bool autocalculatable;
87
88 /** True if the field value is case-sensitive. */
89 bool retaincase;
90
91 /** True if this field has been deprecated (should not be used, but is okay for legacy files). */
92 bool deprecated;
93
94 /** True if this field is the first in an extensible group. */
95 bool beginExtensible;
96
97 /** The EnergyPlus-format unit string for this field. All data are assumed to be associated
98 * with these (typically SI) units. */
99 boost::optional<std::string> units;
100
101 /** The EnergyPlus-format unit string indicating this field's IP units. No effect on underlying
102 * data; a suggestion for user-facing displays. */
103 boost::optional<std::string> ipUnits;
104
105 /** Enumeration indicating the type of numeric bound to be applied. */
106 enum BoundTypes
107 {
108 Unbounded,
109 InclusiveBound,
110 ExclusiveBound
111 };
112
113 /** Minimum bound is non-existent (Unbounded), >= (InclusiveBound), or > (ExclusiveBound). */
114 BoundTypes minBoundType;
115 boost::optional<double> minBoundValue;
116 boost::optional<std::string> minBoundText;
117
118 /** Maximum bound is non-existent (Unbounded), <= (InclusiveBound), or < (ExclusiveBound). */
119 BoundTypes maxBoundType;
120 boost::optional<double> maxBoundValue;
121 boost::optional<std::string> maxBoundText;
122
123 /// The default value as string.
124 boost::optional<std::string> stringDefault;
125
126 /// The default value as double.
127 boost::optional<double> numericDefault;
128
129 /** This field points to an IdfObject that is registered with one of the reference lists named
130 * in this vector. The list names are defined by \\reference markup of name fields. There is
131 * also an OpenStudio-specific universal reference list called 'AllObjects'. */
132 std::vector<std::string> objectLists;
133
134 /** This field specifies that the containing IdfObject belongs to the following reference lists.
135 * This information can be used by other objects to point to (reference) this object using
136 * \\object-list markup. */
137 std::vector<std::string> references;
138
139 /** This field specifies that the containing IdfObject belongs to the following reference-class-name lists.
140 **/
141 std::vector<std::string> referenceClassNames;
142
143 /** This field points to a name registered in another file (typically the RDD file). OpenStudio
144 * treats these fields as plain (unparsed) text. */
145 std::vector<std::string> externalLists;
146
147 /** Prints these field properties to os, in standard IDD format. */
148 std::ostream& print(std::ostream& os) const;
149 };
150
151 /** Returns the intersection of list1 and list2, as determined by IStringSet. */
152 UTILITIES_API std::vector<std::string> intersectReferenceLists(const std::vector<std::string>& list1, const std::vector<std::string>& list2);
153
154 } // namespace openstudio
155
156 #endif // UTILITIES_IDD_IDDFIELDPROPERTIES_HPP
157