GCC Code Coverage Report


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

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