NcmModelCtrl

NcmModelCtrl — Control object for testing updates on model status.

Functions

Properties

NcmModel * model Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── NcmModelCtrl

Description

This object is employed to manage the status of a NcmModel. It serves the purpose of checking whether the model has been updated since the last call to ncm_model_ctrl_update(). Calculation objects dependent on the model can utilize this object to determine if updates are necessary.

Functions

ncm_model_ctrl_new ()

NcmModelCtrl *
ncm_model_ctrl_new (NcmModel *model);

Creates a new NcmModelCtrl object.

Parameters

model

a NcmModel or NULL.

[allow-none]

Returns

a NcmModelCtrl.

[transfer full]


ncm_model_ctrl_free ()

void
ncm_model_ctrl_free (NcmModelCtrl *ctrl);

Decreases the reference count of ctrl . If the reference count reaches zero, ctrl is freed.

Parameters

ctrl

a NcmModelCtrl

 

ncm_model_ctrl_clear ()

void
ncm_model_ctrl_clear (NcmModelCtrl **ctrl);

Checks if *ctrl is not NULL, and if so, decreases the reference count of ctrl . If the reference count reaches zero, ctrl is freed. The pointer to ctrl is set to NULL.

Parameters

ctrl

a NcmModelCtrl

 

ncm_model_ctrl_set_model ()

gboolean
ncm_model_ctrl_set_model (NcmModelCtrl *ctrl,
                          NcmModel *model);

Sets the model inside ctrl to model .

Parameters

ctrl

a NcmModelCtrl

 

model

a NcmModel

 

Returns

TRUE if ctrl was updated.


ncm_model_ctrl_force_update ()

void
ncm_model_ctrl_force_update (NcmModelCtrl *ctrl);

Forces an update on ctrl . In practice, this function clears the model inside ctrl and all submodels.

Parameters

ctrl

a NcmModelCtrl

 

ncm_model_ctrl_get_model ()

NcmModel *
ncm_model_ctrl_get_model (NcmModelCtrl *ctrl);

Gets the current model inside ctrl .

Parameters

ctrl

a NcmModelCtrl

 

Returns

a NcmModel.

[transfer full]


ncm_model_ctrl_update ()

gboolean
ncm_model_ctrl_update (NcmModelCtrl *ctrl,
                       NcmModel *model);

Compares the model inside ctrl with model and updates the status of ctrl . If the model inside ctrl differs from model , ctrl is updated, and TRUE is returned. Otherwise, FALSE is returned.

If the model is the same but the model's pkey is different, ctrl is updated, and TRUE is returned. Otherwise, FALSE is returned.

Submodels inside model are also analyzed similarly, and ctrl is updated if necessary. If any submodel is updated, TRUE is returned. Otherwise, FALSE is returned.

Parameters

ctrl

a NcmModelCtrl

 

model

a NcmModel

 

Returns

TRUE if ctrl was updated.


ncm_model_ctrl_model_update ()

gboolean
ncm_model_ctrl_model_update (NcmModelCtrl *ctrl,
                             NcmModel *model);

Same as ncm_model_ctrl_update(), but only checks if the model objects are the same. The pkey is not checked.

Parameters

ctrl

a NcmModelCtrl

 

model

a NcmModel

 

Returns

TRUE if ctrl was updated.


ncm_model_ctrl_model_last_update ()

gboolean
ncm_model_ctrl_model_last_update (NcmModelCtrl *ctrl);

Checks if the main model was updated during the last call to ncm_model_ctrl_update().

Parameters

ctrl

a NcmModelCtrl

 

Returns

TRUE if the main model was updated.


ncm_model_ctrl_model_has_submodel ()

gboolean
ncm_model_ctrl_model_has_submodel (NcmModelCtrl *ctrl,
                                   NcmModelID mid);

Checks if there is a submode inside ctrl model, it is an error to call this function in an empty ctrl .

Parameters

ctrl

a NcmModelCtrl

 

mid

a NcmModelID

 

Returns

TRUE if there is a submodel with mid inside the ctrl model.


ncm_model_ctrl_submodel_last_update ()

gboolean
ncm_model_ctrl_submodel_last_update (NcmModelCtrl *ctrl,
                                     NcmModelID mid);

Checks if the submodel mid was updated during the last call to ncm_model_ctrl_update().

Parameters

ctrl

a NcmModelCtrl

 

mid

a NcmModelID

 

Returns

TRUE if the submodel with mid inside the ctrl model was updated.

Types and Values

NCM_TYPE_MODEL_CTRL

#define NCM_TYPE_MODEL_CTRL (ncm_model_ctrl_get_type ())

NcmModelCtrl

typedef struct _NcmModelCtrl NcmModelCtrl;

Property Details

The “model” property

  “model”                    NcmModel *

Last Model used.

Owner: NcmModelCtrl

Flags: Read / Write