BRL-CAD
db_diff.h File Reference
#include "common.h"
#include "bu/avs.h"
#include "bu/ptbl.h"
#include "bn/tol.h"
#include "rt/defines.h"
#include "rt/db_instance.h"
Include dependency graph for db_diff.h:

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

◆ DIFF_EMPTY

#define DIFF_EMPTY   0

DIFF bit flags to select various types of results

Definition at line 41 of file db_diff.h.

◆ DIFF_UNCHANGED

#define DIFF_UNCHANGED   1

Definition at line 42 of file db_diff.h.

◆ DIFF_REMOVED

#define DIFF_REMOVED   2

Definition at line 43 of file db_diff.h.

◆ DIFF_ADDED

#define DIFF_ADDED   4

Definition at line 44 of file db_diff.h.

◆ DIFF_CHANGED

#define DIFF_CHANGED   8

Definition at line 45 of file db_diff.h.

◆ DIFF_CONFLICT

#define DIFF_CONFLICT   16

Definition at line 46 of file db_diff.h.

Enumeration Type Documentation

◆ db_compare_criteria_t

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

Function Documentation

◆ diff_init_avp()

void diff_init_avp ( struct diff_avp attr_result)

◆ diff_free_avp()

void diff_free_avp ( struct diff_avp attr_result)

◆ diff_init_result()

void diff_init_result ( struct diff_result result,
const struct bn_tol curr_diff_tol,
const char *  object_name 
)

◆ diff_free_result()

void diff_free_result ( struct diff_result result)

◆ db_avs_diff()

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.

◆ db_avs_diff3()

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.

◆ db_diff_dp()

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.

◆ db_diff3_dp()

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.

◆ db_diff()

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.

◆ db_diff3()

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.