/* gcalc-math-parameter.c generated by valac 0.56.0, the Vala compiler
 * generated from gcalc-math-parameter.vala, do not modify */

/* gcalc-math-parameter.vala
 *
 * Copyright (C) 2019  Daniel Espinosa <esodan@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *      Daniel Espinosa <esodan@gmail.com>
 */

#include "gcalc/gcalc.h"
#include <glib-object.h>
#include <glib.h>
#include "gcalc.h"

static GType gcalc_math_parameter_get_type_once (void);

void
gcalc_math_parameter_set_value (GCalcMathParameter* self,
                                GValue* val,
                                GError** error)
{
	GCalcMathParameterIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GCALC_MATH_PARAMETER_GET_INTERFACE (self);
	if (_iface_->set_value) {
		_iface_->set_value (self, val, error);
	}
}

GValue*
gcalc_math_parameter_get_value (GCalcMathParameter* self)
{
	GCalcMathParameterIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GCALC_MATH_PARAMETER_GET_INTERFACE (self);
	if (_iface_->get_value) {
		return _iface_->get_value (self);
	}
	return NULL;
}

static void
gcalc_math_parameter_default_init (GCalcMathParameterIface * iface,
                                   gpointer iface_data)
{
}

/**
 * A parameter is a {@link MathVariable} holding a value, that is not
 * expected to be resolved as part of an {@link MathExpression} evaluation,
 * but by asigning its value.
 *
 * Currently the value will be converted to a {@link MathConstant} if possible.
 */
static GType
gcalc_math_parameter_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GCalcMathParameterIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gcalc_math_parameter_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType gcalc_math_parameter_type_id;
	gcalc_math_parameter_type_id = g_type_register_static (G_TYPE_INTERFACE, "GCalcMathParameter", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (gcalc_math_parameter_type_id, G_TYPE_OBJECT);
	g_type_interface_add_prerequisite (gcalc_math_parameter_type_id, GCALC_TYPE_MATH_EXPRESSION);
	g_type_interface_add_prerequisite (gcalc_math_parameter_type_id, GCALC_TYPE_MATH_VARIABLE);
	return gcalc_math_parameter_type_id;
}

GType
gcalc_math_parameter_get_type (void)
{
	static volatile gsize gcalc_math_parameter_type_id__once = 0;
	if (g_once_init_enter (&gcalc_math_parameter_type_id__once)) {
		GType gcalc_math_parameter_type_id;
		gcalc_math_parameter_type_id = gcalc_math_parameter_get_type_once ();
		g_once_init_leave (&gcalc_math_parameter_type_id__once, gcalc_math_parameter_type_id);
	}
	return gcalc_math_parameter_type_id__once;
}

