1 #ifndef VIEWER_SUBJECTNODE_H_INCLUDED
2 #define VIEWER_SUBJECTNODE_H_INCLUDED
26 #include <type_traits>
40 template <
class SubjectType>
44 SubjectNode(std::shared_ptr<Ws::MergedPreferences> p,
45 std::shared_ptr<SubjectType> s,
46 IViewerNode::ChildrenMap&& c);
48 SubjectNode(std::shared_ptr<Ws::MergedPreferences> p,
49 std::shared_ptr<SubjectType> s);
61 virtual IViewerNode::ChildrenMap::const_iterator
begin()
const;
63 virtual IViewerNode::ChildrenMap::const_iterator
end()
const;
66 std::shared_ptr<Ws::MergedPreferences> m_preferences;
67 std::shared_ptr<SubjectType> m_subject;
68 IViewerNode::ChildrenMap m_children;
72 template <
class FakeSubjectType>
81 virtual void Disable() { m_node->Disable(); }
83 virtual void Enable() { m_node->Enable(); }
85 virtual bool IsEnabled()
const {
return m_node->IsEnabled(); }
89 virtual IViewerNode::ChildrenMap::const_iterator
begin()
const {
return m_node->begin(); }
91 virtual IViewerNode::ChildrenMap::const_iterator
end()
const {
return m_node->end(); }
101 std::shared_ptr<IViewerNode> m_node;
105 template <
class SubjectType>
106 SubjectNode<SubjectType>::SubjectNode(std::shared_ptr<Ws::MergedPreferences> p,
107 std::shared_ptr<SubjectType> s,
108 IViewerNode::ChildrenMap&& c)
112 m_enabled(m_preferences->Get<bool>(
"enabled_at_startup"))
118 template <
class SubjectType>
119 SubjectNode<SubjectType>::SubjectNode(std::shared_ptr<Ws::MergedPreferences> p,
120 std::shared_ptr<SubjectType> s)
123 m_enabled(m_preferences->Get<bool>(
"enabled_at_startup"))
129 template <
class SubjectType>
133 for (
auto& child: m_children) {
135 (child.second)->ParentDisabled();
140 template <
class SubjectType>
145 for (
auto& child: m_children) {
147 (child.second)->ParentEnabled(m_subject);
151 template <
class SubjectType>
157 template <
class SubjectType>
163 template <
class SubjectType>
166 return m_children.begin();
169 template <
class SubjectType>
172 return m_children.end();
178 #endif // end_of_inclde_guard
virtual IViewerNode::ChildrenMap::const_iterator begin() const
Get iterator pointing to first child.
virtual void Enable()
Enable node.
virtual void ParentEnabled(std::shared_ptr< FakeSubjectType >)
Interface for a node in a hierarchical tree of viewers.
virtual IViewerNode::ChildrenMap::const_iterator end() const
Get iterator pointing to one position after last child.
virtual bool IsEnabled() const
Test whether node is enabled.
virtual void Enable()
Enable node.
virtual IViewerNode::ChildrenMap::const_iterator begin() const
Get iterator pointing to first child.
virtual bool IsParentEnabled() const
Test whether parent node is enabled.
virtual void ParentDisabled()
virtual void Disable()
Disable node.
virtual void Disable()
Disable node.
Interface for MergedPreferences.
virtual bool IsEnabled() const
Test whether node is enabled.
virtual IViewerNode::ChildrenMap::const_iterator end() const
Get iterator pointing to one position after last child.
Namespace for generic graphical shell for simulators.
virtual bool IsParentEnabled() const
Test whether parent node is enabled.
A viewer node that does not represent a viewer at all.
Interface for IViewerNode.
A viewer node with a parent.