BRL-CAD
Loading...
Searching...
No Matches
db_instance.h File Reference
#include "common.h"
#include <stdio.h>
#include "bu/magic.h"
#include "bu/file.h"
#include "bu/mapped_file.h"
#include "bu/ptbl.h"
#include "bn/tol.h"
#include "rt/mem.h"
#include "rt/op.h"
#include "rt/directory.h"
#include "rt/anim.h"
#include "rt/tol.h"
Include dependency graph for db_instance.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  db_i
 

Macros

#define DBI_NULL   ((struct db_i *)0)
 
#define RT_CHECK_DBI(_p)   BU_CKMAG(_p, DBI_MAGIC, "struct db_i")
 
#define RT_CK_DBI(_p)   RT_CHECK_DBI(_p)
 
#define DB_OPEN_READONLY   "r"
 
#define DB_OPEN_READWRITE   "rw"
 

Typedefs

typedef void(* dbi_changed_t) (struct db_i *, struct directory *, int, void *)
 
typedef void(* dbi_update_nref_t) (struct db_i *, struct directory *, struct directory *, const char *, db_op_t, matp_t, void *)
 

Functions

int db_add_changed_clbk (struct db_i *dbip, dbi_changed_t c, void *u_data)
 
int db_rm_changed_clbk (struct db_i *dbip, dbi_changed_t c, void *u_data)
 
int db_add_update_nref_clbk (struct db_i *dbip, dbi_update_nref_t c, void *u_data)
 
int db_rm_update_nref_clbk (struct db_i *dbip, dbi_update_nref_t c, void *u_data)
 
struct db_idb_open (const char *name, const char *mode)
 
struct db_idb_open_inmem (void)
 
struct db_idb_create (const char *name, int version)
 
struct db_idb_create_inmem (void)
 
void db_close (struct db_i *dbip)
 

Macro Definition Documentation

◆ DBI_NULL

#define DBI_NULL   ((struct db_i *)0)

Definition at line 146 of file db_instance.h.

◆ RT_CHECK_DBI

#define RT_CHECK_DBI (   _p)    BU_CKMAG(_p, DBI_MAGIC, "struct db_i")

Definition at line 147 of file db_instance.h.

◆ RT_CK_DBI

#define RT_CK_DBI (   _p)    RT_CHECK_DBI(_p)

Definition at line 148 of file db_instance.h.

◆ DB_OPEN_READONLY

#define DB_OPEN_READONLY   "r"

for db_open(), open the specified file as read-only

Definition at line 160 of file db_instance.h.

◆ DB_OPEN_READWRITE

#define DB_OPEN_READWRITE   "rw"

for db_open(), open the specified file as read-write

Definition at line 165 of file db_instance.h.

Typedef Documentation

◆ dbi_changed_t

typedef void(* dbi_changed_t) (struct db_i *, struct directory *, int, void *)

Definition at line 53 of file db_instance.h.

◆ dbi_update_nref_t

typedef void(* dbi_update_nref_t) (struct db_i *, struct directory *, struct directory *, const char *, db_op_t, matp_t, void *)

Definition at line 85 of file db_instance.h.

Function Documentation

◆ db_add_changed_clbk()

int db_add_changed_clbk ( struct db_i dbip,
dbi_changed_t  c,
void u_data 
)
extern

◆ db_rm_changed_clbk()

int db_rm_changed_clbk ( struct db_i dbip,
dbi_changed_t  c,
void u_data 
)
extern

◆ db_add_update_nref_clbk()

int db_add_update_nref_clbk ( struct db_i dbip,
dbi_update_nref_t  c,
void u_data 
)
extern

◆ db_rm_update_nref_clbk()

int db_rm_update_nref_clbk ( struct db_i dbip,
dbi_update_nref_t  c,
void u_data 
)
extern

◆ db_open()

struct db_i * db_open ( const char name,
const char mode 
)
extern

Open the named database.

The 'name' parameter specifies the file or filepath to a .g geometry database file for reading and/or writing.

The 'mode' parameter specifies whether to open read-only or in read-write mode, specified via the DB_OPEN_READONLY and DB_OPEN_READWRITE symbols respectively.

As a convenience, the returned db_t structure's dbi_filepath field is a C-style argv array of dirs to search when attempting to open related files (such as data files for EBM solids or texture-maps). The default values are "." and the directory containing the ".g" file. They may be overridden by setting the environment variable BRLCAD_FILE_PATH.

Returns: DBI_NULL error db_i * success

◆ db_open_inmem()

struct db_i * db_open_inmem ( void  )
extern

"open" an in-memory-only database instance. this initializes a dbip for use, creating an inmem dbi_wdbp as the means to add geometry to the directory (use wdb_export_external()).

◆ db_create()

struct db_i * db_create ( const char name,
int  version 
)
extern

Create a new database containing just a header record, regardless of whether the database previously existed or not, and open it for reading and writing.

This routine also calls db_dirbuild(), so the caller doesn't need to.

Returns: DBI_NULL on error db_i * on success

◆ db_create_inmem()

struct db_i * db_create_inmem ( void  )
extern

creates an in-memory-only database. this is very similar to db_open_inmem() with the exception that the this routine adds a default _GLOBAL object.

◆ db_close()

void db_close ( struct db_i dbip)
extern

Close a database, releasing dynamic memory. Will also release the db_i struct memory itself, not just the internal struct contents. However, the actual freeing of memory Waits until last user is done - db_close is a no-op if dbi_uses is greater than 1.