/* static_series.c generated by valac 0.56.0, the Vala compiler
 * generated from static_series.vala, do not modify */

#include "livechart.h"
#include <gee.h>
#include <glib-object.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>

enum  {
	LIVE_CHART_STATIC_STATIC_SERIES_0_PROPERTY,
	LIVE_CHART_STATIC_STATIC_SERIES_NUM_PROPERTIES
};
static GParamSpec* live_chart_static_static_series_properties[LIVE_CHART_STATIC_STATIC_SERIES_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _LiveChartStaticStaticSeriesPrivate {
	GeeArrayList* series;
	LiveChartStaticStaticChart* chart;
};

static gint LiveChartStaticStaticSeries_private_offset;
static gpointer live_chart_static_static_series_parent_class = NULL;

static void __lambda15_ (LiveChartStaticStaticSeries* self,
                  gdouble value);
static void ___lambda15__live_chart_static_static_serie_value_added (LiveChartStaticStaticSerie* _sender,
                                                              gdouble value,
                                                              gpointer self);
static void live_chart_static_static_series_finalize (GObject * obj);
static GType live_chart_static_static_series_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
live_chart_static_static_series_get_instance_private (LiveChartStaticStaticSeries* self)
{
	return G_STRUCT_MEMBER_P (self, LiveChartStaticStaticSeries_private_offset);
}

static gpointer
_g_object_ref0 (gpointer self)
{
#line 12 "../src/static/static_series.vala"
	return self ? g_object_ref (self) : NULL;
#line 51 "static_series.c"
}

LiveChartStaticStaticSeries*
live_chart_static_static_series_construct (GType object_type,
                                           LiveChartStaticStaticChart* chart)
{
	LiveChartStaticStaticSeries * self = NULL;
	LiveChartStaticStaticChart* _tmp0_;
#line 11 "../src/static/static_series.vala"
	g_return_val_if_fail (chart != NULL, NULL);
#line 11 "../src/static/static_series.vala"
	self = (LiveChartStaticStaticSeries*) g_object_new (object_type, NULL);
#line 12 "../src/static/static_series.vala"
	_tmp0_ = _g_object_ref0 (chart);
#line 12 "../src/static/static_series.vala"
	_g_object_unref0 (self->priv->chart);
#line 12 "../src/static/static_series.vala"
	self->priv->chart = _tmp0_;
#line 11 "../src/static/static_series.vala"
	return self;
#line 72 "static_series.c"
}

LiveChartStaticStaticSeries*
live_chart_static_static_series_new (LiveChartStaticStaticChart* chart)
{
#line 11 "../src/static/static_series.vala"
	return live_chart_static_static_series_construct (LIVE_CHART_STATIC_TYPE_STATIC_SERIES, chart);
#line 80 "static_series.c"
}

static void
__lambda15_ (LiveChartStaticStaticSeries* self,
             gdouble value)
{
	LiveChartStaticStaticChart* _tmp0_;
	LiveChartConfig* _tmp1_;
	LiveChartYAxis* _tmp2_;
#line 20 "../src/static/static_series.vala"
	_tmp0_ = self->priv->chart;
#line 20 "../src/static/static_series.vala"
	_tmp1_ = _tmp0_->config;
#line 20 "../src/static/static_series.vala"
	_tmp2_ = _tmp1_->y_axis;
#line 20 "../src/static/static_series.vala"
	live_chart_yaxis_update_bounds (_tmp2_, value);
#line 98 "static_series.c"
}

static void
___lambda15__live_chart_static_static_serie_value_added (LiveChartStaticStaticSerie* _sender,
                                                         gdouble value,
                                                         gpointer self)
{
#line 18 "../src/static/static_series.vala"
	__lambda15_ ((LiveChartStaticStaticSeries*) self, value);
#line 108 "static_series.c"
}

LiveChartStaticStaticSerie*
live_chart_static_static_series_register (LiveChartStaticStaticSeries* self,
                                          LiveChartStaticStaticSerie* serie)
{
	GeeArrayList* _tmp0_;
	LiveChartStaticStaticSerie* _tmp1_;
	LiveChartStaticStaticSerie* result;
#line 15 "../src/static/static_series.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 15 "../src/static/static_series.vala"
	g_return_val_if_fail (serie != NULL, NULL);
#line 16 "../src/static/static_series.vala"
	_tmp0_ = self->priv->series;
#line 16 "../src/static/static_series.vala"
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, serie);
#line 18 "../src/static/static_series.vala"
	g_signal_connect_object (serie, "value-added", (GCallback) ___lambda15__live_chart_static_static_serie_value_added, self, 0);
#line 22 "../src/static/static_series.vala"
	_tmp1_ = _g_object_ref0 (serie);
#line 22 "../src/static/static_series.vala"
	result = _tmp1_;
#line 22 "../src/static/static_series.vala"
	return result;
#line 134 "static_series.c"
}

