BRL-CAD
|
#include "common.h"
#include "vmath.h"
#include "bu/magic.h"
#include "bu/list.h"
#include "bu/vls.h"
#include "bu/observer.h"
#include "rt/db_instance.h"
#include "rt/tree.h"
Go to the source code of this file.
Data Structures | |
struct | rt_wdb |
Macros | |
#define | RT_WDB_TYPE_DB_DEFAULT 0 |
#define | RT_WDB_TYPE_DB_DEFAULT_APPEND_ONLY 1 |
#define | RT_WDB_TYPE_DB_DISK 2 |
#define | RT_WDB_TYPE_DB_DISK_APPEND_ONLY 3 |
#define | RT_WDB_TYPE_DB_INMEM 4 |
#define | RT_WDB_TYPE_DB_INMEM_APPEND_ONLY 5 |
#define | RT_CHECK_WDB(_p) BU_CKMAG(_p, RT_WDB_MAGIC, "rt_wdb") |
#define | RT_CK_WDB(_p) RT_CHECK_WDB(_p) |
#define | RT_WDB_INIT_ZERO { {RT_WDB_MAGIC, BU_LIST_NULL, BU_LIST_NULL}, 0, NULL, RT_DBTS_INIT_ZERO, BG_TESS_TOL_INIT_ZERO, BN_TOL_INIT_ZERO, NULL, BU_VLS_INIT_ZERO, 0, 0, 0, 0, 0, 0, BU_VLS_INIT_ZERO, BU_OBSERVER_LIST_INIT_ZERO, NULL } |
#define | RT_WDB_NULL ((struct rt_wdb *)NULL) |
Functions | |
struct rt_wdb * | wdb_fopen (const char *filename) |
struct rt_wdb * | wdb_fopen_v (const char *filename, int version) |
struct rt_wdb * | wdb_dbopen (struct db_i *dbip, int mode) |
int | wdb_import (struct rt_wdb *wdbp, struct rt_db_internal *internp, const char *name, const mat_t mat) |
int | wdb_export_external (struct rt_wdb *wdbp, struct bu_external *ep, const char *name, int flags, unsigned char minor_type) |
int | wdb_put_internal (struct rt_wdb *wdbp, const char *name, struct rt_db_internal *ip, double local2mm) |
int | wdb_export (struct rt_wdb *wdbp, const char *name, void *gp, int id, double local2mm) |
void | wdb_init (struct rt_wdb *wdbp, struct db_i *dbip, int mode) |
void | wdb_close (struct rt_wdb *wdbp) |
int | wdb_import_from_path (struct bu_vls *logstr, struct rt_db_internal *ip, const char *path, struct rt_wdb *wdb) |
int | wdb_import_from_path2 (struct bu_vls *logstr, struct rt_db_internal *ip, const char *path, struct rt_wdb *wdb, matp_t matp) |
#define RT_CHECK_WDB | ( | _p | ) | BU_CKMAG(_p, RT_WDB_MAGIC, "rt_wdb") |
#define RT_WDB_INIT_ZERO { {RT_WDB_MAGIC, BU_LIST_NULL, BU_LIST_NULL}, 0, NULL, RT_DBTS_INIT_ZERO, BG_TESS_TOL_INIT_ZERO, BN_TOL_INIT_ZERO, NULL, BU_VLS_INIT_ZERO, 0, 0, 0, 0, 0, 0, BU_VLS_INIT_ZERO, BU_OBSERVER_LIST_INIT_ZERO, NULL } |
Routines to allow libwdb to use librt's import/export interface, rather than having to know about the database formats directly.
Create a libwdb output stream destined for a disk file. This will destroy any existing file by this name, and start fresh. The file is then opened in the normal "update" mode and an in-memory directory is built along the way, allowing retrievals and object replacements as needed.
The rt_wdb type returned is RT_WDB_TYPE_DB_DISK.
Users can change the database title by calling: ???
Create a libwdb output stream destined for an existing BRL-CAD database, already opened via a db_open() call.
Note: there can be only one rt_wdb container of each type per dbip - if an rt_wdb of the specified type is already associated with the database, the pre-existing stream will be returned.
RT_WDB_TYPE_DB_DISK Add to on-disk database RT_WDB_TYPE_DB_DISK_APPEND_ONLY Add to on-disk database, don't clobber existing names, use prefix RT_WDB_TYPE_DB_INMEM Add to in-memory database only RT_WDB_TYPE_DB_INMEM_APPEND_ONLY Ditto, but give errors if name in use.
|
extern |
Returns - 0 and modified *internp; -1 ft_import failure (from rt_db_get_internal) -2 db_get_external failure (from rt_db_get_internal) -3 Attempt to import from write-only (stream) file. -4 Name not found in database TOC.
NON-PARALLEL because of rt_uniresource
|
extern |
The caller must free "ep".
Note that the minor_type used here should match both the rt_db_internal idb_minor_type and struct directory d_minor_type, if either or both of those containers are associated with the bu_external data being written (typically either ip->idb_minor_type or dp->d_minor_type are used as the last arguments to wdb_export_external.)
Returns - 0 OK <0 error
|
extern |
Convert the internal representation of a solid to the external one, and write it into the database.
The internal representation is always freed. This is the analog of rt_db_put_internal() for rt_wdb objects.
Use this routine in preference to wdb_export() whenever the caller already has an rt_db_internal structure handy.
NON-PARALLEL because of rt_uniresource
Returns - 0 OK <0 error
|
extern |
Export an in-memory representation of an object, as described in the file h/rtgeom.h, into the indicated database.
The internal representation (gp) is always freed.
WARNING: The caller must be careful not to double-free gp, particularly if it's been extracted from an rt_db_internal, e.g. by passing intern.idb_ptr for gp.
If the caller has an rt_db_internal structure handy already, they should call wdb_put_internal() directly – this is a convenience routine intended primarily for internal use in LIBWDB.
Returns - 0 OK <0 error
Close a database created with wdb_fopen or wdb_fopen_v.
|
extern |
Given the name of a database object or a full path to a leaf object, obtain the internal form of that leaf. Packaged separately mainly to make available nice Tcl error handling.
Returns - BRLCAD_OK BRLCAD_ERROR
|
extern |
Given the name of a database object or a full path to a leaf object, obtain the internal form of that leaf. Packaged separately mainly to make available nice Tcl error handling. Additionally, copies ts.ts_mat to matp.
Returns - BRLCAD_OK BRLCAD_ERROR