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/model/Splitter_Impl.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_SPLITTER_IMPL_HPP
7 #define MODEL_SPLITTER_IMPL_HPP
8
9 #include "HVACComponent_Impl.hpp"
10
11 namespace openstudio {
12
13 namespace model {
14
15 namespace detail {
16
17 class MODEL_API Splitter_Impl : public HVACComponent_Impl
18 {
19 public:
20 Splitter_Impl(IddObjectType type, Model_Impl* model);
21
22 Splitter_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle);
23
24 Splitter_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle);
25
26 Splitter_Impl(const Splitter_Impl& other, Model_Impl* model, bool keepHandles);
27
28 2748 virtual ~Splitter_Impl() override = default;
29
30 /** Returns the inlet port to the splitter. */
31 virtual unsigned inletPort() const = 0;
32
33 /** Returns the outlet port for branchIndex. Branches consequtively
34 * indexed starting from 0.
35 */
36 virtual unsigned outletPort(unsigned branchIndex) const = 0;
37
38 /** Returns the next available outlet port. This will be the first port
39 * with no connected objects */
40 virtual unsigned nextOutletPort() const = 0;
41
42 virtual std::vector<HVACComponent> edges(const boost::optional<HVACComponent>& prev) override;
43
44 /** Returns the optional ModelObject connected to the inlet port.
45 * If there is no connected object then the optional will be false.
46 */
47 boost::optional<ModelObject> inletModelObject() const;
48
49 /** Returns the optional ModelObject connected to the branch designated by branchIndex.
50 * If there is no connected object then the optional will be false.
51 */
52 boost::optional<ModelObject> outletModelObject(unsigned branchIndex) const;
53
54 /** Returns the optional ModelObject connected to the last branch of the splitter.
55 * If there are no connections to the splitter's outlet ports, then the
56 * optional will be false.
57 */
58 boost::optional<ModelObject> lastOutletModelObject() const;
59
60 /** Returns a vector of all objects connected to the splitter's outlet ports.
61 * If no objects are connected to the splitter then an empty vector will be returned.
62 */
63 std::vector<ModelObject> outletModelObjects() const;
64
65 /** Returns a new port after the branch specified by branchIndex */
66 unsigned newOutletPortAfterBranch(unsigned branchIndex);
67
68 /** Returns the branch index for the ModelObject specified by modelObject.
69 * The specified object must be connected to an outlet port of the splitter.
70 */
71 unsigned branchIndexForOutletModelObject(ModelObject modelObject) const;
72
73 /** Returns the index of the next available branch */
74 unsigned nextBranchIndex() const;
75
76 /** Effectively disconnects anything connected to the outlet port
77 * at the specified branch index. All branches after the specified
78 * branch index are moved to the next lower branch index, thereby
79 * removing any unconnected ports between branches.
80 */
81 void removePortForBranch(unsigned branchIndex);
82
83 bool isRemovable() const override;
84
85 void disconnect() override;
86
87 private:
88 REGISTER_LOGGER("openstudio.model.Splitter");
89 };
90
91 } // namespace detail
92
93 } // namespace model
94
95 } // namespace openstudio
96
97 #endif
98