Pointer Tables
[libbu (utility functions)]

Collaboration diagram for Pointer Tables:


Files

file  ptbl.c
 Support for generalized "pointer tables".

Functions

void bu_ptbl_init (struct bu_ptbl *b, int 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)
int bu_ptbl (struct bu_ptbl *b, int func, long int *p)
void bu_pr_ptbl (const char *title, const struct bu_ptbl *tbl, int verbose)
void bu_ptbl_trunc (struct bu_ptbl *tbl, int end)

Function Documentation

void bu_ptbl_init struct bu_ptbl b,
int  len,
const char *  str
 

B U _ P T B L _ I N I T

Initialize struct & get storage for table. Recommend 8 or 64 for initial len.

Definition at line 72 of file ptbl.c.

References bu_ptbl::blen, bu_calloc(), bu_debug, BU_DEBUG_PTBL, BU_LIST_INIT, bu_log(), BU_PTBL_MAGIC, bu_ptbl::buffer, bu_ptbl::end, bu_ptbl::l, and bu_list::magic.

Referenced by bu_ptbl(), bu_ptbl_ins(), db_lookup_by_attr(), db_open(), dgo_E_cmd(), Eplot(), nmg_break_edge_at_verts(), nmg_check_radial_angles(), nmg_ck_geometry(), nmg_ck_vs_in_region(), nmg_close_shell(), nmg_crackshells(), nmg_cut_lu_into_coplanar_and_non(), nmg_decompose_shell(), nmg_dup_shell(), nmg_e_and_v_tabulate(), nmg_edge_g_tabulate(), nmg_edge_tabulate(), nmg_edgeuse_on_line_tabulate(), nmg_edgeuse_tabulate(), nmg_edgeuse_with_eg_tabulate(), nmg_extrude_shell(), nmg_face_tabulate(), nmg_find_outer_and_void_shells(), nmg_find_zero_length_edges(), nmg_fix_normals(), nmg_fix_overlapping_loops(), nmg_get_touching_jaunts(), nmg_hollow_shell(), nmg_in_vert(), nmg_intersect_loops_self(), nmg_isect_eu_fu(), nmg_isect_shell_self(), nmg_kill_anti_loops(), nmg_kill_cracks_at_vertex(), nmg_make_faces_within_tol(), nmg_model_break_e_on_v(), nmg_move_edge_thru_pt(), nmg_open_shells_connect(), nmg_propagate_normals(), nmg_radial_join_eu_NEW(), nmg_split_loops_handler(), nmg_tabulate_face_g_verts(), nmg_translate_face(), nmg_vertex_tabulate(), nmg_vertexuse_normal_tabulate(), rt_comb_import5(), rt_ct_get(), rt_cut_it(), rt_extrude_tess(), rt_find_identical_solid(), rt_get_region_seglist_for_partition(), rt_get_seg(), rt_init_resource(), rt_nmg_tclget(), rt_rebuild_overlaps(), rt_shootray(), rt_shootray_bundle(), and rt_unprep().

Here is the call graph for this function:

void bu_ptbl_reset struct bu_ptbl b  ) 
 

B U _ P T B L _ R E S E T

Reset the table to have no elements, but retain any existing storage.

Definition at line 91 of file ptbl.c.

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

Referenced by bu_ptbl(), dgo_E_cmd(), nmg_decompose_shell(), nmg_fix_overlapping_loops(), nmg_intersect_loops_self(), nmg_move_edge_thru_pt(), nmg_split_loops_handler(), and rt_shootray().

Here is the call graph for this function:

int bu_ptbl_ins struct bu_ptbl b,
long int *  p
 

B U _ P T B L _ I N S

Append/Insert a (long *) item to/into the table.

Definition at line 107 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, and bu_ptbl::end.

Here is the call graph for this function:

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

B U _ P T B L _ L O C A T E

locate a (long *) in an existing table

Returns:
index of first matching element in array, if found

-1 if not found

We do this a great deal, so make it go as fast as possible. this is the biggest argument I can make for changing to an ordered list. Someday....

Definition at line 143 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
 

B U _ P T B L _ Z E R O

Set all occurrences of "p" in the table to zero. This is different than deleting them.

Definition at line 165 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
 

B U _ P T B L _ I N S _ U N I Q U E

Append item to table, if not already present. Unique insert.

Returns:
index of first matchine element in array, if found. (table unchanged)

-1 if table extended to hold new element

