GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 45.5% 5 / 0 / 11
Functions: 57.1% 4 / 0 / 7
Branches: 45.0% 9 / 0 / 20

src/alfalfa/AlfalfaComponent.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 ALFALFA_COMPONENT_HPP
7 #define ALFALFA_COMPONENT_HPP
8
9 #include <json/json.h>
10 #include <type_traits>
11
12 #include "AlfalfaAPI.hpp"
13 #include "AlfalfaComponentBase.hpp"
14
15 namespace openstudio {
16 namespace alfalfa {
17 class ALFALFA_API AlfalfaComponent
18 {
19 public:
20 109 AlfalfaComponent(const AlfalfaComponentBase& component) : m_component(component.clone()) {}
21
22 293 AlfalfaComponent(const AlfalfaComponent& other) : m_component(other.m_component->clone()) {}
23
24 ✗ AlfalfaComponent(AlfalfaComponent&&) noexcept = default;
25
26 402 ~AlfalfaComponent() = default;
27
28 ✗ AlfalfaComponent& operator=(const AlfalfaComponent& other) {
29 ✗ if (this != &other) {
30 ✗ m_component = other.m_component->clone();
31 }
32 ✗ return *this;
33 }
34
35 ✗ AlfalfaComponent& operator=(AlfalfaComponent&&) noexcept = default;
36
37 Json::Value toJSON() const;
38
39 AlfalfaComponentCapability capability() const;
40
41 AlfalfaComponentType type() const;
42
43 std::string typeName() const;
44
45 std::string deriveName() const;
46
47 bool canInput() const;
48
49 bool canOutput() const;
50
51 private:
52 AlfalfaComponent() = default;
53 std::unique_ptr<AlfalfaComponentBase> m_component;
54 };
55
56 12 inline bool operator==(const AlfalfaComponent& lhs, const AlfalfaComponent& rhs) {
57
9/17
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 12 times.
✓ Branch 13 taken 12 times.
✓ Branch 16 taken 12 times.
✓ Branch 18 taken 12 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 12 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 12 times.
✗ Branch 24 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
12 return (lhs.type() == rhs.type() && lhs.toJSON() == rhs.toJSON());
58 }
59 } // namespace alfalfa
60 } // namespace openstudio
61
62 #endif
63