GCC Code Coverage Report


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

src/utilities/idf/WorkspaceExtensibleGroup.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_IDF_WORKSPACEEXTENSIBLEGROUP_HPP
7 #define UTILITIES_IDF_WORKSPACEEXTENSIBLEGROUP_HPP
8
9 #include "../UtilitiesAPI.hpp"
10 #include "../idd/ExtensibleIndex.hpp"
11 #include "IdfExtensibleGroup.hpp"
12
13 #include "../core/Logger.hpp"
14 #include "../core/Optional.hpp"
15 #include "../core/Containers.hpp"
16
17 #include <boost/optional.hpp>
18
19 namespace openstudio {
20
21 namespace detail {
22 class WorkspaceObject_Impl;
23 }
24 class WorkspaceObject;
25
26 /** WorkspaceExtensibleGroup wraps a set of extensible fields in a WorkspaceObject. */
27 class UTILITIES_API WorkspaceExtensibleGroup : public IdfExtensibleGroup
28 {
29 public:
30 549292 virtual ~WorkspaceExtensibleGroup() override = default;
31
32 /** @name Getters */
33 //@{
34
35 /** Returns the object pointed to by field index, if it exists. */
36 boost::optional<WorkspaceObject> getTarget(unsigned fieldIndex) const;
37
38 /** Returns all objects pointed to by this object. */
39 std::vector<WorkspaceObject> getTargets() const;
40
41 /** Returns the fieldIndex of the field in this extensible group that points to targetHandle,
42 * if possible. */
43 std::vector<unsigned> getSourceFieldIndices(const Handle& targetHandle) const;
44
45 //@}
46 /** @name Setters */
47 //@{
48
49 /** Sets the pointer at fieldIndex to point to target, if possible. The field must be of
50 * object-list type, and target must be valid (in the containing Workspace, and if the strictness
51 * is greater than enums::None, of a proper type). */
52 bool setPointer(unsigned fieldIndex, const Handle& targetHandle);
53
54 bool setPointer(unsigned fieldIndex, const Handle& targetHandle, bool checkValidity);
55
56 //@}
57 /** @name Queries */
58 //@{
59
60 /** Returns true if this ExtensibleGroup points to another object. To qualify, there must be at
61 * least one pointer field holding a non-null pointer. */
62 bool isSource() const;
63
64 /** Returns true if this object can point to another object. To qualify, there must be at least
65 * one object-list field. */
66 bool canBeSource() const;
67
68 //@}
69
70 protected:
71 using ImplType = detail::WorkspaceObject_Impl;
72
73 friend class IdfExtensibleGroup;
74
75 WorkspaceExtensibleGroup(std::shared_ptr<detail::WorkspaceObject_Impl> impl, unsigned index);
76
77 private:
78 /** Private default constructor. */
79 WorkspaceExtensibleGroup();
80
81 REGISTER_LOGGER("openstudio.WorkspaceExtensibleGroup");
82 };
83
84 } // namespace openstudio
85
86 #endif // UTILITIES_IDF_WORKSPACEEXTENSIBLEGROUP_HPP
87