VPTissue Reference Manual
IViewerNode.h
Go to the documentation of this file.
1 #ifndef VIEWER_IVIEWERNODE_H_INCLUDED
2 #define VIEWER_IVIEWERNODE_H_INCLUDED
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
21 #include "event/ViewerEvent.h"
22 #include "util/misc/Subject.h"
23 
24 namespace SimShell {
25 namespace Viewer {
26 
31 class IViewerNode : public SimPT_Sim::Util::Subject<Event::ViewerEvent, std::weak_ptr<const void>>
32 {
33 public:
34  typedef std::map<std::string, std::shared_ptr<IViewerNode>> ChildrenMap;
35 
37  virtual ~IViewerNode() {}
38 
40  virtual void Disable() = 0;
41 
43  virtual void Enable() = 0;
44 
48  virtual bool IsEnabled() const = 0;
49 
51  virtual bool IsParentEnabled() const = 0;
52 
54  virtual ChildrenMap::const_iterator begin() const = 0;
55 
57  virtual ChildrenMap::const_iterator end() const = 0;
58 };
59 
63 template <class SubjectType>
65 {
66 public:
69 
71  virtual void ParentDisabled() = 0;
72 
74  virtual void ParentEnabled(std::shared_ptr<SubjectType>) = 0;
75 };
76 
77 } // namespace
78 } // namespace
79 
80 #endif // end_of_inclde_guard
virtual void Enable()=0
Enable node.
virtual bool IsEnabled() const =0
Test whether node is enabled.
virtual ~IViewerNodeWithParent()
Virtual destructor.
Definition: IViewerNode.h:68
Interface for a node in a hierarchical tree of viewers.
Definition: IViewerNode.h:31
virtual void ParentDisabled()=0
Enable entire subtree.
virtual ChildrenMap::const_iterator end() const =0
Get iterator pointing to one position after last child.
Interface/Implementation of Subject.
virtual bool IsParentEnabled() const =0
Test whether parent node is enabled.
virtual ~IViewerNode()
Virtual destructor.
Definition: IViewerNode.h:37
Subject in Observer pattern.
Definition: Subject.h:34
virtual void Disable()=0
Disable node.
Interface for ViewerEvent.
virtual ChildrenMap::const_iterator begin() const =0
Get iterator pointing to first child.
Namespace for generic graphical shell for simulators.
Definition: SimSession.h:32
virtual void ParentEnabled(std::shared_ptr< SubjectType >)=0
Disable entire subtree.
A viewer node with a parent.
Definition: IViewerNode.h:64