ModelReference

ModelReference — a mutable reference to a ModelObject

Synopsis

                    ModelReference;
                    ModelReferenceClass;
ModelObject *       model_reference_get_value           (ModelReference *reference);
void                model_reference_changed             (ModelReference *reference);

Description

A ModelReference is essentially a variable containing a reference to a ModelObject, or NULL.

The ModelObject that a ModelReference refers to (ie: the value of the reference) can change with time.

The most useful attribute of a ModelReference is that change notification is supported. Whenever the value of the ModelReference changes, the "changed" signal is emitted. The signal is always emitted from the mainloop; never during the execution of method calls on the model.

Details

ModelReference

typedef struct {
  GObject parent_instance;
} ModelReference;

This is an opaque structure; it may not be accessed directly.


ModelReferenceClass

typedef struct {
  GObjectClass parent_class;

  ModelObject * (*get_value) (ModelReference *reference);
} ModelReferenceClass;

The class structure for ModelReference. All virtual functions must be implemented by each subclass.

GObjectClass parent_class;

get_value ()

virtual function pointer for model_reference_get_value()

model_reference_get_value ()

ModelObject *       model_reference_get_value           (ModelReference *reference);

Reads the current value of the reference. This is essentially the dereference operation.

It is appropriate for the caller to call g_object_unref() on the return value.

reference :

a ModelReference

returns :

the current value of the reference, owned by the caller

model_reference_changed ()

void                model_reference_changed             (ModelReference *reference);

Emits the "changed" signal on reference. This should be done whenever the reference takes on a new value (ie: model_reference_get_value() will return something different than last time).

This function should only be called by model implementations.

reference :

a ModelReference