LiveChartStaticStaticSerie*
live_chart_static_static_series_get (LiveChartStaticStaticSeries* self,
                                     gint index,
                                     GError** error)
{
	GeeArrayList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	GeeArrayList* _tmp7_;
	gpointer _tmp8_;
	GError* _inner_error0_ = NULL;
	LiveChartStaticStaticSerie* result;
#line 25 "../src/static/static_series.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 26 "../src/static/static_series.vala"
	_tmp0_ = self->priv->series;
#line 26 "../src/static/static_series.vala"
	_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
#line 26 "../src/static/static_series.vala"
	_tmp2_ = _tmp1_;
#line 26 "../src/static/static_series.vala"
	if (index > (_tmp2_ - 1)) {
#line 159 "static_series.c"
		gchar* _tmp3_;
		gchar* _tmp4_;
		GError* _tmp5_;
		GError* _tmp6_;
#line 27 "../src/static/static_series.vala"
		_tmp3_ = g_strdup_printf ("Serie at index %d not found", index);
#line 27 "../src/static/static_series.vala"
		_tmp4_ = _tmp3_;
#line 27 "../src/static/static_series.vala"
		_tmp5_ = g_error_new_literal (LIVE_CHART_CHART_ERROR, LIVE_CHART_CHART_ERROR_SERIE_NOT_FOUND, _tmp4_);
#line 27 "../src/static/static_series.vala"
		_tmp6_ = _tmp5_;
#line 27 "../src/static/static_series.vala"
		_g_free0 (_tmp4_);
#line 27 "../src/static/static_series.vala"
		_inner_error0_ = _tmp6_;
#line 27 "../src/static/static_series.vala"
		if (_inner_error0_->domain == LIVE_CHART_CHART_ERROR) {
#line 27 "../src/static/static_series.vala"
			g_propagate_error (error, _inner_error0_);
#line 27 "../src/static/static_series.vala"
			return NULL;
#line 182 "static_series.c"
		} else {
#line 27 "../src/static/static_series.vala"
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
#line 27 "../src/static/static_series.vala"
			g_clear_error (&_inner_error0_);
#line 27 "../src/static/static_series.vala"
			return NULL;
#line 190 "static_series.c"
		}
	}
#line 29 "../src/static/static_series.vala"
	_tmp7_ = self->priv->series;
#line 29 "../src/static/static_series.vala"
	_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, index);
#line 29 "../src/static/static_series.vala"
	result = (LiveChartStaticStaticSerie*) _tmp8_;
#line 29 "../src/static/static_series.vala"
	return result;
#line 201 "static_series.c"
}

