CpgOperator

CpgOperator

Synopsis

#define             CPG_OPERATOR_CONST                  (obj)
struct              CpgOperator;
struct              CpgOperatorClass;
void                cpg_operator_initialize             (CpgOperator *op,
                                                         GSList const *expressions);
void                cpg_operator_execute                (CpgOperator *op,
                                                         CpgStack *stack);
void                cpg_operator_reset_cache            (CpgOperator *op);
void                cpg_operator_reset_variadic         (CpgOperator *op);
gchar const         * cpg_operator_get_name             (CpgOperator *op);
gchar const         * cpg_operator_get_class_name       (CpgOperatorClass *op);
gboolean            cpg_operator_validate_num_arguments (CpgOperatorClass *op,
                                                         gint num);
GSList const        * cpg_operator_get_expressions      (CpgOperator *op);
gboolean            cpg_operator_equal                  (CpgOperator *op,
                                                         CpgOperator *other);
void                cpg_operator_step                   (CpgOperator *op,
                                                         struct _CpgIntegrator *integrator,
                                                         gdouble t,
                                                         gdouble timestep);
void                cpg_operator_step_prepare           (CpgOperator *op,
                                                         struct _CpgIntegrator *integrator,
                                                         gdouble t,
                                                         gdouble timestep);
void                cpg_operator_step_evaluate          (CpgOperator *op,
                                                         struct _CpgIntegrator *integrator,
                                                         gdouble t,
                                                         gdouble timestep);
void                cpg_operator_reset                  (CpgOperator *op);
CpgOperator *       cpg_operator_copy                   (CpgOperator *op);
                    CpgOperatorPrivate;
                    CpgOperatorClassPrivate;

Object Hierarchy

  GObject
   +----CpgOperator
         +----CpgOperatorDelayed
         +----CpgOperatorDiff

Description

Details

CPG_OPERATOR_CONST()

#define CPG_OPERATOR_CONST(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), CPG_TYPE_OPERATOR, CpgOperator const))


struct CpgOperator

struct CpgOperator;


struct CpgOperatorClass

struct CpgOperatorClass {
	void             (*execute)     (CpgOperator     *op,
	                                 CpgStack        *stack);

	void             (*initialize) (CpgOperator *op,
	                                GSList const *expressions);

	gchar           *(*get_name) ();

	gboolean         (*validate_num_arguments) (gint         num);

	void             (*reset_cache) (CpgOperator     *op);

	void             (*reset_variadic) (CpgOperator     *op);

	void             (*reset)           (CpgOperator *op);

	void             (*step)            (CpgOperator *op,
	                                     struct _CpgIntegrator *integrator,
	                                     gdouble      t,
	                                     gdouble      timestep);

	void             (*step_prepare)    (CpgOperator *op,
	                                     struct _CpgIntegrator *integrator,
	                                     gdouble      t,
	                                     gdouble      timestep);

	void             (*step_evaluate)   (CpgOperator *op,
	                                     struct _CpgIntegrator *integrator,
	                                     gdouble      t,
	                                     gdouble      timestep);

	gboolean         (*equal)           (CpgOperator *op,
	                                     CpgOperator *other);
};


cpg_operator_initialize ()

void                cpg_operator_initialize             (CpgOperator *op,
                                                         GSList const *expressions);


cpg_operator_execute ()

void                cpg_operator_execute                (CpgOperator *op,
                                                         CpgStack *stack);

Execute the operator. This function should always be overridden by operator implementations and should always push exactly one number on the stack.

op :

A CpgOperator

stack :

A CpgStack

cpg_operator_reset_cache ()

void                cpg_operator_reset_cache            (CpgOperator *op);

Reset the cache of the operator instance.

op :

A CpgOperator

cpg_operator_reset_variadic ()

void                cpg_operator_reset_variadic         (CpgOperator *op);

Reset the variadic cache of the operator instance.

op :

A CpgOperator

cpg_operator_get_name ()

gchar const         * cpg_operator_get_name             (CpgOperator *op);

Get the operator name. This is the identifier that is used in expressions, and thus can only contain valid identifier characters.

op :

A CpgOperator

Returns :

a newly allocated string with the operator name, use g_free to free the value when it's no longer needed.

cpg_operator_get_class_name ()

gchar const         * cpg_operator_get_class_name       (CpgOperatorClass *op);

Get the operator name. This is the identifier that is used in expressions, and thus can only contain valid identifier characters.

op :

A CpgOperatorClass

Returns :

a newly allocated string with the operator name, use g_free to free the value when it's no longer needed.

cpg_operator_validate_num_arguments ()

gboolean            cpg_operator_validate_num_arguments (CpgOperatorClass *op,
                                                         gint num);

Get the number of arguments that the operators expects.

op :

A CpgOperator

Returns :

the number of arguments or -1 if the operator accepts a variable number of arguments.

cpg_operator_get_expressions ()

GSList const        * cpg_operator_get_expressions      (CpgOperator *op);

Get the expressions that the operator uses.

op :

A CpgOperator

Returns :

a list of CpgExpression. [element-type CpgExpression][transfer none]

cpg_operator_equal ()

gboolean            cpg_operator_equal                  (CpgOperator *op,
                                                         CpgOperator *other);


cpg_operator_step ()

void                cpg_operator_step                   (CpgOperator *op,
                                                         struct _CpgIntegrator *integrator,
                                                         gdouble t,
                                                         gdouble timestep);


cpg_operator_step_prepare ()

void                cpg_operator_step_prepare           (CpgOperator *op,
                                                         struct _CpgIntegrator *integrator,
                                                         gdouble t,
                                                         gdouble timestep);


cpg_operator_step_evaluate ()

void                cpg_operator_step_evaluate          (CpgOperator *op,
                                                         struct _CpgIntegrator *integrator,
                                                         gdouble t,
                                                         gdouble timestep);


cpg_operator_reset ()

void                cpg_operator_reset                  (CpgOperator *op);


cpg_operator_copy ()

CpgOperator *       cpg_operator_copy                   (CpgOperator *op);

Copy an operator.

op :

A CpgOperator

Returns :

A CpgOperator. [transfer full]

CpgOperatorPrivate

typedef struct _CpgOperatorPrivate CpgOperatorPrivate;


CpgOperatorClassPrivate

typedef struct _CpgOperatorClassPrivate CpgOperatorClassPrivate;