BRL-CAD
db_diff.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  diff_avp
 
struct  diff_result
 

Macros

#define DIFF_EMPTY   0
 
#define DIFF_UNCHANGED   1
 
#define DIFF_REMOVED   2
 
#define DIFF_ADDED   4
 
#define DIFF_CHANGED   8
 
#define DIFF_CONFLICT   16
 

Enumerations

enum  db_compare_criteria_t { DB_COMPARE_ALL =0x00, DB_COMPARE_PARAM =0x01, DB_COMPARE_ATTRS =0x02 }
 

Functions

void diff_init_avp (struct diff_avp *attr_result)
 
void diff_free_avp (struct diff_avp *attr_result)
 
void diff_init_result (struct diff_result *result, const struct bn_tol *curr_diff_tol, const char *object_name)
 
void diff_free_result (struct diff_result *result)
 
int db_avs_diff (const struct bu_attribute_value_set *left_set, const struct bu_attribute_value_set *right_set, const struct bn_tol *diff_tol, int(*add_func)(const char *attr_name, const char *attr_val, void *data), int(*del_func)(const char *attr_name, const char *attr_val, void *data), int(*chgd_func)(const char *attr_name, const char *attr_val_left, const char *attr_val_right, void *data), int(*unchgd_func)(const char *attr_name, const char *attr_val, void *data), void *client_data)
 
int db_avs_diff3 (const struct bu_attribute_value_set *left_set, const struct bu_attribute_value_set *ancestor_set, const struct bu_attribute_value_set *right_set, const struct bn_tol *diff_tol, int(*add_func)(const char *attr_name, const char *attr_val_left, const char *attr_val_right, void *data), int(*del_func)(const char *attr_name, const char *attr_val_left, const char *attr_val_ancestor, const char *attr_val_right, void *data), int(*chgd_func)(const char *attr_name, const char *attr_val_left, const char *attr_val_ancestor, const char *attr_val_right, void *data), int(*conflict_func)(const char *attr_name, const char *attr_val_left, const char *attr_val_ancestor, const char *attr_val_right, void *data), int(*unchgd_func)(const char *attr_name, const char *attr_val_ancestor, void *data), void *client_data)
 
int db_diff_dp (const struct db_i *left_dbip, const struct db_i *right_dbip, const struct directory *left_dp, const struct directory *right_dp, const struct bn_tol *diff_tol, db_compare_criteria_t flags, struct diff_result *result)
 
int db_diff3_dp (const struct db_i *left, const struct db_i *ancestor, const struct db_i *right, const struct directory *left_dp, const struct directory *ancestor_dp, const struct directory *right_dp, const struct bn_tol *diff_tol, db_compare_criteria_t flags, struct diff_result *result)
 
int db_diff (const struct db_i *dbip_left, const struct db_i *dbip_right, const struct bn_tol *diff_tol, db_compare_criteria_t flags, struct bu_ptbl *diff_results)
 
int db_diff3 (const struct db_i *dbip_left, const struct db_i *dbip_ancestor, const struct db_i *dbip_right, const struct bn_tol *diff_tol, db_compare_criteria_t flags, struct bu_ptbl *diff3_results)
 

Detailed Description

Diff interface for comparing geometry.

Definition in file db_diff.h.

Macro Definition Documentation

#define DIFF_EMPTY   0

DIFF bit flags to select various types of results

Definition at line 32 of file db_diff.h.

Referenced by db_avs_diff(), db_avs_diff3(), db_diff(), db_diff3(), db_diff3_dp(), db_diff_dp(), diff_init_result(), and print_diff_summary().

#define DIFF_UNCHANGED   1
#define DIFF_REMOVED   2

Definition at line 34 of file db_diff.h.

#define DIFF_ADDED   4

Definition at line 35 of file db_diff.h.

#define DIFF_CHANGED   8
#define DIFF_CONFLICT   16

Definition at line 37 of file db_diff.h.

Referenced by diff3_dp_attr_conflict().

Enumeration Type Documentation

The flags parameter is a bitfield is used to specify whether to process internal object parameter differences (DB_COMPARE_PARAM), attribute differences (DB_COMPARE_ATTRS), or both (DB_COMPARE_ALL).

Enumerator
DB_COMPARE_ALL 
DB_COMPARE_PARAM 
DB_COMPARE_ATTRS 

