BRL-CAD

#include <mapped_file.h>

Collaboration diagram for bu_mapped_file:
[legend]

Data Fields

struct bu_list l
 
char * name
 
void * buf
 
size_t buflen
 
int is_mapped
 
char * appl
 
void * apbuf
 
size_t apbuflen
 
time_t modtime
 
int uses
 
int dont_restat
 

Detailed Description

Structure for opening a mapped file.

Each file is opened and mapped only once (per application, as tagged by the string in "appl" field). Subsequent opens require an exact match on both strings.

Before allocating apbuf and performing data conversion into it, openers should check to see if the file has already been opened and converted previously.

When used in RT, the mapped files are not closed at the end of a frame, so that subsequent frames may take advantage of the large data files having already been read and converted. Examples include EBMs, texture maps, and height fields.

For appl == "db_i", file is a ".g" database & apbuf is (struct db_i *).

Definition at line 82 of file mapped_file.h.

Field Documentation

struct bu_list l

Definition at line 83 of file mapped_file.h.

Referenced by bu_free_mapped_files(), and bu_open_mapped_file().

char* name

bu_strdup() of file name

Definition at line 84 of file mapped_file.h.

Referenced by bu_free_mapped_files(), bu_open_mapped_file(), bu_pr_mapped_file(), and temp_setup().

int is_mapped

1=mmap() used, 0=bu_malloc/fread

Definition at line 87 of file mapped_file.h.

Referenced by bu_free_mapped_files(), bu_open_mapped_file(), and bu_pr_mapped_file().

char* appl

bu_strdup() of tag for application using 'apbuf'

Definition at line 88 of file mapped_file.h.

Referenced by bu_free_mapped_files(), and bu_open_mapped_file().

void* apbuf

opt: application-specific buffer

Definition at line 89 of file mapped_file.h.

Referenced by bu_free_mapped_files(), db_open(), get_file_data(), rt_ebm_import4(), rt_ebm_import5(), rt_hf_import4(), rt_hf_prep(), and rt_hf_shot().

size_t apbuflen

opt: application-specific buflen

Definition at line 90 of file mapped_file.h.

Referenced by get_file_data(), rt_ebm_import4(), rt_ebm_import5(), and rt_hf_import4().

time_t modtime

date stamp, in case file is modified

Definition at line 91 of file mapped_file.h.

Referenced by bu_open_mapped_file().

int uses

ptrs to this struct handed out

Definition at line 92 of file mapped_file.h.

Referenced by bu_close_mapped_file(), bu_free_mapped_files(), bu_open_mapped_file(), bu_pr_mapped_file(), and rt_hf_prep().

int dont_restat

1=on subsequent opens, don't re-stat()

Definition at line 93 of file mapped_file.h.

Referenced by bu_open_mapped_file(), and rt_submodel_prep().


The documentation for this struct was generated from the following file: