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 * 2017 Ell 18 */ 19 20 #ifndef __GEGL_VISITOR_H__ 21 #define __GEGL_VISITOR_H__ 22 23 G_BEGIN_DECLS 24 25 26 #define GEGL_TYPE_VISITOR (gegl_visitor_get_type ()) 27 #define GEGL_VISITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_VISITOR, GeglVisitor)) 28 #define GEGL_VISITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_VISITOR, GeglVisitorClass)) 29 #define GEGL_IS_VISITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_VISITOR)) 30 #define GEGL_IS_VISITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_VISITOR)) 31 #define GEGL_VISITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_VISITOR, GeglVisitorClass)) 32 33 34 typedef struct _GeglVisitorClass GeglVisitorClass; 35 36 struct _GeglVisitor 37 { 38 GObject parent_instance; 39 }; 40 41 struct _GeglVisitorClass 42 { 43 GObjectClass parent_class; 44 45 /* these functions return TRUE to stop traversal, FALSE to continue */ 46 gboolean (* visit_pad) (GeglVisitor *self, 47 GeglPad *pad); 48 gboolean (* visit_node) (GeglVisitor *self, 49 GeglNode *node); 50 }; 51 52 53 GType gegl_visitor_get_type (void) G_GNUC_CONST; 54 55 gboolean gegl_visitor_visit_pad (GeglVisitor *self, 56 GeglPad *pad); 57 gboolean gegl_visitor_visit_node (GeglVisitor *self, 58 GeglNode *node); 59 60 gboolean gegl_visitor_traverse (GeglVisitor *self, 61 GeglVisitable *visitable); 62 gboolean gegl_visitor_traverse_topological (GeglVisitor *self, 63 GeglVisitable *visitable); 64 gboolean gegl_visitor_traverse_reverse_topological (GeglVisitor *self, 65 GeglVisitable *visitable); 66 67 68 G_END_DECLS 69 70 #endif /* __GEGL_VISITOR_H__ */ 71