GdaObject

GdaObject — The base class for many of the library's objects

Functions

Properties

gboolean changed-blocked Read / Write
GdaDict * dict Read / Write / Construct Only
gchar * string-id Read / Write

Signals

void changed Run First
void descr-changed Run First
void destroyed Run First
void id-changed Run First
void name-changed Run First
void owner-changed Run First
void to-be-destroyed Run First

Types and Values

Object Hierarchy

    GObject
    ╰── GdaObject
        ├── GdaHandlerTime
        ├── GdaHandlerBoolean
        ├── GdaHandlerString
        ├── GdaHandlerNumerical
        ├── GdaHandlerBin
        ├── GdaHandlerType
        ├── GdaDataModelRow
        ├── GdaDataModelImport
        ├── GdaParameterList
        ├── GdaDataModelQuery
        ├── GdaDataAccessWrapper
        ├── GdaDataProxy
        ├── GdaDictAggregate
        ├── GdaDictConstraint
        ├── GdaDictDatabase
        ├── GdaDictField
        ├── GdaDictFunction
        ├── GdaDictTable
        ├── GdaDictType
        ├── GdaGraphviz
        ├── GdaObjectRef
        ├── GdaParameter
        ├── GdaQueryObject
        ├── GdaGraph
        ╰── GdaGraphItem

Known Derived Interfaces

GdaObject is required by GdaDataModel, GdaEntity, GdaEntityField and GdaXmlStorage.

Description

This class defines a common behaviour for most of the objects of this library. As the data dictionary is quite dynamic, the default way by which GObjects are managed (referenced and unreferenced when not needed anymore using g_object_[un]ref()) is not enough: sometimes this behaviour should be kept, and sometimes an object's destruction should be forced and all the other reference holders of that object should take appropriate actions and drop their reference on that object.

Just an example to illustrate this: suppose a data type has been removed from the database itself, then the corresponding GdaDictType must be destroyed since it does not represent a valid data type anymore. GdaDictType object are all managed by a GdaDict which has a reference on them. When the GdaDict object does a metadata sychronization (using gda_dict_update_dbms_meta_data()), it calls gda_object_destroy() on the proper GdaDictType which must be destroyed. The other objects which did use tha particular GdaDictType object (such as GdaDictField and GdaDictFunction for example) catch the "destroy" signal which is emitted by the GdaDictType object being destroyed and take appropriate actions (in this case both these objects will destroy themselves and release any reference they had on the GdaDictType object). The reference count of the GdaDictType object being destroyed then should normally reach 0 and the destruction occur as for any other GObject object.

This class also introduces common attributes that can be exploited by the classes inheriting that class, such as:

  • The GdaDict object to which any GdaObject relates

  • The string ID of the object: any string which uniquely identifies a GdaObject within a dictionary

  • The ID as a guint, the name, description and owner attached to the GdaObject.

Functions

gda_object_get_dict ()

GdaDict *
gda_object_get_dict (GdaObject *gdaobj);

Fetch the corresponding GdaDict object.

Parameters

gdaobj

a GdaObject object

 

Returns

the GdaDict object to which gdaobj is attached to


gda_object_set_id ()

void
gda_object_set_id (GdaObject *gdaobj,
                   const gchar *strid);

Sets the string ID of the gdaobj object.

The string ID must be unique for all the objects related to a given GdaDict object.

Parameters

gdaobj

a GdaObject object

 

strid

the string Identifier

 

gda_object_set_name ()

void
gda_object_set_name (GdaObject *gdaobj,
                     const gchar *name);

Sets the name of the GdaObject object. If the name is changed, then the "name_changed" signal is emitted.

Parameters

gdaobj

a GdaObject object

 

gda_object_set_description ()

void
gda_object_set_description (GdaObject *gdaobj,
                            const gchar *descr);

Sets the description of the GdaObject object. If the description is changed, then the "descr_changed" signal is emitted.

Parameters

gdaobj

a GdaObject object

 

gda_object_set_owner ()

void
gda_object_set_owner (GdaObject *gdaobj,
                      const gchar *owner);

Sets the owner of the GdaObject object. If the owner is changed, then the "owner_changed" signal is emitted.

Parameters

gdaobj

a GdaObject object

 

gda_object_get_id ()

const gchar *
gda_object_get_id (GdaObject *gdaobj);

Fetch the string ID of the GdaObject object.