LiveChartStaticStaticSerie*
live_chart_static_static_series_get_by_name (LiveChartStaticStaticSeries* self,
                                             const gchar* name,
                                             GError** error)
{
	gchar* _tmp11_;
	gchar* _tmp12_;
	GError* _tmp13_;
	GError* _tmp14_;
	GError* _inner_error0_ = NULL;
	LiveChartStaticStaticSerie* result;
#line 32 "../src/static/static_series.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 32 "../src/static/static_series.vala"
	g_return_val_if_fail (name != NULL, NULL);
#line 219 "static_series.c"
	{
		GeeArrayList* _serie_list = NULL;
		GeeArrayList* _tmp0_;
		gint _serie_size = 0;
		GeeArrayList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _serie_index = 0;
#line 33 "../src/static/static_series.vala"
		_tmp0_ = self->priv->series;
#line 33 "../src/static/static_series.vala"
		_serie_list = _tmp0_;
#line 33 "../src/static/static_series.vala"
		_tmp1_ = _serie_list;
#line 33 "../src/static/static_series.vala"
		_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
#line 33 "../src/static/static_series.vala"
		_tmp3_ = _tmp2_;
#line 33 "../src/static/static_series.vala"
		_serie_size = _tmp3_;
#line 33 "../src/static/static_series.vala"
		_serie_index = -1;
#line 33 "../src/static/static_series.vala"
		while (TRUE) {
#line 244 "static_series.c"
			gint _tmp4_;
			gint _tmp5_;
			LiveChartStaticStaticSerie* serie = NULL;
			GeeArrayList* _tmp6_;
			gpointer _tmp7_;
			LiveChartStaticStaticSerie* _tmp8_;
			const gchar* _tmp9_;
			const gchar* _tmp10_;
#line 33 "../src/static/static_series.vala"
			_serie_index = _serie_index + 1;
#line 33 "../src/static/static_series.vala"
			_tmp4_ = _serie_index;
#line 33 "../src/static/static_series.vala"
			_tmp5_ = _serie_size;
#line 33 "../src/static/static_series.vala"
			if (!(_tmp4_ < _tmp5_)) {
#line 33 "../src/static/static_series.vala"
				break;
#line 263 "static_series.c"
			}
#line 33 "../src/static/static_series.vala"
			_tmp6_ = _serie_list;
#line 33 "../src/static/static_series.vala"
			_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp6_, _serie_index);
#line 33 "../src/static/static_series.vala"
			serie = (LiveChartStaticStaticSerie*) _tmp7_;
#line 34 "../src/static/static_series.vala"
			_tmp8_ = serie;
#line 34 "../src/static/static_series.vala"
			_tmp9_ = live_chart_static_static_serie_get_name (_tmp8_);
#line 34 "../src/static/static_series.vala"
			_tmp10_ = _tmp9_;
#line 34 "../src/static/static_series.vala"
			if (g_strcmp0 (_tmp10_, name) == 0) {
#line 34 "../src/static/static_series.vala"
				result = serie;
#line 34 "../src/static/static_series.vala"
				return result;
#line 283 "static_series.c"
			}
#line 33 "../src/static/static_series.vala"
			_g_object_unref0 (serie);
#line 287 "static_series.c"
		}
	}
#line 36 "../src/static/static_series.vala"
	_tmp11_ = g_strdup_printf ("Serie with name %s not found", name);
#line 36 "../src/static/static_series.vala"
	_tmp12_ = _tmp11_;
#line 36 "../src/static/static_series.vala"
	_tmp13_ = g_error_new_literal (LIVE_CHART_CHART_ERROR, LIVE_CHART_CHART_ERROR_SERIE_NOT_FOUND, _tmp12_);
#line 36 "../src/static/static_series.vala"
	_tmp14_ = _tmp13_;
#line 36 "../src/static/static_series.vala"
	_g_free0 (_tmp12_);
#line 36 "../src/static/static_series.vala"
	_inner_error0_ = _tmp14_;
#line 36 "../src/static/static_series.vala"
	if (_inner_error0_->domain == LIVE_CHART_CHART_ERROR) {
#line 36 "../src/static/static_series.vala"
		g_propagate_error (error, _inner_error0_);
#line 36 "../src/static/static_series.vala"
		return NULL;
#line 308 "static_series.c"
	} else {
#line 36 "../src/static/static_series.vala"
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
#line 36 "../src/static/static_series.vala"
		g_clear_error (&_inner_error0_);
#line 36 "../src/static/static_series.vala"
		return NULL;
#line 316 "static_series.c"
	}
}

