![]() |
![]() |
![]() |
cpg-network Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties |
#include <cpg-network/cpg-link.h> CpgLinkAction; CpgLinkClass; CpgLink; 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); CpgLinkAction * cpg_link_add_action (CpgLink *link, CpgProperty *target, const gchar *expression); gboolean cpg_link_remove_action (CpgLink *link, CpgLinkAction *action); GSList * cpg_link_get_actions (CpgLink *link); CpgExpression * cpg_link_action_get_expression (CpgLinkAction *action); CpgProperty * cpg_link_action_get_target (CpgLinkAction *action); void cpg_link_action_set_target (CpgLinkAction *action, CpgProperty *property);
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.
CpgLink * cpg_link_new (const gchar *id, CpgObject *from, CpgObject *to);
Create a new CpgLink
CpgObject * cpg_link_get_from (CpgLink *link);
Returns the from CpgObject of the link
CpgObject * cpg_link_get_to (CpgLink *link);
Returns the to CpgObject of the link
CpgLinkAction * cpg_link_add_action (CpgLink *link, CpgProperty *target, const gchar *expression);
Add a new action to be performed when the link is evaluated during simulation. An action consists of a target property and an expression who's result will be pushed in the target at every simulation step
|
the CpgLink |
|
the target CpgProperty |
|
the expression to evaluate and push to target
|
Returns : |
the new CpgLinkAction |
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
|
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 |
CpgExpression * cpg_link_action_get_expression (CpgLinkAction *action);
Get the expression associated with the action
|
the CpgLinkAction |
Returns : |
the CpgExpression associated with the action. It is owned by the action object and should not be freed. |
CpgProperty * cpg_link_action_get_target (CpgLinkAction *action);
Get the target CpgProperty associated with the action
|
the CpgLinkAction |
Returns : |
the target CpgProperty. It is owned by the action object and should not be freed. |
void cpg_link_action_set_target (CpgLinkAction *action, CpgProperty *property);
Set the target of the link action to property
|
a CpgLinkAction |
|
a CpgProperty |