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/ComponentWatcher.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_COMPONENTWATCHER_HPP
7 #define MODEL_COMPONENTWATCHER_HPP
8
9 #include "ModelAPI.hpp"
10
11 #include <memory>
12 #include <vector>
13
14 namespace openstudio {
15 namespace model {
16
17 class ComponentData;
18
19 namespace detail {
20 class Model_Impl;
21 class ComponentWatcher_Impl;
22 } // namespace detail
23
24 /** ComponentWatcher uses signals and slots to monitor the data associated with a Component.
25 * \link ComponentWatcher ComponentWatchers \endlink are constructed by \link Model Models
26 * \endlink and \link Component Components\endlink. They are not for general (public) use.
27 * If data changes, ComponentWatcher calls componentData.createVersionUUID. The Component is
28 * destroyed (ComponentData is removed from the model) if the user removes ComponentData or
29 * the primary object, or if the relationship between objects in the component changes. */
30 class MODEL_API ComponentWatcher
31 {
32 public:
33 /** @name Constructors and Destructors */
34 //@{
35
36 // ETH@20110615 This constructor should probably be protected, with Model (etc.) as a friend.
37 ComponentWatcher(ComponentData& componentData);
38
39 2719 virtual ~ComponentWatcher() = default;
40 // Default the copy and move operators because the virtual dtor is explicit
41 869 ComponentWatcher(const ComponentWatcher& other) = default;
42 975 ComponentWatcher(ComponentWatcher&& other) = default;
43 ✗ ComponentWatcher& operator=(const ComponentWatcher&) = default;
44 ✗ ComponentWatcher& operator=(ComponentWatcher&&) = default;
45
46 //@}
47 /** @name Getters */
48 //@{
49
50 ComponentData componentData() const;
51
52 //@}
53 /** @name Queries */
54 //@{
55
56 bool operator==(const ComponentWatcher& other);
57
58 bool operator!=(const ComponentWatcher& other);
59
60 //@}
61 protected:
62 /// @cond
63 using ImplType = detail::ComponentWatcher_Impl;
64
65 friend class detail::Model_Impl;
66 friend class detail::ComponentWatcher_Impl;
67
68 std::shared_ptr<detail::ComponentWatcher_Impl> getImpl() const;
69
70 ComponentWatcher(std::shared_ptr<detail::ComponentWatcher_Impl> impl);
71
72 /// @endcond
73 private:
74 std::shared_ptr<detail::ComponentWatcher_Impl> m_impl;
75 };
76
77 /** \relates ComponentWatcher */
78 using ComponentWatcherVector = std::vector<ComponentWatcher>;
79
80 } // namespace model
81 } // namespace openstudio
82
83 #endif // MODEL_COMPONENTWATCHER_HPP
84