BRL-CAD
database.h
Go to the documentation of this file.
1 /* D A T A B A S E . H
2  * BRL-CAD
3  *
4  * Copyright (c) 2008-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 ged_database
21  *
22  * Geometry EDiting Library Database Level Functions.
23  *
24  */
25 /** @{ */
26 /** @file ged/database.h */
27 
28 #ifndef GED_DATABASE_H
29 #define GED_DATABASE_H
30 
31 #include "common.h"
32 #include "ged/defines.h"
33 
34 __BEGIN_DECLS
35 
36 /** Check if a database is open */
37 #define GED_CHECK_DATABASE_OPEN(_gedp, _flags) \
38  if ((_gedp) == GED_NULL || (_gedp)->dbip == DBI_NULL) { \
39  int ged_check_database_open_quiet = (_flags) & GED_QUIET; \
40  if (!ged_check_database_open_quiet) { \
41  if ((_gedp) != GED_NULL) { \
42  bu_vls_trunc((_gedp)->ged_result_str, 0); \
43  bu_vls_printf((_gedp)->ged_result_str, "A database is not open!"); \
44  } else {\
45  bu_log("A database is not open!\n"); \
46  } \
47  } \
48  return (_flags); \
49  }
50 
51 /**
52  * Set/get the database title
53  */
54 GED_EXPORT extern int ged_title(struct ged *gedp, int argc, const char *argv[]);
55 
56 
57 /**
58  * Return a count of objects displayed
59  */
60 GED_EXPORT extern size_t ged_who_argc(struct ged *gedp);
61 
62 /**
63  * Return a list of names of objects displayed
64  */
65 GED_EXPORT extern int ged_who_argv(struct ged *gedp, char **start, const char **end);
66 
67 
68 /**
69  * Find all top level objects
70  */
71 GED_EXPORT extern int ged_tops(struct ged *gedp, int argc, const char *argv[]);
72 
73 /**
74  * Get dbip
75  */
76 GED_EXPORT extern int ged_dbip(struct ged *gedp, int argc, const char *argv[]);
77 
78 
79 /**
80  * Dump a full copy of the database into file.g
81  */
82 GED_EXPORT extern int ged_dump(struct ged *gedp, int argc, const char *argv[]);
83 
84 /**
85  * Find combinations that reference object
86  */
87 GED_EXPORT extern int ged_find(struct ged *gedp, int argc, const char *argv[]);
88 
89 /**
90  * Globs expression against the database
91  */
92 GED_EXPORT extern int ged_glob(struct ged *gedp, int argc, const char *argv[]);
93 
94 /**
95  * Import a database into the current database using an auto-incrementing or custom affix
96  */
97 GED_EXPORT extern int ged_concat(struct ged *gedp, int argc, const char *argv[]);
98 
99 /**
100  * Check for duplicate names in file
101  */
102 GED_EXPORT extern int ged_dup(struct ged *gedp, int argc, const char *argv[]);
103 
104 /**
105  * Text edit the color table
106  */
107 GED_EXPORT extern int ged_edcolor(struct ged *gedp, int argc, const char *argv[]);
108 
109 /**
110  * Edit file.
111  */
112 GED_EXPORT extern int ged_editit(struct ged *gedp, int argc, const char *argv[]);
113 
114 /**
115  * List the objects in this database
116  */
117 GED_EXPORT extern int ged_ls(struct ged *gedp, int argc, const char *argv[]);
118 
119 /**
120  * List all paths from name(s) to leaves
121  */
122 GED_EXPORT extern int ged_pathlist(struct ged *gedp, int argc, const char *argv[]);
123 
124 /**
125  * Lists all paths matching the input path
126  */
127 GED_EXPORT extern int ged_pathsum(struct ged *gedp, int argc, const char *argv[]);
128 
129 /**
130  * Show the matrix transformations along path
131  */
132 GED_EXPORT extern int ged_showmats(struct ged *gedp, int argc, const char *argv[]);
133 
134 /**
135  * Checks that each directory in the supplied path actually has the subdirectories
136  * that are implied by the path.
137  */
138 GED_EXPORT extern int ged_path_validate(struct ged *gedp, const struct db_full_path * const path);
139 
140 /**
141  * Returns a list of id to region name mappings for the entire database.
142  */
143 GED_EXPORT extern int ged_rmap(struct ged *gedp, int argc, const char *argv[]);
144 
145 /**
146  * Set/get tessellation and calculation tolerances
147  */
148 GED_EXPORT extern int ged_tol(struct ged *gedp, int argc, const char *argv[]);
149 
150 /**
151  * Set/get the database units
152  */
153 GED_EXPORT extern int ged_units(struct ged *gedp, int argc, const char *argv[]);
154 
155 /**
156  * Returns the database version.
157  */
158 GED_EXPORT extern int ged_version(struct ged *gedp, int argc, const char *argv[]);
159 
160 /**
161  * Write region ident codes to filename.
162  */
163 GED_EXPORT extern int ged_wcodes(struct ged *gedp, int argc, const char *argv[]);
164 
165 
166 /* defined in copy.c */
167 GED_EXPORT extern int ged_dbcopy(struct ged *from_gedp,
168  struct ged *to_gedp,
169  const char *from,
170  const char *to,
171  int fflag);
172 /**
173  * Globs expression against database objects
174  */
175 GED_EXPORT extern int ged_expand(struct ged *gedp, int argc, const char *argv[]);
176 
177 /**
178  * Set region ident codes.
179  */
180 GED_EXPORT extern int ged_item(struct ged *gedp, int argc, const char *argv[]);
181 
182 /**
183  * Open a database
184  */
185 GED_EXPORT extern int ged_reopen(struct ged *gedp, int argc, const char *argv[]);
186 
187 /**
188  * Read region ident codes from filename.
189  */
190 GED_EXPORT extern int ged_rcodes(struct ged *gedp, int argc, const char *argv[]);
191 
192 /**
193  * Change the default region ident codes: item air los mat
194  */
195 GED_EXPORT extern int ged_regdef(struct ged *gedp, int argc, const char *argv[]);
196 
197 /**
198  * Interface to search functionality (i.e. Unix find for geometry)
199  */
200 GED_EXPORT extern int ged_search(struct ged *gedp, int argc, const char *argv[]);
201 
202 /**
203  * Count/list primitives/regions/groups
204  */
205 GED_EXPORT extern int ged_summary(struct ged *gedp, int argc, const char *argv[]);
206 
207 /**
208  * Sync up the in-memory database with the on-disk database.
209  */
210 GED_EXPORT extern int ged_sync(struct ged *gedp, int argc, const char *argv[]);
211 
212 /**
213  * The ged_tables() function serves idents, regions and solids.
214  *
215  * Make ascii summary of region idents.
216  *
217  */
218 GED_EXPORT extern int ged_tables(struct ged *gedp, int argc, const char *argv[]);
219 
220 /**
221  * The ged_which() function serves both whichair and whichid.
222  *
223  * Find the regions with the specified air codes. Find the regions
224  * with the specified region ids.
225  */
226 GED_EXPORT extern int ged_which(struct ged *gedp, int argc, const char *argv[]);
227 
228 /**
229  * Return all combinations with the specified shaders.
230  */
231 GED_EXPORT extern int ged_which_shader(struct ged *gedp, int argc, const char *argv[]);
232 
233 /**
234  * Make color entry.
235  */
236 GED_EXPORT extern int ged_color(struct ged *gedp, int argc, const char *argv[]);
237 
238 /**
239  * Print color table
240  */
241 GED_EXPORT extern int ged_prcolor(struct ged *gedp, int argc, const char *argv[]);
242 
243 /**
244  * Get/set the output handler script
245  */
246 GED_EXPORT extern int ged_set_output_script(struct ged *gedp, int argc, const char *argv[]);
247 
248 /**
249  * Check database objects for errors
250  */
251 GED_EXPORT extern int ged_lint(struct ged *gedp, int argc, const char *argv[]);
252 
253 /**
254  * Interface to environment variables
255  */
256 GED_EXPORT extern int ged_env(struct ged *gedp, int argc, const char *argv[]);
257 
258 /**
259  * List and abort subprocesses
260  */
261 GED_EXPORT extern int ged_process(struct ged *gedp, int argc, const char *argv[]);
262 
263 
264 
265 __END_DECLS
266 
267 #endif /* GED_DATABASE_H */
268 
269 /** @} */
270 
271 /*
272  * Local Variables:
273  * tab-width: 8
274  * mode: C
275  * indent-tabs-mode: t
276  * c-file-style: "stroustrup"
277  * End:
278  * ex: shiftwidth=4 tabstop=8
279  */
Header file for the BRL-CAD common definitions.
int ged_tables(struct ged *gedp, int argc, const char *argv[])
int ged_expand(struct ged *gedp, int argc, const char *argv[])
int ged_item(struct ged *gedp, int argc, const char *argv[])
int ged_rcodes(struct ged *gedp, int argc, const char *argv[])
int ged_process(struct ged *gedp, int argc, const char *argv[])
int ged_rmap(struct ged *gedp, int argc, const char *argv[])
int ged_color(struct ged *gedp, int argc, const char *argv[])
int ged_set_output_script(struct ged *gedp, int argc, const char *argv[])
int ged_find(struct ged *gedp, int argc, const char *argv[])
int ged_regdef(struct ged *gedp, int argc, const char *argv[])
int ged_which_shader(struct ged *gedp, int argc, const char *argv[])
int ged_units(struct ged *gedp, int argc, const char *argv[])
int ged_showmats(struct ged *gedp, int argc, const char *argv[])
int ged_dump(struct ged *gedp, int argc, const char *argv[])
int ged_sync(struct ged *gedp, int argc, const char *argv[])
int ged_ls(struct ged *gedp, int argc, const char *argv[])
int ged_who_argv(struct ged *gedp, char **start, const char **end)
int ged_dbip(struct ged *gedp, int argc, const char *argv[])
int ged_lint(struct ged *gedp, int argc, const char *argv[])
int ged_prcolor(struct ged *gedp, int argc, const char *argv[])
int ged_wcodes(struct ged *gedp, int argc, const char *argv[])
int ged_version(struct ged *gedp, int argc, const char *argv[])
int ged_tops(struct ged *gedp, int argc, const char *argv[])
int ged_pathsum(struct ged *gedp, int argc, const char *argv[])
int ged_edcolor(struct ged *gedp, int argc, const char *argv[])
int ged_concat(struct ged *gedp, int argc, const char *argv[])
int ged_editit(struct ged *gedp, int argc, const char *argv[])
int ged_tol(struct ged *gedp, int argc, const char *argv[])
size_t ged_who_argc(struct ged *gedp)
int ged_which(struct ged *gedp, int argc, const char *argv[])
int ged_dup(struct ged *gedp, int argc, const char *argv[])
int ged_dbcopy(struct ged *from_gedp, struct ged *to_gedp, const char *from, const char *to, int fflag)
int ged_search(struct ged *gedp, int argc, const char *argv[])
int ged_summary(struct ged *gedp, int argc, const char *argv[])
int ged_reopen(struct ged *gedp, int argc, const char *argv[])
int ged_env(struct ged *gedp, int argc, const char *argv[])
int ged_pathlist(struct ged *gedp, int argc, const char *argv[])
int ged_title(struct ged *gedp, int argc, const char *argv[])
int ged_glob(struct ged *gedp, int argc, const char *argv[])
int ged_path_validate(struct ged *gedp, const struct db_full_path *const path)
Definition: defines.h:205