![]() |
![]() |
![]() |
cpg-network Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties | Signals |
#define CPG_LINK_CONST (obj) struct CpgLink; struct CpgLinkClass; CpgLink * cpg_link_new (const gchar *id
,CpgObject *from
,CpgObject *to
); CpgObject * cpg_link_get_from (CpgLink *link
); CpgObject * cpg_link_get_to (CpgLink *link
); gboolean cpg_link_add_action (CpgLink *link
,CpgLinkAction *action
); gboolean cpg_link_remove_action (CpgLink *link
,CpgLinkAction *action
); const GSList * cpg_link_get_actions (CpgLink *link
); CpgLinkAction * cpg_link_get_action (CpgLink *link
,const gchar *target
); void cpg_link_attach (CpgLink *link
,CpgObject *from
,CpgObject *to
); CpgLink * cpg_link_get_action_template (CpgLink *link
,CpgLinkAction *action
,gboolean match_full
); CpgLinkPrivate;
A CpgLink is a connection between two CpgObject. The link defines actions which consist of a target property in the object to which the link is connected, and an expression by which this target property needs to be updated.
#define CPG_LINK_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CPG_TYPE_LINK, CpgLink const))
CpgLink * cpg_link_new (const gchar *id
,CpgObject *from
,CpgObject *to
);
Create a new CpgLink
|
the object id |
|
a CpgObject. [allow-none] |
|
a CpgObject. [allow-none] |
Returns : |
a new CpgLink |
CpgObject * cpg_link_get_from (CpgLink *link
);
Returns the from CpgObject of the link
|
the CpgLink |
Returns : |
the from CpgObject. [transfer none] |
CpgObject * cpg_link_get_to (CpgLink *link
);
Returns the to CpgObject of the link
|
the CpgLink |
Returns : |
the to CpgObject. [transfer none] |
gboolean cpg_link_add_action (CpgLink *link
,CpgLinkAction *action
);
Add a new action to be performed when the link is evaluated during
simulation. Note that if an action with the same
target already exists, the action information is transfered to the existing
action instance. This means that the specified action
might not actually
be added to the object. Also, since a CpgLinkAction is a GInitiallyUnowned,
action
will be destroyed after the call to cpg_link_add_action in
the above described case, unless you explicitly sink the floating reference.
In the case that you can not know whether an action is overriding an
existing action in link
, never use action
after a call to
cpg_link_add_action. Instead, retrieve the corresponding action
using cpg_link_get_action after the call to cpg_link_add_action.
|
the CpgLink |
|
the CpgLinkAction |
Returns : |
TRUE if action could be successfully added, FALSE otherwise |
gboolean cpg_link_remove_action (CpgLink *link
,CpgLinkAction *action
);
Removes an action from the link.
|
the CpgLink |
|
the CpgLinkAction |
Returns : |
TRUE if the action was successfully removed |
const GSList * cpg_link_get_actions (CpgLink *link
);
Get link actions
|
the CpgLink |
Returns : |
list of CpgLinkAction. The list is owned by the link and should not be freed. [element-type CpgLinkAction][transfer none] |
CpgLinkAction * cpg_link_get_action (CpgLink *link
,const gchar *target
);
Get a CpgLinkAction targetting the property target
.
|
A CpgLink |
|
The target property name |
Returns : |
A CpgLinkAction. [transfer none] |
void cpg_link_attach (CpgLink *link
,CpgObject *from
,CpgObject *to
);
Attach link
to the objects from
and to
. This is equivalent to:
1 |
g_object_set (link, "from", from, "to", to); |
|
A CpgLink. [allow-none] |
|
A CpgObject. [allow-none] |
|
A CpgObject |
CpgLink * cpg_link_get_action_template (CpgLink *link
,CpgLinkAction *action
,gboolean match_full
);
Get the template on which action
is defined, if any. If match_full
is
TRUE
, the template will only be possitively matched if both actions are
equal (i.e. if an action originated from a template, but was later modified,
this function will not return the original template object).
|
A CpgLink |
|
A CpgLinkAction |
|
How to match the action |
Returns : |
A CpgLink or NULL if the template could not be found. [transfer none]
|
"action-added"
signalvoid user_function (CpgLink *object,
CpgLinkAction *action,
gpointer user_data) : Run Last
Emitted when a link action is added to the link
|
a CpgObject |
|
the added CpgLinkAction |
|
user data set when the signal handler was connected. |
"action-removed"
signalvoid user_function (CpgLink *object,
CpgLinkAction *action,
gpointer user_data) : Run Last
Emitted when a link action is removed from the link
|
a CpgObject |
|
the removed CpgLinkAction |
|
user data set when the signal handler was connected. |