GeeIterator*
live_chart_static_static_series_iterator (LiveChartStaticStaticSeries* self)
{
	GeeArrayList* _tmp0_;
	GeeListIterator* _tmp1_;
	GeeIterator* result;
#line 39 "../src/static/static_series.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 40 "../src/static/static_series.vala"
	_tmp0_ = self->priv->series;
#line 40 "../src/static/static_series.vala"
	_tmp1_ = gee_abstract_list_list_iterator ((GeeAbstractList*) _tmp0_);
#line 40 "../src/static/static_series.vala"
	result = (GeeIterator*) _tmp1_;
#line 40 "../src/static/static_series.vala"
	return result;
#line 336 "static_series.c"
}

static void
live_chart_static_static_series_class_init (LiveChartStaticStaticSeriesClass * klass,
                                            gpointer klass_data)
{
#line 6 "../src/static/static_series.vala"
	live_chart_static_static_series_parent_class = g_type_class_peek_parent (klass);
#line 6 "../src/static/static_series.vala"
	g_type_class_adjust_private_offset (klass, &LiveChartStaticStaticSeries_private_offset);
#line 6 "../src/static/static_series.vala"
	G_OBJECT_CLASS (klass)->finalize = live_chart_static_static_series_finalize;
#line 349 "static_series.c"
}

static void
live_chart_static_static_series_instance_init (LiveChartStaticStaticSeries * self,
                                               gpointer klass)
{
	GeeArrayList* _tmp0_;
#line 6 "../src/static/static_series.vala"
	self->priv = live_chart_static_static_series_get_instance_private (self);
#line 8 "../src/static/static_series.vala"
	_tmp0_ = gee_array_list_new (LIVE_CHART_STATIC_TYPE_STATIC_SERIE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
#line 8 "../src/static/static_series.vala"
	self->priv->series = _tmp0_;
#line 363 "static_series.c"
}

static void
live_chart_static_static_series_finalize (GObject * obj)
{
	LiveChartStaticStaticSeries * self;
#line 6 "../src/static/static_series.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, LIVE_CHART_STATIC_TYPE_STATIC_SERIES, LiveChartStaticStaticSeries);
#line 8 "../src/static/static_series.vala"
	_g_object_unref0 (self->priv->series);
#line 9 "../src/static/static_series.vala"
	_g_object_unref0 (self->priv->chart);
#line 6 "../src/static/static_series.vala"
	G_OBJECT_CLASS (live_chart_static_static_series_parent_class)->finalize (obj);
#line 378 "static_series.c"
}

static GType
live_chart_static_static_series_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (LiveChartStaticStaticSeriesClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) live_chart_static_static_series_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LiveChartStaticStaticSeries), 0, (GInstanceInitFunc) live_chart_static_static_series_instance_init, NULL };
	GType live_chart_static_static_series_type_id;
	live_chart_static_static_series_type_id = g_type_register_static (G_TYPE_OBJECT, "LiveChartStaticStaticSeries", &g_define_type_info, 0);
	LiveChartStaticStaticSeries_private_offset = g_type_add_instance_private (live_chart_static_static_series_type_id, sizeof (LiveChartStaticStaticSeriesPrivate));
	return live_chart_static_static_series_type_id;
}

GType
live_chart_static_static_series_get_type (void)
{
	static volatile gsize live_chart_static_static_series_type_id__once = 0;
	if (g_once_init_enter (&live_chart_static_static_series_type_id__once)) {
		GType live_chart_static_static_series_type_id;
		live_chart_static_static_series_type_id = live_chart_static_static_series_get_type_once ();
		g_once_init_leave (&live_chart_static_static_series_type_id__once, live_chart_static_static_series_type_id);
	}
	return live_chart_static_static_series_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

