BRL-CAD

#include <mapped_file.h>

Collaboration diagram for bu_mapped_file:
[legend]

Data Fields

char * name
 
void * buf
 
size_t buflen
 
int is_mapped
 
char * appl
 
void * apbuf
 
size_t apbuflen
 
time_t modtime
 
int uses
 
void * handle
 

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 81 of file mapped_file.h.

Field Documentation

◆ name

char* name

bu_strdup() of file name

Definition at line 82 of file mapped_file.h.

◆ buf

void* buf

In-memory copy of file (may be mmapped)

Definition at line 83 of file mapped_file.h.

◆ buflen

size_t buflen

bytes in 'buf'

Definition at line 84 of file mapped_file.h.

◆ is_mapped

int is_mapped

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

Definition at line 85 of file mapped_file.h.

◆ appl

char* appl

bu_strdup() of tag for application using 'apbuf'

Definition at line 86 of file mapped_file.h.

◆ apbuf

void* apbuf

opt: application-specific buffer

Definition at line 87 of file mapped_file.h.

◆ apbuflen

size_t apbuflen

opt: application-specific buflen

Definition at line 88 of file mapped_file.h.

◆ modtime

time_t modtime

date stamp, in case file is modified

Definition at line 89 of file mapped_file.h.

◆ uses

int uses

ptrs to this struct handed out

Definition at line 90 of file mapped_file.h.

◆ handle

void* handle

PRIVATE - for internal file-specific implementation data

Definition at line 91 of file mapped_file.h.


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