1 /* This file is part of GEGL
2  *
3  * GEGL is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 3 of the License, or (at your option) any later version.
7  *
8  * GEGL is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with GEGL; if not, see <https://www.gnu.org/licenses/>.
15  *
16  * Copyright 2003 Calvin Williamson
17  */
18 
19 #include "config.h"
20 #include <glib-object.h>
21 
22 #include "gegl.h"
23 #include "gegl-types-internal.h"
24 #include "gegl-connection.h"
25 
26 
27 struct _GeglConnection
28 {
29   GeglNode *sink;
30   GeglPad  *sink_pad;
31 
32   GeglNode *source;
33   GeglPad  *source_pad;
34 
35   /*XXX: here is a nice place to store the negotiated Pixel Format representation */
36 };
37 
38 GeglConnection *
gegl_connection_new(GeglNode * sink,GeglPad * sink_pad,GeglNode * source,GeglPad * source_pad)39 gegl_connection_new (GeglNode *sink,
40                      GeglPad  *sink_pad,
41                      GeglNode *source,
42                      GeglPad  *source_pad)
43 {
44   GeglConnection *self = g_slice_new0 (GeglConnection);
45 
46   self->sink       = sink;
47   self->sink_pad   = sink_pad;
48   self->source     = source;
49   self->source_pad = source_pad;
50 
51   return self;
52 }
53 
54 void
gegl_connection_destroy(GeglConnection * self)55 gegl_connection_destroy (GeglConnection *self)
56 {
57   g_slice_free (GeglConnection, self);
58 }
59 
60 GeglNode *
gegl_connection_get_source_node(GeglConnection * self)61 gegl_connection_get_source_node (GeglConnection *self)
62 {
63   return self->source;
64 }
65 
66 void
gegl_connection_set_source_node(GeglConnection * self,GeglNode * source)67 gegl_connection_set_source_node (GeglConnection *self,
68                                  GeglNode       *source)
69 {
70   self->source = source;
71 }
72 
73 GeglNode *
gegl_connection_get_sink_node(GeglConnection * self)74 gegl_connection_get_sink_node (GeglConnection *self)
75 {
76   return self->sink;
77 }
78 
79 void
gegl_connection_set_sink_node(GeglConnection * self,GeglNode * sink)80 gegl_connection_set_sink_node (GeglConnection *self,
81                                GeglNode       *sink)
82 {
83   self->sink = sink;
84 }
85 
86 GeglPad *
gegl_connection_get_sink_pad(GeglConnection * self)87 gegl_connection_get_sink_pad (GeglConnection *self)
88 {
89   return self->sink_pad;
90 }
91 
92 void
gegl_connection_set_sink_pad(GeglConnection * self,GeglPad * sink_pad)93 gegl_connection_set_sink_pad (GeglConnection *self,
94                               GeglPad        *sink_pad)
95 {
96   self->sink_pad = sink_pad;
97 }
98 
99 GeglPad *
gegl_connection_get_source_pad(GeglConnection * self)100 gegl_connection_get_source_pad (GeglConnection *self)
101 {
102   return self->source_pad;
103 }
104 
105 void
gegl_connection_set_source_pad(GeglConnection * self,GeglPad * source_pad)106 gegl_connection_set_source_pad (GeglConnection *self,
107                                 GeglPad        *source_pad)
108 {
109   self->source_pad = source_pad;
110 }
111