Definition at line 72 of file db_diff.h.

Function Documentation

void diff_free_avp ( struct diff_avp attr_result)

Definition at line 258 of file db_diff.c.

References diff_avp::ancestor_value, bu_free(), diff_avp::left_value, diff_avp::name, and diff_avp::right_value.

Referenced by diff_free_result().

Here is the call graph for this function:

void diff_free_result ( struct diff_result result)

Definition at line 299 of file db_diff.c.

References diff_result::attr_diffs, bu_free(), bu_ptbl_free(), BU_PTBL_GET, BU_PTBL_LEN, BU_PUT, diff_free_avp(), diff_result::diff_tol, diff_result::obj_name, and diff_result::param_diffs.

Referenced by db_diff(), db_diff3(), db_diff3_dp(), db_diff_dp(), and main().

Here is the call graph for this function:

int db_avs_diff ( const struct bu_attribute_value_set left_set,
const struct bu_attribute_value_set right_set,
const struct bn_tol diff_tol,
int(*)(const char *attr_name, const char *attr_val, void *data add_func,
int(*)(const char *attr_name, const char *attr_val, void *data del_func,
int(*)(const char *attr_name, const char *attr_val_left, const char *attr_val_right, void *data chgd_func,
int(*)(const char *attr_name, const char *attr_val, void *data unchgd_func,
void *  client_data 
)

Compare two attribute sets.

This function is useful for comparing the contents of two attribute/value sets.

Definition at line 365 of file db_diff.c.

References avpp_val_compare(), BU_AVS_FOR, bu_avs_get(), DIFF_EMPTY, bu_attribute_value_pair::name, diff_avp::state, and bu_attribute_value_pair::value.

Referenced by db_diff_dp().

Here is the call graph for this function:

int db_avs_diff3 ( const struct bu_attribute_value_set left_set,
const struct bu_attribute_value_set ancestor_set,
const struct bu_attribute_value_set right_set,
const struct bn_tol diff_tol,
int(*)(const char *attr_name, const char *attr_val_left, const char *attr_val_right, void *data add_func,
int(*)(const char *attr_name, const char *attr_val_left, const char *attr_val_ancestor, const char *attr_val_right, void *data del_func,
int(*)(const char *attr_name, const char *attr_val_left, const char *attr_val_ancestor, const char *attr_val_right, void *data chgd_func,
int(*)(const char *attr_name, const char *attr_val_left, const char *attr_val_ancestor, const char *attr_val_right, void *data conflict_func,
int(*)(const char *attr_name, const char *attr_val_ancestor, void *data unchgd_func,
void *  client_data 
)

Compare three attribute sets.

int db_diff_dp ( const struct db_i left_dbip,
const struct db_i right_dbip,
const struct directory left_dp,
const struct directory right_dp,
const struct bn_tol diff_tol,
db_compare_criteria_t  flags,
struct diff_result result 
)

Compare two database objects.

This function is useful for comparing two geometry objects and inspecting their differences. Differences are recorded in key=value form based on whether there is a difference added in the right, removed in the right, changed going from left to right, or unchanged.

The flags parameter is a bitfield specifying what type of comparisons to perform. The default is to compare everything and report on any differences encountered.

The same bu_attribute_value_set container may be passed to any of the provided containers to aggregate results. NULL may be passed to not inspect or record information for that type of comparison.

Returns an int with bit flags set according to the above four diff categories.

Negative returns indicate an error.

Definition at line 571 of file db_diff.c.

References diff_result::attr_diffs, diff_result::attr_state, diff_elements::attrs, diff_elements::bin_params, BU_GET, BU_PUT, db_avs_diff(), DB_COMPARE_ALL, DB_COMPARE_ATTRS, DB_COMPARE_PARAM, DIFF_CHANGED, diff_dp_attr_add(), diff_dp_attr_chgd(), diff_dp_attr_del(), diff_dp_attr_unchgd(), DIFF_EMPTY, diff_free_result(), diff_init_result(), DIFF_UNCHANGED, diff_result::dp_left, diff_result::dp_right, free_diff_components(), get_diff_components(), rt_db_internal::idb_minor_type, diff_elements::idb_ptr, diff_elements::intern, diff_result::param_diffs, diff_result::param_state, diff_elements::params, rt_intern_struct_size(), and diff_avp::state.

Referenced by db_diff().

Here is the call graph for this function:

int db_diff3_dp ( const struct db_i left,
const struct db_i ancestor,
const struct db_i right,
const struct directory left_dp,
const struct directory ancestor_dp,
const struct directory right_dp,
const struct bn_tol diff_tol,
db_compare_criteria_t  flags,
struct diff_result result 
)

Compare three database objects.

The flags parameter is a bitfield specifying what type of comparisons to perform. The default is to compare everything and report on any differences encountered.

The same bu_attribute_value_set container may be passed to any of the provided containers to aggregate results. NULL may be passed to not inspect or record information for that type of comparison.

Returns an int with bit flags set according to the above diff3 categories.

Negative returns indicate an error.

Definition at line 926 of file db_diff.c.

References diff_result::attr_diffs, diff_result::attr_state, diff_elements::attrs, diff_elements::bin_params, BU_GET, BU_PUT, db_avs_diff3(), DB_COMPARE_ALL, DB_COMPARE_ATTRS, DB_COMPARE_PARAM, DBI_NULL, diff3_dp_attr_add(), diff3_dp_attr_chgd(), diff3_dp_attr_conflict(), diff3_dp_attr_del(), diff3_dp_attr_unchgd(), DIFF_CHANGED, DIFF_EMPTY, diff_free_result(), diff_init_result(), DIFF_UNCHANGED, diff_result::dp_ancestor, diff_result::dp_left, diff_result::dp_right, free_diff_components(), get_diff_components(), rt_db_internal::idb_minor_type, diff_elements::idb_ptr, diff_elements::intern, diff_result::param_diffs, diff_result::param_state, diff_elements::params, RT_DIR_NULL, rt_intern_struct_size(), and diff_avp::state.

Referenced by db_diff3().

Here is the call graph for this function:

int db_diff ( const struct db_i dbip_left,
const struct db_i dbip_right,
const struct bn_tol diff_tol,
db_compare_criteria_t  flags,
struct bu_ptbl diff_results 
)

Compare two database instances.

All objects in dbip_left are compared against the objects in dbip_right. Every object results in one of four callback functions getting called. Any objects in dbip_right but not in dbip_left cause add_func() to get called. Any objects in dbip_left but not in dbip_right cause del_func() to get called. Objects existing in both (i.e., with the same name) but differing in some fashion cause chgd_func() to get called. If the object exists in both but is unchanged, unch_func() is called. NULL may be passed to skip any callback.

Returns an int with bit flags set according to the above four diff categories.

Negative returns indicate an error.

Definition at line 640 of file db_diff.c.

References bu_free_external(), BU_GET, bu_log(), bu_ptbl_ins(), BU_PUT, directory::d_major_type, directory::d_namep, DB_COMPARE_ALL, DB_COMPARE_ATTRS, DB_COMPARE_PARAM, db_diff_dp(), db_diff_external(), db_get_external(), db_lookup(), DIFF_CHANGED, DIFF_EMPTY, diff_free_result(), diff_init_result(), DIFF_UNCHANGED, FOR_ALL_DIRECTORY_END, FOR_ALL_DIRECTORY_START, and RT_DIR_NULL.

Referenced by main().

Here is the call graph for this function:

int db_diff3 ( const struct db_i dbip_left,
const struct db_i dbip_ancestor,
const struct db_i dbip_right,
const struct bn_tol diff_tol,
db_compare_criteria_t  flags,
struct bu_ptbl diff3_results 
)

Compare three database instances.

This does a "3-way" diff to identify changes in the left and right databases relative to the ancestor database, and provides functional hooks for the various cases.

Returns an int with bit flags set according to the above diff3 categories.

Negative returns indicate an error.

Definition at line 1009 of file db_diff.c.

References bu_free_external(), BU_GET, bu_log(), bu_ptbl_ins(), BU_PUT, directory::d_major_type, directory::d_namep, DB_COMPARE_ALL, DB_COMPARE_ATTRS, DB_COMPARE_PARAM, db_diff3_dp(), db_diff_external(), db_get_external(), db_lookup(), DIFF_CHANGED, DIFF_EMPTY, diff_free_result(), diff_init_result(), DIFF_UNCHANGED, FOR_ALL_DIRECTORY_END, FOR_ALL_DIRECTORY_START, and RT_DIR_NULL.

Here is the call graph for this function: