Top |
Types and Values
#define | GDA_DATA_COMPARATOR_ERROR |
enum | GdaDataComparatorError |
enum | GdaDiffType |
GdaDiff |
Description
The GdaDataComparator is a simple object which takes two GdaDataModel objects and compare them.
Actual comparison is performed when the gda_data_comparator_compute_diff()
is called; for each
difference found, the diff-computed signal
is emitted (any user installed signal handler which returns FALSE stops the computing process).
There are some limitations to this object:
The data models compared must have the same number and type of columns
The comparison is done column-for-column: one cannot omit columns in the comparison, nor compare columns with different positions
Functions
gda_data_comparator_new ()
GObject * gda_data_comparator_new (GdaDataModel *old_model
,GdaDataModel *new_model
);
Creates a new comparator to compute the differences from old_model
to new_model
: if one applies
all the computed differences (as GdaDiff structures) to old_model
, the resulting data model
should have the same contents as new_model
.
gda_data_comparator_set_key_columns ()
void gda_data_comparator_set_key_columns (GdaDataComparator *comp
,const gint *col_numbers
,gint nb_cols
);
Defines the columns which will be used as a key when searching data. This is not mandatory but will speed things up as less data will be processed.
Parameters
comp |
a GdaDataComparator object |
|
nb_cols |
the size of the |
|
col_numbers |
an array of |
[array length=nb_cols] |
gda_data_comparator_compute_diff ()
gboolean gda_data_comparator_compute_diff (GdaDataComparator *comp
,GError **error
);
Actually computes the differences between the data models for which comp
is defined.
For each difference computed, stored in a GdaDiff structure, the "diff-computed" signal is emitted. If one connects to this signal and returns FALSE in the signal handler, then computing differences will be stopped and an error will be returned.
gda_data_comparator_get_n_diffs ()
gint
gda_data_comparator_get_n_diffs (GdaDataComparator *comp
);
Get the number of differences as computed by the last time gda_data_comparator_compute_diff()
was called.
gda_data_comparator_get_diff ()
const GdaDiff * gda_data_comparator_get_diff (GdaDataComparator *comp
,gint pos
);
Get a pointer to the GdaDiff structure representing the difference which number is pos
Signal Details
The “diff-computed”
signal
gboolean user_function (GdaDataComparator *gdadatacomparator, gpointer arg1, gpointer user_data)
Flags: Run Last