We do this a great deal, so make it go as fast as possible. this is the biggest argument I can make for changing to an ordered list. Someday....

Definition at line 192 of file ptbl.c.

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

Here is the call graph for this function:

int bu_ptbl_rm struct bu_ptbl b,
const long int *  p
 

B U _ P T B L _ R M

Remove all occurrences of an item from a table

Returns:
Number of copies of 'p' that were removed from the table.

0 if none found.

we go backwards down the table looking for occurrences of p to delete. We do it backwards to reduce the amount of data moved when there is more than one occurrence of p in the table. A pittance savings, unless you're doing a lot of it.

Definition at line 235 of file ptbl.c.

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

Here is the call graph for this function:

void bu_ptbl_cat struct bu_ptbl dest,
const struct bu_ptbl src
 

B U _ P T B L _ C A T

Catenate one table onto end of another. There is no checking for duplication.

Definition at line 271 of file ptbl.c.

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

Referenced by bu_ptbl().

Here is the call graph for this function:

void bu_ptbl_cat_uniq struct bu_ptbl dest,
const struct bu_ptbl src
 

B U _ P T B L _ C A T _ U N I Q

Catenate one table onto end of another, ensuring that no entry is duplicated. Duplications between multiple items in 'src' are not caught. The search is a nasty n**2 one. The tables are expected to be short.

Definition at line 299 of file ptbl.c.

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

Referenced by rt_rebuild_overlaps().

Here is the call graph for this function:

void bu_ptbl_free struct bu_ptbl b  ) 
 

B U _ P T B L _ F R E E

Deallocate dynamic buffer associated with a table, and render this table unusable without a subsequent bu_ptbl_init().

Definition at line 327 of file ptbl.c.

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

Referenced by bu_ptbl(), db_close(), dgo_E_cmd(), free_etree(), nmg_calc_face_plane(), nmg_ck_vs_in_region(), nmg_classify_s_vs_s(), nmg_close_shell(), nmg_crackshells(), nmg_decompose_shell(), nmg_dup_shell(), nmg_fix_normals(), nmg_fix_overlapping_loops(), nmg_in_vert(), nmg_isect_fu_jra(), nmg_isect_two_generic_faces(), nmg_model_vertex_fuse(), nmg_move_edge_thru_pt(), nmg_open_shells_connect(), nmg_propagate_normals(), nmg_radial_join_eu_NEW(), nmg_split_loops_handler(), nmg_to_arb(), rt_clean_resource(), rt_comb_import5(), rt_cut_clean(), rt_extrude_tess(), rt_fastgen_vol_vol_overlap(), rt_free_rti(), rt_free_soltab(), rt_nmg_tclget(), rt_res_pieces_clean(), and rt_unprep().

Here is the call graph for this function:

int bu_ptbl struct bu_ptbl b,
int  func,
long int *  p
 

B U _ P T B L

This version maintained for source compatibility with existing NMG code.

Definition at line 345 of file ptbl.c.

References bu_bomb(), BU_CK_PTBL, bu_log(), bu_ptbl_cat(), BU_PTBL_CAT, bu_ptbl_free(), BU_PTBL_FREE, bu_ptbl_init(), BU_PTBL_INIT, bu_ptbl_ins(), BU_PTBL_INS, bu_ptbl_ins_unique(), BU_PTBL_INS_UNIQUE, BU_PTBL_LOC, bu_ptbl_locate(), bu_ptbl_reset(), bu_ptbl_rm(), BU_PTBL_RM, BU_PTBL_RST, bu_ptbl_zero(), and BU_PTBL_ZERO.

Here is the call graph for this function:

void bu_pr_ptbl const char *  title,
const struct bu_ptbl tbl,
int  verbose
 

B U _ P R _ P T B L

Print a bu_ptbl array for inspection.

Definition at line 385 of file ptbl.c.

References BU_CK_PTBL, bu_log(), BU_PTBL_BASEADDR, BU_PTBL_LASTADDR, and bu_ptbl::end.

Referenced by rt_pr_soltab(), and rt_prep_parallel().

Here is the call graph for this function:

void bu_ptbl_trunc struct bu_ptbl tbl,
int  end
 

B U _ P T B L _ T R U N C

truncate a bu_ptbl

Definition at line 414 of file ptbl.c.

References BU_CK_PTBL, and bu_ptbl::end.

Referenced by rt_comb_import5(), and rt_rebuild_overlaps().


Generated on Mon Sep 18 01:25:20 2006 for BRL-CAD by  doxygen 1.4.6