Parameters

gdaobj

a GdaObject object

 

Returns

the id.


gda_object_get_name ()

const gchar *
gda_object_get_name (GdaObject *gdaobj);

Fetch the name of the GdaObject object.

Parameters

gdaobj

a GdaObject object

 

Returns

the object's name.


gda_object_get_description ()

const gchar *
gda_object_get_description (GdaObject *gdaobj);

Fetch the description of the GdaObject object.

Parameters

gdaobj

a GdaObject object

 

Returns

the object's description.


gda_object_get_owner ()

const gchar *
gda_object_get_owner (GdaObject *gdaobj);

Fetch the owner of the GdaObject object.

Parameters

gdaobj

a GdaObject object

 

Returns

the object's owner.


gda_object_destroy ()

void
gda_object_destroy (GdaObject *gdaobj);

Force the gdaobj object to be destroyed, even if we don't have a reference on it (we can't call g_object_unref() then) and even if the object is referenced multiple times by other objects.

The "destroyed" signal is then emitted to tell the other reference holders that the object must be destroyed and that they should give back their reference (using g_object_unref()). However if a reference is still present, the object will not actually be destroyed and will still be alive, but its state may not be deterministic.

This is usefull because sometimes objects need to disappear even if they are referenced by other objects. This usage is the same as with the gtk_widget_destroy() function on widgets.

When this method returns, gdaobj should have been destroyed and should not be used anymore.

Parameters

gdaobj

a GdaObject object

 

gda_object_destroy_check ()

void
gda_object_destroy_check (GdaObject *gdaobj);

Checks that the object has been destroyed, and if not, then calls gda_object_destroy() on it. This is usefull for objects inheriting the GdaObject object to be called first line in their dispose() method.

Parameters

gdaobj

a GdaObject object

 

gda_object_connect_destroy ()

gulong
gda_object_connect_destroy (gpointer gdaobj,
                            GCallback callback,
                            gpointer data);

Connects the "destroy" signal of the gdaobj object but first cheks that gdaobj exists and has not yet been destroyed.

Parameters

gdaobj

a GdaObject object

 

Returns

the handler id of the signal


gda_object_block_changed ()

void
gda_object_block_changed (GdaObject *gdaobj);

No "changed" signal will be emitted.

Parameters

gdaobj

a GdaObject object

 

gda_object_unblock_changed ()

void
gda_object_unblock_changed (GdaObject *gdaobj);

The "changed" signal will again be emitted.

Parameters

gdaobj

a GdaObject object

 

gda_object_dump ()

void
gda_object_dump (GdaObject *gdaobj,
                 guint offset);

Writes a textual description of the object to STDOUT. This function only exists if libergeant is compiled with the "--enable-debug" option. This is a virtual function.

Parameters

gdaobj

a GdaObject object

 

offset

the offset (in caracters) at which the dump will start

 

Types and Values

GdaObject

typedef struct _GdaObject GdaObject;

Property Details

The “changed-blocked” property

  “changed-blocked”          gboolean

Flags: Read / Write

Default value: FALSE


The “dict” property

  “dict”                     GdaDict *

Dictionary to which the object is related.

Flags: Read / Write / Construct Only


The “string-id” property

  “string-id”                gchar *

Flags: Read / Write

Default value: NULL

Signal Details

The “changed” signal

void
user_function (GdaObject *gdaobject,
               gpointer   user_data)

Parameters

dbbase

the object which received the signal.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First


The “descr-changed” signal

void
user_function (GdaObject *gdaobject,
               gpointer   user_data)

Parameters

dbbase

the object which received the signal.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First


The “destroyed” signal

void
user_function (GdaObject *gdaobject,
               gpointer   user_data)

Parameters

dbbase

the object which received the signal.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First


The “id-changed” signal

void
user_function (GdaObject *gdaobject,
               gpointer   user_data)

Parameters

dbbase

the object which received the signal.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First


The “name-changed” signal

void
user_function (GdaObject *gdaobject,
               gpointer   user_data)

Parameters

dbbase

the object which received the signal.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First


The “owner-changed” signal

void
user_function (GdaObject *gdaobject,
               gpointer   user_data)

Parameters

dbbase

the object which received the signal.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First


The “to-be-destroyed” signal

void
user_function (GdaObject *gdaobject,
               gpointer   user_data)

Parameters

gdaobject

the object which received the signal.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First