BRL-CAD
#include "common.h"
#include <stdio.h>
#include <string.h>
#include "bu/debug.h"
#include "bu/log.h"
#include "bu/malloc.h"
#include "bu/ptbl.h"
Include dependency graph for ptbl.c:

Go to the source code of this file.

Functions

void bu_ptbl_init (struct bu_ptbl *b, size_t len, const char *str)
 
void bu_ptbl_reset (struct bu_ptbl *b)
 
int bu_ptbl_ins (struct bu_ptbl *b, long int *p)
 
int bu_ptbl_locate (const struct bu_ptbl *b, const long int *p)
 
void bu_ptbl_zero (struct bu_ptbl *b, const long int *p)
 
int bu_ptbl_ins_unique (struct bu_ptbl *b, long int *p)
 
int bu_ptbl_rm (struct bu_ptbl *b, const long int *p)
 
void bu_ptbl_cat (struct bu_ptbl *dest, const struct bu_ptbl *src)
 
void bu_ptbl_cat_uniq (struct bu_ptbl *dest, const struct bu_ptbl *src)
 
void bu_ptbl_free (struct bu_ptbl *b)
 
void bu_pr_ptbl (const char *title, const struct bu_ptbl *tbl, int verbose)
 
void bu_ptbl_trunc (struct bu_ptbl *tbl, int end)
 

Detailed Description

Support for generalized "pointer tables"

Support for generalized "pointer tables", kept compactly in a dynamic array.

The table is currently un-ordered, and is merely an array of pointers. The support routines BU_*PTBL* and bu_ptbl* manipulate the array for you. Pointers to be operated on (inserted, deleted, searched for) are passed as a "pointer to long".

Definition in file ptbl.c.

Function Documentation

int bu_ptbl_ins ( struct bu_ptbl b,
long int *  p 
)

Definition at line 61 of file ptbl.c.

References bu_ptbl::blen, BU_CK_PTBL, bu_debug, BU_DEBUG_PTBL, bu_log(), bu_ptbl_init(), bu_realloc(), bu_ptbl::buffer, bu_ptbl::end, and UNLIKELY.

Referenced by bu_ptbl_ins_unique().

Here is the call graph for this function:

int bu_ptbl_locate ( const struct bu_ptbl b,
const long int *  p 
)

Definition at line 86 of file ptbl.c.

References BU_CK_PTBL, bu_ptbl::buffer, and bu_ptbl::end.

void bu_ptbl_zero ( struct bu_ptbl b,
const long int *  p 
)

Definition at line 102 of file ptbl.c.

References BU_CK_PTBL, bu_ptbl::buffer, and bu_ptbl::end.

int bu_ptbl_ins_unique ( struct bu_ptbl b,
long int *  p 
)

Definition at line 119 of file ptbl.c.

References bu_ptbl::blen, BU_CK_PTBL, bu_debug, BU_DEBUG_PTBL, bu_log(), bu_ptbl_ins(), bu_ptbl::buffer, bu_ptbl::end, and UNLIKELY.

Referenced by bu_ptbl_cat_uniq().

Here is the call graph for this function:

int bu_ptbl_rm ( struct bu_ptbl b,
const long int *  p 
)

Definition at line 150 of file ptbl.c.

References BU_CK_PTBL, bu_debug, BU_DEBUG_PTBL, bu_log(), bu_ptbl::buffer, bu_ptbl::end, and UNLIKELY.

Here is the call graph for this function: