CpgProperty

CpgProperty — Property container

Synopsis


#include <cpg-network/cpg-property.h>

enum                CpgPropertyHint;
                    CpgProperty;
CpgProperty *       cpg_property_new                    (const gchar *name,
                                                         const gchar *expression,
                                                         gboolean integrated,
                                                         CpgObject *object);
const gchar *       cpg_property_get_name               (CpgProperty *property);
gboolean            cpg_property_get_integrated         (CpgProperty *property);
void                cpg_property_set_integrated         (CpgProperty *property,
                                                         gboolean integrated);
CpgPropertyHint     cpg_property_get_hint               (CpgProperty *property);
void                cpg_property_set_hint               (CpgProperty *property,
                                                         CpgPropertyHint hint);
void                cpg_property_add_hint               (CpgProperty *property,
                                                         CpgPropertyHint hint);
void                cpg_property_remove_hint            (CpgProperty *property,
                                                         CpgPropertyHint hint);
void                cpg_property_reset_cache            (CpgProperty *property);
gdouble             cpg_property_get_value              (CpgProperty *property);
CpgExpression *     cpg_property_get_value_expression   (CpgProperty *property);
void                cpg_property_set_value              (CpgProperty *property,
                                                         gdouble value);
void                cpg_property_set_value_expression   (CpgProperty *property,
                                                         const gchar *expression);
gboolean            cpg_property_equal                  (CpgProperty *property,
                                                         CpgProperty *other);
guint               cpg_property_get_used               (CpgProperty *property);

Description

A CpgProperty is a container for a specific variable in an object. It consists of a name and a mathematical expression describing its contents.

Details

enum CpgPropertyHint

typedef enum
{
	CPG_PROPERTY_HINT_NONE = 0,
	CPG_PROPERTY_HINT_IN = 1 << 0,
	CPG_PROPERTY_HINT_OUT = 1 << 1,
	CPG_PROPERTY_HINT_ONCE = 1 << 2
} CpgPropertyHint;


CpgProperty

typedef struct _CpgProperty CpgProperty;


cpg_property_new ()

CpgProperty *       cpg_property_new                    (const gchar *name,
                                                         const gchar *expression,
                                                         gboolean integrated,
                                                         CpgObject *object);

Create a new property object. Property objects are assigned to CpgObject objects and are of little use on their own. The provided expression will not be parsed initially.

name :

the property name

expression :

the value expression

integrated :

whether this property should be integated during the simulation

object :

the CpgObject to which the property belongs

Returns :

the new CpgProperty

cpg_property_get_name ()

const gchar *       cpg_property_get_name               (CpgProperty *property);

Get the property name

property :

a CpgProperty

Returns :

the property name

cpg_property_get_integrated ()

gboolean            cpg_property_get_integrated         (CpgProperty *property);

Get whether the property should be integrated during evaluation or not

property :

a CpgProperty

Returns :

TRUE if the property will be integrated, FALSE otherwise

cpg_property_set_integrated ()

void                cpg_property_set_integrated         (CpgProperty *property,
                                                         gboolean integrated);

Set whether the property should be integrated during evaluation or not

property :

a CpgProperty

integrated :

integrate the property

cpg_property_get_hint ()

CpgPropertyHint     cpg_property_get_hint               (CpgProperty *property);

The property hint. The hint contains information on the type of property ( such as in, or out).

property :

A CpgProperty

Returns :

A CpgPropertyHint

cpg_property_set_hint ()

void                cpg_property_set_hint               (CpgProperty *property,
                                                         CpgPropertyHint hint);

Set the property hint.

property :

A CpgProperty

hint :

A CpgPropertyHint

cpg_property_add_hint ()

void                cpg_property_add_hint               (CpgProperty *property,
                                                         CpgPropertyHint hint);

Add a hint flag to the property hints.

property :

A CpgProperty

hint :

A CpgPropertyHint

cpg_property_remove_hint ()

void                cpg_property_remove_hint            (CpgProperty *property,
                                                         CpgPropertyHint hint);

Remove a hint flag from the property hints.

property :

A CpgProperty

hint :

A CpgPropertyHint

cpg_property_reset_cache ()

void                cpg_property_reset_cache            (CpgProperty *property);

Reset the cached value of the property expression

property :

a CpgProperty

cpg_property_get_value ()

gdouble             cpg_property_get_value              (CpgProperty *property);

Get the numerical value of the current value of the property

property :

the CpgProperty

Returns :

the numerical value of the property's current value

cpg_property_get_value_expression ()

CpgExpression *     cpg_property_get_value_expression   (CpgProperty *property);

Get the property value expression

property :

a CpgProperty

Returns :

a CpgExpression. The expression is owned by the property and should not be freed

cpg_property_set_value ()

void                cpg_property_set_value              (CpgProperty *property,
                                                         gdouble value);

Change the value to a specific number. To set the value to any expression, use cpg_object_set_value.

property :

the CpgProperty

value :

the new value

cpg_property_set_value_expression ()

void                cpg_property_set_value_expression   (CpgProperty *property,
                                                         const gchar *expression);

Set the property value from an expression. This will mark the associated CpgObject as tainted so the expression will be recompiled accordingly.

property :

a CpgProperty

expression :

the expression

cpg_property_equal ()

gboolean            cpg_property_equal                  (CpgProperty *property,
                                                         CpgProperty *other);

Compare two properties for equal values/expressions

property :

a CpgProperty

other :

a CpgProperty

Returns :

TRUE if the properties are equal, FALSE otherwise

cpg_property_get_used ()

guint               cpg_property_get_used               (CpgProperty *property);

Get how many times the property is used currently.

property :

A CpgProperty

Returns :

The number of times the property is used