Ardour  8.12
graph_edges.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2022 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef __ardour_route_graph_h__
20 #define __ardour_route_graph_h__
21 
22 #include <map>
23 #include <set>
24 
26 #include "ardour/types.h"
27 
28 namespace ARDOUR {
29 class GraphNode;
30 
31 typedef std::shared_ptr<GraphNode> GraphVertex;
32 
43 {
44 public:
45  void add (GraphVertex from, GraphVertex to, bool via_sends_only);
46  void remove (GraphVertex from, GraphVertex to);
47 
48  bool has (GraphVertex from, GraphVertex to, bool* via_sends_only);
49  bool feeds (GraphVertex from, GraphVertex to) const;
51  std::set<GraphVertex> from (GraphVertex r) const;
53  std::set<GraphVertex> to (GraphVertex r, bool via_sends_only = false) const;
54  bool has_none_to (GraphVertex to) const;
55  bool empty () const;
56  void dump () const;
57 
58 private:
59  typedef std::map<GraphVertex, std::set<GraphVertex> > EdgeMap;
60  typedef std::multimap<GraphVertex, std::pair<GraphVertex, bool> > EdgeMapWithSends;
61 
63 
64  EdgeMapWithSends::iterator find_in_from_to_with_sends (GraphVertex, GraphVertex);
65  EdgeMapWithSends::iterator find_in_to_from_with_sends (GraphVertex, GraphVertex);
66 
67  EdgeMapWithSends::const_iterator find_recursively_in_from_to_with_sends (GraphVertex, GraphVertex) const;
68 
79 };
80 
82 
83 }
84 
85 #endif
std::set< GraphVertex > to(GraphVertex r, bool via_sends_only=false) const
std::multimap< GraphVertex, std::pair< GraphVertex, bool > > EdgeMapWithSends
Definition: graph_edges.h:60
bool has(GraphVertex from, GraphVertex to, bool *via_sends_only)
std::set< GraphVertex > from(GraphVertex r) const
EdgeMapWithSends::iterator find_in_to_from_with_sends(GraphVertex, GraphVertex)
bool has_none_to(GraphVertex to) const
std::map< GraphVertex, std::set< GraphVertex > > EdgeMap
Definition: graph_edges.h:59
EdgeMapWithSends::iterator find_in_from_to_with_sends(GraphVertex, GraphVertex)
EdgeMapWithSends _from_to_with_sends
Definition: graph_edges.h:77
bool feeds(GraphVertex from, GraphVertex to) const
bool empty() const
void dump() const
EdgeMapWithSends _to_from_with_sends
Definition: graph_edges.h:78
void insert(EdgeMap &e, GraphVertex a, GraphVertex b)
void add(GraphVertex from, GraphVertex to, bool via_sends_only)
EdgeMapWithSends::const_iterator find_recursively_in_from_to_with_sends(GraphVertex, GraphVertex) const
void remove(GraphVertex from, GraphVertex to)
A node in the hierarchical graph that represents a multiplicatable export item.
#define LIBARDOUR_API
bool topological_sort(GraphNodeList &, GraphEdges &)
std::shared_ptr< GraphNode > GraphVertex
Definition: graph_edges.h:29
std::list< std::shared_ptr< GraphNode > > GraphNodeList