add missing graph.cc and friends :S
[ardour.git] / libs / ardour / graphnode.cc
1
2 #include "ardour/graph.h"
3 #include "ardour/graphnode.h"
4 #include "ardour/route.h"
5
6 using namespace ARDOUR;
7
8 // ========================================== GraphNode
9
10 GraphNode::GraphNode( graph_ptr_t graph )
11   : _graph(graph)
12 { }
13
14 void
15 GraphNode::prep( int chain )
16 {
17     _refcount = _init_refcount[chain];
18 }
19
20 void
21 GraphNode::dec_ref()
22 {
23     if (g_atomic_int_dec_and_test( &_refcount ))
24         _graph->trigger( this );
25 }
26
27 void
28 GraphNode::finish( int chain )
29 {
30     node_set_t::iterator i;
31     bool feeds_somebody = false;
32     for (i=_activation_set[chain].begin(); i!=_activation_set[chain].end(); i++)
33     {
34         (*i)->dec_ref();
35         feeds_somebody = true;
36     }
37     if (!feeds_somebody)
38     {
39         _graph->dec_ref();
40     }
41 }
42
43
44 void
45 GraphNode::process()
46 {
47     _graph->process_one_route( dynamic_cast<Route *>(this) );
48 }