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

/* gcalc-math-constant.vala
 *
 * Copyright (C) 2018  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.h>
#include "gcalc.h"

static GType gcalc_math_constant_get_type_once (void);

/**
   * Add this value with another and returns
   * the result
   */
GCalcMathConstant*
gcalc_math_constant_add (GCalcMathConstant* self,
                         GCalcMathConstant* c)
{
	GCalcMathConstantIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GCALC_MATH_CONSTANT_GET_INTERFACE (self);
	if (_iface_->add) {
		return _iface_->add (self, c);
	}
	return NULL;
}

/**
   * Subtract another from this value and returns
   * the result
   */
GCalcMathConstant*
gcalc_math_constant_subtract (GCalcMathConstant* self,
                              GCalcMathConstant* c)
{
	GCalcMathConstantIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GCALC_MATH_CONSTANT_GET_INTERFACE (self);
	if (_iface_->subtract) {
		return _iface_->subtract (self, c);
	}
	return NULL;
}

/**
   * Multipy another with this value and returns
   * the result
   */
GCalcMathConstant*
gcalc_math_constant_multiply (GCalcMathConstant* self,
                              GCalcMathConstant* c)
{
	GCalcMathConstantIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GCALC_MATH_CONSTANT_GET_INTERFACE (self);
	if (_iface_->multiply) {
		return _iface_->multiply (self, c);
	}
	return NULL;
}

/**
   * Divide this value as numerator with another as denominator
   * and returns the result
   */
GCalcMathConstant*
gcalc_math_constant_divide (GCalcMathConstant* self,
                            GCalcMathConstant* c)
{
	GCalcMathConstantIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GCALC_MATH_CONSTANT_GET_INTERFACE (self);
	if (_iface_->divide) {
		return _iface_->divide (self, c);
	}
	return NULL;
}

/**
   * Changes the direction of the value and returns
   * the result
   */
GCalcMathConstant*
gcalc_math_constant_neg (GCalcMathConstant* self)
{
	GCalcMathConstantIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GCALC_MATH_CONSTANT_GET_INTERFACE (self);
	if (_iface_->neg) {
		return _iface_->neg (self);
	}
	return NULL;
}

/**
   * Pows this value using another and returns
   * the result
   */
GCalcMathConstant*
gcalc_math_constant_pow (GCalcMathConstant* self,
                         GCalcMathConstant* c)
{
	GCalcMathConstantIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GCALC_MATH_CONSTANT_GET_INTERFACE (self);
	if (_iface_->pow) {
		return _iface_->pow (self, c);
	}
	return NULL;
}

static void
gcalc_math_constant_default_init (GCalcMathConstantIface * iface,
                                  gpointer iface_data)
{
}

/**
 * A constant value in a math expression.
 */
static GType
gcalc_math_constant_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GCalcMathConstantIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gcalc_math_constant_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType gcalc_math_constant_type_id;
	gcalc_math_constant_type_id = g_type_register_static (G_TYPE_INTERFACE, "GCalcMathConstant", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (gcalc_math_constant_type_id, G_TYPE_OBJECT);
	g_type_interface_add_prerequisite (gcalc_math_constant_type_id, GCALC_TYPE_MATH_EXPRESSION);
	return gcalc_math_constant_type_id;
}

GType
gcalc_math_constant_get_type (void)
{
	static volatile gsize gcalc_math_constant_type_id__once = 0;
	if (g_once_init_enter (&gcalc_math_constant_type_id__once)) {
		GType gcalc_math_constant_type_id;
		gcalc_math_constant_type_id = gcalc_math_constant_get_type_once ();
		g_once_init_leave (&gcalc_math_constant_type_id__once, gcalc_math_constant_type_id);
	}
	return gcalc_math_constant_type_id__once;
}

