BRL-CAD
directory Struct Reference

#include <directory.h>

Collaboration diagram for directory:
[legend]

Data Fields

uint32_t d_magic
 Magic number. More...
 
char * d_namep
 pointer to name string More...
 
union {
   b_off_t   file_offset
 disk address in obj file More...
 
   void *   ptr
 ptr to in-memory-only obj More...
 
d_un
 
struct directoryd_forw
 link to next dir entry More...
 
struct animated_animate
 link to animation More...
 
long d_uses
 number of uses, from instancing More...
 
size_t d_len
 number of of db granules used More...
 
long d_nref
 number of times ref'ed by COMBs More...
 
int d_flags
 flags More...
 
unsigned char d_major_type
 object major type More...
 
unsigned char d_minor_type
 object minor type More...
 
struct bu_list d_use_hd
 heads list of uses (struct soltab l2) More...
 
char d_shortname [16]
 Stash short names locally. More...
 
void * u_data
 void pointer hook for user data. user is responsible for freeing. More...
 

Detailed Description

One of these structures is allocated in memory to represent each named object in the database.

Note that a d_addr of RT_DIR_PHONY_ADDR ((b_off_t)-1) means that database storage has not been allocated yet.

Note that there is special handling for RT_DIR_INMEM "in memory" overrides.

Construction should be done only by using RT_GET_DIRECTORY() Destruction should be done only by using db_dirdelete().

Special note: In order to reduce the overhead of acquiring heap memory (e.g., via bu_strdup()) to stash the name in d_namep, we carry along enough storage for small names right in the structure itself (d_shortname). Thus, d_namep should never be assigned to directly, it should always be accessed using RT_DIR_SET_NAMEP() and RT_DIR_FREE_NAMEP().

The in-memory name of an object should only be changed using db_rename(), so that it can be requeued on the correct linked list, based on new hash. This should be followed by rt_db_put_internal() on the object to modify the on-disk name.

Definition at line 59 of file directory.h.

Field Documentation

◆ d_magic

uint32_t d_magic

Magic number.

Definition at line 60 of file directory.h.

◆ d_namep

char* d_namep

pointer to name string

Definition at line 61 of file directory.h.

◆ file_offset

b_off_t file_offset

disk address in obj file

Definition at line 63 of file directory.h.

◆ ptr

void* ptr

ptr to in-memory-only obj

Definition at line 64 of file directory.h.

◆ 

union { ... } d_un

◆ d_forw

struct directory* d_forw

link to next dir entry

Definition at line 66 of file directory.h.

◆ d_animate

struct animate* d_animate

link to animation

Definition at line 67 of file directory.h.

◆ d_uses

long d_uses

number of uses, from instancing

Definition at line 68 of file directory.h.

◆ d_len

size_t d_len

number of of db granules used

Definition at line 69 of file directory.h.

◆ d_nref

long d_nref

number of times ref'ed by COMBs

Definition at line 70 of file directory.h.

◆ d_flags

int d_flags

flags

Definition at line 71 of file directory.h.

◆ d_major_type

unsigned char d_major_type

object major type

Definition at line 72 of file directory.h.

◆ d_minor_type

unsigned char d_minor_type

object minor type

Definition at line 73 of file directory.h.

◆ d_use_hd

struct bu_list d_use_hd

heads list of uses (struct soltab l2)

Definition at line 74 of file directory.h.

◆ d_shortname

char d_shortname[16]

Stash short names locally.

Definition at line 75 of file directory.h.

◆ u_data

void* u_data

void pointer hook for user data. user is responsible for freeing.

Definition at line 76 of file directory.h.


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