Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions

# Gnome::Gda::DataComparator Class Reference
[Data Handlers]

Simple data model's contents comparison. More...

Inheritance diagram for Gnome::Gda::DataComparator:
[legend]
Collaboration diagram for Gnome::Gda::DataComparator:
[legend]

List of all members.

## Public Member Functions
virtual | ~DataComparator ()
GdaDataComparator* | gobj ()
| Provides access to the underlying C GObject.
const GdaDataComparator* | gobj () const
| Provides access to the underlying C GObject.
GdaDataComparator* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
void | set_key_for_columns (const Glib::ArrayHandle< int >& col_numbers, int nb_cols)
| Defines the columns which will be used as a key when searching data.
bool | compute_diff ()
| Actually computes the differences between the data models for which comp is defined.
int | get_n_diffs () const
| Get the number of differences as computed by the last time compute_diff() was called.
const Diff* | get_diff (int pos)
| Get a pointer to the Gda::Diff structure representing the difference which number is pos.
Glib::PropertyProxy < Glib::RefPtr< DataModel > > | property_old_model ()
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly < Glib::RefPtr< DataModel > > | property_old_model () const
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy < Glib::RefPtr< DataModel > > | property_new_model ()
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly < Glib::RefPtr< DataModel > > | property_new_model () const
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::SignalProxy1< bool, Diff* > | signal_diff_computed ()
## Static Public Member Functions
static Glib::RefPtr < DataComparator > | create (const Glib::RefPtr< DataModel >& old_model, const Glib::RefPtr< DataModel >& new_model)
## Protected Member Functions
| DataComparator (const Glib::RefPtr< DataModel >& old_model, const Glib::RefPtr< DataModel >& new_model)
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr < Gnome::Gda::DataComparator > | wrap (GdaDataComparator* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Simple data model's contents comparison.

The DataComparator is a simple object which takes two DataModel objects and compare them. Actual comparison is performed when the 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).

After the differences have been computed, they can each be accessed using gda_data_comparator_get_diff(), the number of differences found being returned by gda_data_comparator_get_n_diffs(). 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

## Constructor & Destructor Documentation

virtual Gnome::Gda::DataComparator::~DataComparator | ( | ) | `[virtual]`

Gnome::Gda::DataComparator::DataComparator | ( | const Glib::RefPtr< DataModel >& | old_model,
|  | const Glib::RefPtr< DataModel >& | new_model
| ) |  | `[explicit, protected]`

## Member Function Documentation

bool Gnome::Gda::DataComparator::compute_diff | ( | ) |

Actually computes the differences between the data models for which comp is defined.

For each difference computed, stored in a Gda::Diff 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.

Returns:
  `true` if all the differences have been sucessfully computed, and `false` if an error occurred.

static Glib::RefPtr<DataComparator> Gnome::Gda::DataComparator::create | ( | const Glib::RefPtr< DataModel >& | old_model,
|  | const Glib::RefPtr< DataModel >& | new_model
| ) |  | `[static]`

const Diff* Gnome::Gda::DataComparator::get_diff | ( | int | pos ) |

Get a pointer to the Gda::Diff structure representing the difference which number is pos.

Parameters:

  pos | The requested difference number (starting at 0).

Returns:
  A pointer to a Gda::Diff, or `0` if pos is invalid.

int Gnome::Gda::DataComparator::get_n_diffs | ( | ) | const

Get the number of differences as computed by the last time compute_diff() was called.

Returns:
  The number of computed differences.

GdaDataComparator* Gnome::Gda::DataComparator::gobj | ( | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gnome::Gda::DataModel.

const GdaDataComparator* Gnome::Gda::DataComparator::gobj | ( | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gnome::Gda::DataModel.

GdaDataComparator* Gnome::Gda::DataComparator::gobj_copy | ( | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<DataModel> > Gnome::Gda::DataComparator::property_new_model | ( | ) | const

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< Glib::RefPtr<DataModel> > Gnome::Gda::DataComparator::property_new_model | ( | ) |

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< Glib::RefPtr<DataModel> > Gnome::Gda::DataComparator::property_old_model | ( | ) |

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<DataModel> > Gnome::Gda::DataComparator::property_old_model | ( | ) | const

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

void Gnome::Gda::DataComparator::set_key_for_columns | ( | const Glib::ArrayHandle< int > & | col_numbers,
|  | int | 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:

  nb_cols | The size of the col_numbers array.
  col_numbers | An array of nb_cols values.

Glib::SignalProxy1< bool,Diff* > Gnome::Gda::DataComparator::signal_diff_computed | ( | ) |

Prototype:
  `bool on_my_diff_computed(Diff* diff)`

## Friends And Related Function Documentation

Glib::RefPtr< Gnome::Gda::DataComparator > wrap | ( | GdaDataComparator * | object,
|  | bool | take_copy = `false`
| ) |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- libgdamm/datacomparator.h