GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 60.0% 3 / 1 / 6
Functions: 60.0% 3 / 1 / 6
Branches: -% 0 / 1 / 1

src/model/AdditionalProperties.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_ADDITIONALPROPERTIES_HPP
7 #define MODEL_ADDITIONALPROPERTIES_HPP
8
9 #include "ModelAPI.hpp"
10 #include "ModelObject.hpp"
11
12 namespace openstudio {
13
14 namespace model {
15
16 class ModelObject;
17
18 namespace detail {
19 class ModelObject_Impl;
20 class AdditionalProperties_Impl;
21
22 } // namespace detail
23
24 class MODEL_API AdditionalProperties : public ModelObject
25 {
26 public:
27 /** @name Constructors and Destructors */
28 //@{
29
30 131692 virtual ~AdditionalProperties() override = default;
31 // Default the copy and move operators because the virtual dtor is explicit
32 57536 AdditionalProperties(const AdditionalProperties& other) = default;
33 34542 AdditionalProperties(AdditionalProperties&& other) = default;
34 ✗ AdditionalProperties& operator=(const AdditionalProperties&) = default;
35 ✗ AdditionalProperties& operator=(AdditionalProperties&&) = default;
36
37 //@}
38
39 /** @name Static Methods */
40 //@{
41
42 //@}
43
44 static IddObjectType iddObjectType();
45
46 /** @name Getters */
47 //@{
48
49 /// Returns the ModelObject this AdditionalProperties object refers to.
50 /// This method will throw if the ModelObject cannot be found.
51 ModelObject modelObject() const;
52
53 /// Returns the set of feature name strings.
54 std::vector<std::string> featureNames() const;
55
56 /// Returns true if a feature exists
57 bool hasFeature(const std::string& name) const;
58
59 /// Returns optional feature data type as String, Double, Boolean, or Integer.
60 boost::optional<std::string> getFeatureDataType(const std::string& name) const;
61
62 /// Returns optional feature value as String.
63 boost::optional<std::string> getFeatureAsString(const std::string& name) const;
64
65 /// Returns optional feature value as Double.
66 boost::optional<double> getFeatureAsDouble(const std::string& name) const;
67
68 /// Returns optional feature value as Integer.
69 boost::optional<int> getFeatureAsInteger(const std::string& name) const;
70
71 /// Returns optional feature value as Boolean.
72 boost::optional<bool> getFeatureAsBoolean(const std::string& name) const;
73
74 /// Returns set of AdditionalProperties feature names already in the model.
75 std::vector<std::string> suggestedFeatureNames() const;
76
77 //@}
78 /** @name Setters */
79 //@{
80
81 bool setFeature(const std::string& name, const std::string& value);
82
83 bool setFeature(const std::string& name, const char* value);
84
85 bool setFeature(const std::string& name, double value);
86
87 bool setFeature(const std::string& name, int value);
88
89 bool setFeature(const std::string& name, bool value);
90
91 bool resetFeature(const std::string& name);
92
93 //@}
94
95 /// Merge another AdditionalProperties object with this one
96 /// If overwrite is true, the keys from other object overwrite keys from this
97 void merge(const AdditionalProperties& other, bool overwrite = false);
98
99 protected:
100 /// @cond
101
102 using ImplType = detail::AdditionalProperties_Impl;
103
104 friend class Model;
105 friend class openstudio::IdfObject;
106 friend class openstudio::detail::IdfObject_Impl;
107 friend class detail::AdditionalProperties_Impl;
108 friend class detail::ModelObject_Impl;
109
110 /** Create new object as child of model object. */
111 explicit AdditionalProperties(const ModelObject& modelObject);
112
113 explicit AdditionalProperties(std::shared_ptr<detail::AdditionalProperties_Impl> impl);
114
115 /// @endcond
116
117 private:
118 − REGISTER_LOGGER("openstudio.model.AdditionalProperties")
119 };
120
121 /** \relates AdditionalProperties */
122 using OptionalAdditionalProperties = boost::optional<AdditionalProperties>;
123
124 /** \relates AdditionalProperties */
125 using AdditionalPropertiesVector = std::vector<AdditionalProperties>;
126
127 } // namespace model
128
129 } // namespace openstudio
130
131 #endif //MODEL_ADDITIONALPROPERTIES_HPP
132