bpp-phyl3  3.0.0
TopologySearch.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_PHYL_TREE_TOPOLOGYSEARCH_H
6 #define BPP_PHYL_TREE_TOPOLOGYSEARCH_H
7 
8 #include <Bpp/Clonable.h>
9 #include <Bpp/Exceptions.h>
10 
11 
12 // From the STL:
13 #include <string>
14 #include <vector>
15 
16 namespace bpp
17 {
22 {
23 protected:
24  std::string message_;
25 
26 public:
28  TopologyChangeEvent(const std::string& message) : message_(message) {}
29  virtual ~TopologyChangeEvent() {}
30 
31 public:
37  virtual const std::string& getMessage() const { return message_; }
38 };
39 
40 class TopologySearch;
41 
47  public virtual Clonable
48 {
49 public:
51  virtual ~TopologyListener() {}
52 
53  TopologyListener* clone() const = 0;
54 
55 public:
67  virtual void topologyChangePerformed(const TopologyChangeEvent& event)
68  {
69  topologyChangeTested(event);
71  }
72 
78  virtual void topologyChangeTested(const TopologyChangeEvent& event) = 0;
79 
87  virtual void topologyChangeSuccessful(const TopologyChangeEvent& event) = 0;
88 };
89 
90 
95 {
96 public:
98  virtual ~TopologySearch() {}
99 
100 public:
104  virtual void search() = 0;
105 
111  virtual void addTopologyListener(std::shared_ptr<TopologyListener> listener) = 0;
112 };
113 } // end of namespace bpp.
114 #endif // BPP_PHYL_TREE_TOPOLOGYSEARCH_H
Class for notifying new toplogy change events.
virtual const std::string & getMessage() const
Get the message associated to this event.
TopologyChangeEvent(const std::string &message)
Implement this interface to be notified when the topology of a tree has changed during topology searc...
virtual void topologyChangeTested(const TopologyChangeEvent &event)=0
Notify a topology change event.
virtual void topologyChangePerformed(const TopologyChangeEvent &event)
Notify a topology change event.
TopologyListener * clone() const =0
virtual void topologyChangeSuccessful(const TopologyChangeEvent &event)=0
Tell that a topology change is definitive.
Interface for topology search methods.
virtual ~TopologySearch()
virtual void search()=0
Performs the search.
virtual void addTopologyListener(std::shared_ptr< TopologyListener > listener)=0
Add a topology listener to this class.
Defines the basic types of data flow nodes.