CpgLink

CpgLink — Information transfer link

Synopsis


#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);

Object Hierarchy

  GObject
   +----CpgObject
         +----CpgLink

Properties

  "from"                     CpgObject*            : Read / Write / Construct
  "to"                       CpgObject*            : Read / Write / Construct

Description

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.

Details

CpgLinkAction

typedef struct _CpgLinkAction CpgLinkAction;


CpgLinkClass

typedef struct {
} CpgLinkClass;


CpgLink

typedef struct _CpgLink CpgLink;


cpg_link_new ()

CpgLink *           cpg_link_new                        (const gchar *id,
                                                         CpgObject *from,
                                                         CpgObject *to);

Create a new CpgLink

id :

the object id

from :

a CpgObject

to :

a CpgObject

Returns :

a new CpgLink

cpg_link_get_from ()

CpgObject *         cpg_link_get_from                   (CpgLink *link);

Returns the from CpgObject of the link

link :

the CpgLink

Returns :

the from CpgObject

cpg_link_get_to ()

CpgObject *         cpg_link_get_to                     (CpgLink *link);

Returns the to CpgObject of the link

link :

the CpgLink

Returns :

the to CpgObject

cpg_link_add_action ()

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

link :

the CpgLink

target :

the target CpgProperty

expression :

the expression to evaluate and push to target

Returns :

the new CpgLinkAction

cpg_link_remove_action ()

gboolean            cpg_link_remove_action              (CpgLink *link,
                                                         CpgLinkAction *action);

Removes an action from the link.

link :

the CpgLink

action :

the CpgLinkAction

Returns :

TRUE if the action was successfully removed

cpg_link_get_actions ()

GSList *            cpg_link_get_actions                (CpgLink *link);

Get link actions

link :

the CpgLink

Returns :

list of CpgLinkAction. The list is owned by the link and should not be freed

cpg_link_action_get_expression ()

CpgExpression *     cpg_link_action_get_expression      (CpgLinkAction *action);

Get the expression associated with the action

action :

the CpgLinkAction

Returns :

the CpgExpression associated with the action. It is owned by the action object and should not be freed.

cpg_link_action_get_target ()

CpgProperty *       cpg_link_action_get_target          (CpgLinkAction *action);

Get the target CpgProperty associated with the action

action :

the CpgLinkAction

Returns :

the target CpgProperty. It is owned by the action object and should not be freed.

cpg_link_action_set_target ()

void                cpg_link_action_set_target          (CpgLinkAction *action,
                                                         CpgProperty *property);

Set the target of the link action to property

action :

a CpgLinkAction

property :

a CpgProperty

Property Details

The "from" property

  "from"                     CpgObject*            : Read / Write / Construct

The from CpgObject


The "to" property

  "to"                       CpgObject*            : Read / Write / Construct

The to CpgObject