BRL-CAD
visit.h
Go to the documentation of this file.
1 /* V I S I T . H
2  * BRL-CAD
3  *
4  * Copyright (c) 2022-2024 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @addtogroup nmg_visit
21  */
22 /** @{ */
23 /** @file nmg/visit.h */
24 
25 #ifndef NMG_VISIT_H
26 #define NMG_VISIT_H
27 
28 #include "common.h"
29 #include "vmath.h"
30 #include "bu/list.h"
31 #include "nmg/defines.h"
32 #include "nmg/model.h"
33 
34 __BEGIN_DECLS
35 
36 /**
37  * Function table, for use with nmg_visit().
38  *
39  * Intended to have same generally the organization as
40  * nmg_struct_counts. The handler's args are long* to allow generic
41  * handlers to be written, in which case the magic number at long*
42  * specifies the object type.
43  *
44  * The "vis_" prefix means the handler is visited only once. The
45  * "bef_" and "aft_" prefixes are called (respectively) before and
46  * after recursing into subsidiary structures. The 3rd arg is 0 for a
47  * "bef_" call, and 1 for an "aft_" call, to allow generic handlers to
48  * be written, if desired.
49  */
51  void (*bef_model)(uint32_t *, void *, int);
52  void (*aft_model)(uint32_t *, void *, int);
53 
54  void (*bef_region)(uint32_t *, void *, int);
55  void (*aft_region)(uint32_t *, void *, int);
56 
57  void (*vis_region_a)(uint32_t *, void *, int);
58 
59  void (*bef_shell)(uint32_t *, void *, int);
60  void (*aft_shell)(uint32_t *, void *, int);
61 
62  void (*vis_shell_a)(uint32_t *, void *, int);
63 
64  void (*bef_faceuse)(uint32_t *, void *, int);
65  void (*aft_faceuse)(uint32_t *, void *, int, struct bu_list *);
66 
67  void (*vis_face)(uint32_t *, void *, int);
68  void (*vis_face_g)(uint32_t *, void *, int);
69 
70  void (*bef_loopuse)(uint32_t *, void *, int);
71  void (*aft_loopuse)(uint32_t *, void *, int);
72 
73  void (*vis_loop)(uint32_t *, void *, int);
74  void (*vis_loop_a)(uint32_t *, void *, int);
75 
76  void (*bef_edgeuse)(uint32_t *, void *, int);
77  void (*aft_edgeuse)(uint32_t *, void *, int);
78 
79  void (*vis_edge)(uint32_t *, void *, int);
80  void (*vis_edge_g)(uint32_t *, void *, int);
81 
82  void (*bef_vertexuse)(uint32_t *, void *, int);
83  void (*aft_vertexuse)(uint32_t *, void *, int);
84 
85  void (*vis_vertexuse_a)(uint32_t *, void *, int);
86  void (*vis_vertex)(uint32_t *, void *, int);
87  void (*vis_vertex_g)(uint32_t *, void *, int);
88 };
89 
90 /* nmg_visit.c */
91 NMG_EXPORT extern void nmg_visit_vertex(struct vertex *v,
92  const struct nmg_visit_handlers *htab,
93  void * state);
94 NMG_EXPORT extern void nmg_visit_vertexuse(struct vertexuse *vu,
95  const struct nmg_visit_handlers *htab,
96  void * state);
97 NMG_EXPORT extern void nmg_visit_edge(struct edge *e,
98  const struct nmg_visit_handlers *htab,
99  void * state);
100 NMG_EXPORT extern void nmg_visit_edgeuse(struct edgeuse *eu,
101  const struct nmg_visit_handlers *htab,
102  void * state);
103 NMG_EXPORT extern void nmg_visit_loop(struct loop *l,
104  const struct nmg_visit_handlers *htab,
105  void * state);
106 NMG_EXPORT extern void nmg_visit_loopuse(struct loopuse *lu,
107  const struct nmg_visit_handlers *htab,
108  void * state);
109 NMG_EXPORT extern void nmg_visit_face(struct face *f,
110  const struct nmg_visit_handlers *htab,
111  void * state);
112 NMG_EXPORT extern void nmg_visit_faceuse(struct faceuse *fu,
113  const struct nmg_visit_handlers *htab,
114  void * state,
115  struct bu_list *vlfree);
116 NMG_EXPORT extern void nmg_visit_shell(struct shell *s,
117  const struct nmg_visit_handlers *htab,
118  void * state,
119  struct bu_list *vlfree);
120 NMG_EXPORT extern void nmg_visit_region(struct nmgregion *r,
121  const struct nmg_visit_handlers *htab,
122  void * state,
123  struct bu_list *vlfree);
124 NMG_EXPORT extern void nmg_visit_model(struct model *model,
125  const struct nmg_visit_handlers *htab,
126  void * state,
127  struct bu_list *vlfree);
128 NMG_EXPORT extern void nmg_visit(const uint32_t *magicp,
129  const struct nmg_visit_handlers *htab,
130  void * state,
131  struct bu_list *vlfree);
132 
133 
134 __END_DECLS
135 
136 #endif /* NMG_VISIT_H */
137 /** @} */
138 /*
139  * Local Variables:
140  * tab-width: 8
141  * mode: C
142  * indent-tabs-mode: t
143  * c-file-style: "stroustrup"
144  * End:
145  * ex: shiftwidth=4 tabstop=8
146  */
Header file for the BRL-CAD common definitions.
void nmg_visit_edge(struct edge *e, const struct nmg_visit_handlers *htab, void *state)
void nmg_visit_vertex(struct vertex *v, const struct nmg_visit_handlers *htab, void *state)
void nmg_visit_loop(struct loop *l, const struct nmg_visit_handlers *htab, void *state)
void nmg_visit_faceuse(struct faceuse *fu, const struct nmg_visit_handlers *htab, void *state, struct bu_list *vlfree)
void nmg_visit_shell(struct shell *s, const struct nmg_visit_handlers *htab, void *state, struct bu_list *vlfree)
void nmg_visit_model(struct model *model, const struct nmg_visit_handlers *htab, void *state, struct bu_list *vlfree)
void nmg_visit_vertexuse(struct vertexuse *vu, const struct nmg_visit_handlers *htab, void *state)
void nmg_visit_face(struct face *f, const struct nmg_visit_handlers *htab, void *state)
void nmg_visit(const uint32_t *magicp, const struct nmg_visit_handlers *htab, void *state, struct bu_list *vlfree)
void nmg_visit_region(struct nmgregion *r, const struct nmg_visit_handlers *htab, void *state, struct bu_list *vlfree)
void nmg_visit_edgeuse(struct edgeuse *eu, const struct nmg_visit_handlers *htab, void *state)
void nmg_visit_loopuse(struct loopuse *lu, const struct nmg_visit_handlers *htab, void *state)
Definition: list.h:132
NMG topological edge.
Definition: topology.h:144
NMG topological edge usage.
Definition: topology.h:155
NMG topological face.
Definition: topology.h:210
NMG topological face usage.
Definition: topology.h:230
NMG topological loop.
Definition: topology.h:181
NMG topological loop usage.
Definition: topology.h:192
NMG topological model.
Definition: topology.h:289
void(* aft_edgeuse)(uint32_t *, void *, int)
Definition: visit.h:77
void(* bef_region)(uint32_t *, void *, int)
Definition: visit.h:54
void(* bef_vertexuse)(uint32_t *, void *, int)
Definition: visit.h:82
void(* vis_vertex_g)(uint32_t *, void *, int)
Definition: visit.h:87
void(* bef_shell)(uint32_t *, void *, int)
Definition: visit.h:59
void(* vis_face)(uint32_t *, void *, int)
Definition: visit.h:67
void(* vis_vertex)(uint32_t *, void *, int)
Definition: visit.h:86
void(* bef_loopuse)(uint32_t *, void *, int)
Definition: visit.h:70
void(* aft_loopuse)(uint32_t *, void *, int)
Definition: visit.h:71
void(* vis_loop)(uint32_t *, void *, int)
Definition: visit.h:73
void(* vis_loop_a)(uint32_t *, void *, int)
Definition: visit.h:74
void(* aft_shell)(uint32_t *, void *, int)
Definition: visit.h:60
void(* aft_model)(uint32_t *, void *, int)
Definition: visit.h:52
void(* aft_vertexuse)(uint32_t *, void *, int)
Definition: visit.h:83
void(* bef_edgeuse)(uint32_t *, void *, int)
Definition: visit.h:76
void(* vis_edge_g)(uint32_t *, void *, int)
Definition: visit.h:80
void(* bef_faceuse)(uint32_t *, void *, int)
Definition: visit.h:64
void(* aft_faceuse)(uint32_t *, void *, int, struct bu_list *)
Definition: visit.h:65
void(* vis_face_g)(uint32_t *, void *, int)
Definition: visit.h:68
void(* vis_shell_a)(uint32_t *, void *, int)
Definition: visit.h:62
void(* vis_region_a)(uint32_t *, void *, int)
Definition: visit.h:57
void(* bef_model)(uint32_t *, void *, int)
Definition: visit.h:51
void(* aft_region)(uint32_t *, void *, int)
Definition: visit.h:55
void(* vis_vertexuse_a)(uint32_t *, void *, int)
Definition: visit.h:85
void(* vis_edge)(uint32_t *, void *, int)
Definition: visit.h:79
NMG topological region.
Definition: topology.h:277
NMG topological shell.
Definition: topology.h:261
NMG topological vertex - the simplest element of the topology system.
Definition: topology.h:98
NMG topological vertex usage.
Definition: topology.h:109
fundamental vector, matrix, quaternion math macros