![]() |
![]() |
![]() |
cpg-network Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties | Signals |
#define CPG_PROPERTY_CONST (obj) enum CpgPropertyFlags; struct CpgProperty; struct CpgPropertyClass; CpgProperty * cpg_property_new (const gchar *name
,const gchar *expression
,CpgPropertyFlags flags
); const gchar * cpg_property_get_name (CpgProperty *property
); gboolean cpg_property_set_name (CpgProperty *property
,const gchar *name
); gboolean cpg_property_get_integrated (CpgProperty *property
); void cpg_property_set_integrated (CpgProperty *property
,gboolean integrated
); CpgPropertyFlags cpg_property_get_flags (CpgProperty *property
); void cpg_property_set_flags (CpgProperty *property
,CpgPropertyFlags flags
); void cpg_property_add_flags (CpgProperty *property
,CpgPropertyFlags flags
); void cpg_property_remove_flags (CpgProperty *property
,CpgPropertyFlags flags
); void cpg_property_reset (CpgProperty *property
); gdouble cpg_property_get_value (CpgProperty *property
); CpgExpression * cpg_property_get_expression (CpgProperty *property
); void cpg_property_set_value (CpgProperty *property
,gdouble value
); void cpg_property_apply_constraint (CpgProperty *property
); void cpg_property_set_expression (CpgProperty *property
,CpgExpression *expression
); void cpg_property_set_constraint (CpgProperty *property
,CpgExpression *expression
); CpgExpression * cpg_property_get_constraint (CpgProperty *property
); gboolean cpg_property_equal (CpgProperty *property
,CpgProperty *other
); void cpg_property_set_update (CpgProperty *property
,gdouble value
); gdouble cpg_property_get_update (CpgProperty *property
); gchar * cpg_property_flags_to_string (CpgPropertyFlags add_flags
,CpgPropertyFlags remove_flags
); void cpg_property_flags_from_string (const gchar *flags
,CpgPropertyFlags *add_flags
,CpgPropertyFlags *remove_flags
); gchar * cpg_property_get_full_name (CpgProperty *property
); gchar * cpg_property_get_full_name_for_display (CpgProperty *property
); CpgProperty * cpg_property_copy (CpgProperty *property
); CpgPropertyPrivate;
CpgProperty implements CpgUsable, CpgModifiable, CpgAnnotatable and CpgTaggable.
"constraint" CpgExpression* : Read / Write / Construct "expression" CpgExpression* : Read / Write / Construct "flags" CpgPropertyFlags : Read / Write / Construct "name" gchar* : Read / Write / Construct "object" CpgObject* : Read / Write / Construct
A CpgProperty is a container for a specific variable in an object. It consists of a name and a mathematical expression describing its contents.
#define CPG_PROPERTY_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CPG_TYPE_PROPERTY, CpgProperty const))
typedef enum { CPG_PROPERTY_FLAG_NONE = 0, CPG_PROPERTY_FLAG_INTEGRATED = 1 << 0, CPG_PROPERTY_FLAG_IN = 1 << 1, CPG_PROPERTY_FLAG_OUT = 1 << 2, CPG_PROPERTY_FLAG_ONCE = 1 << 3, CPG_PROPERTY_FLAG_INOUT = CPG_PROPERTY_FLAG_IN | CPG_PROPERTY_FLAG_OUT } CpgPropertyFlags;
Property flags.
struct CpgPropertyClass { /* signals */ gboolean (*invalidate_name) (CpgProperty *property, const gchar *name); void (*expression_changed) (CpgProperty *property, CpgExpression *expression); void (*flags_changed) (CpgProperty *property, CpgPropertyFlags flags); };
CpgProperty * cpg_property_new (const gchar *name
,const gchar *expression
,CpgPropertyFlags flags
);
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.
|
the property name |
|
the value expression |
|
the property flags |
Returns : |
the new CpgProperty |
const gchar * cpg_property_get_name (CpgProperty *property
);
Get the property name
|
a CpgProperty |
Returns : |
the property name. [transfer none] |
gboolean cpg_property_set_name (CpgProperty *property
,const gchar *name
);
Set a new name for a property.
|
A CpgProperty |
|
The new property name |
Returns : |
TRUE if the name could be successfully changed, FALSE otherwise |
gboolean cpg_property_get_integrated (CpgProperty *property
);
Get whether the property should be integrated during evaluation or not. This is a convenience function that simply checks if the CPG_PROPERTY_FLAG_INTEGRATED flag is set.
|
a CpgProperty |
Returns : |
TRUE if the property will be integrated, FALSE otherwise |
void cpg_property_set_integrated (CpgProperty *property
,gboolean integrated
);
Set whether the property should be integrated during evaluation or not. This is a convenience function that simply sets or unsets the CPG_PROPERTY_FLAG_INTEGRATED flag.
|
a CpgProperty |
|
integrate the property |
CpgPropertyFlags cpg_property_get_flags (CpgProperty *property
);
The property flags. The flags contains information on the type of property ( such as in, or out).
|
A CpgProperty |
Returns : |
A CpgPropertyFlags |
void cpg_property_set_flags (CpgProperty *property
,CpgPropertyFlags flags
);
Set the property flags.
|
A CpgProperty |
|
A CpgPropertyFlags |
void cpg_property_add_flags (CpgProperty *property
,CpgPropertyFlags flags
);
Add a flags flag to the property flagss.
|
A CpgProperty |
|
A CpgPropertyFlags |
void cpg_property_remove_flags (CpgProperty *property
,CpgPropertyFlags flags
);
Remove a flags flag from the property flagss.
|
A CpgProperty |
|
A CpgPropertyFlags |
void cpg_property_reset (CpgProperty *property
);
Reset the property. This will reset the value of the property to the stored string representation.
|
A CpgProperty |
gdouble cpg_property_get_value (CpgProperty *property
);
Get the numerical value of the current value of the property
|
the CpgProperty |
Returns : |
the numerical value of the property's current value |
CpgExpression * cpg_property_get_expression (CpgProperty *property
);
Get the property value expression
|
a CpgProperty |
Returns : |
a CpgExpression. The expression is owned by the property and should not be freed. [transfer none] |
void cpg_property_set_value (CpgProperty *property
,gdouble value
);
Change the value to a specific number.
|
the CpgProperty |
|
the new value |
void cpg_property_set_expression (CpgProperty *property
,CpgExpression *expression
);
Set the property value from an expression.
|
a CpgProperty |
|
the expression |
void cpg_property_set_constraint (CpgProperty *property
,CpgExpression *expression
);
Set the property constraint from an expression.
|
a CpgProperty |
|
the constraint expression |
CpgExpression * cpg_property_get_constraint (CpgProperty *property
);
Get the property value constraint expression
|
a CpgProperty |
Returns : |
a CpgExpression. The expression is owned by the property and should not be freed. [transfer none] |
gboolean cpg_property_equal (CpgProperty *property
,CpgProperty *other
);
Compare two properties for equal values/expressions
|
a CpgProperty |
|
a CpgProperty |
Returns : |
TRUE if the properties are equal, FALSE otherwise |
void cpg_property_set_update (CpgProperty *property
,gdouble value
);
Set the update value of the property. The update value is used to store the result of differential equations on the property/ You normally do not need to use this function.
|
A CpgProperty |
|
The update value |
gdouble cpg_property_get_update (CpgProperty *property
);
Get the update value of a property. The update value is used to store the result of differential equations on the property. You normally do not need to use this function.
|
A CpgProperty |
Returns : |
The update value |
gchar * cpg_property_flags_to_string (CpgPropertyFlags add_flags
,CpgPropertyFlags remove_flags
);
Convert flags to a string representation.
Returns : |
the string representation of the flags |
void cpg_property_flags_from_string (const gchar *flags
,CpgPropertyFlags *add_flags
,CpgPropertyFlags *remove_flags
);
Parse a string into a set of property flags. The flags can be specified by their nicks (none, in, out, once, integrated) and separated by any combination of spaces, comma's and/or pipes.
|
The flags to parse |
gchar * cpg_property_get_full_name (CpgProperty *property
);
Get the full name of the property. This is the name that can be used in the
outer most parent to refer to this property (i.e.
cpg_group_find_property (top_parent, cpg_property_get_full_name (deep_property)) == deep_property
)
|
A CpgProperty |
Returns : |
The full name of the property. This is a newly allocated string that should be freed with g_free. |
gchar * cpg_property_get_full_name_for_display
(CpgProperty *property
);
CpgProperty * cpg_property_copy (CpgProperty *property
);
Make a copy of property
.
|
A CpgProperty |
Returns : |
A CpgProperty. [transfer full] |
"expression"
property"expression" CpgExpression* : Read / Write / Construct
The property expression
"object"
property"object" CpgObject* : Read / Write / Construct
The object on which the property is defined
"expression-changed"
signalvoid user_function (CpgProperty *cpgproperty,
CpgExpression *arg1,
gpointer user_data) : Run Last
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"flags-changed"
signalvoid user_function (CpgProperty *cpgproperty,
CpgPropertyFlags arg1,
gpointer user_data) : Run Last
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"invalidate-name"
signalgboolean user_function (CpgProperty *property,
gchar *name,
gpointer user_data) : Run Last
This signal is emitted to validate (or rather, invalidate) a new
name for a property. When a signal handler returns TRUE
,
the new name is rejected.
|
a CpgProperty |
|
the new property name |
|
user data set when the signal handler was connected. |
Returns : |
TRUE if the new name should be rejected, FALSE otherwise |