iPDC-suite/iPDC/lib/liblivechart.so.p/series.c

492 lines
14 KiB
C
Raw Normal View History

2022-10-25 21:48:11 +05:30
/* series.c generated by valac 0.56.0, the Vala compiler
* generated from 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_SERIES_0_PROPERTY,
LIVE_CHART_SERIES_NUM_PROPERTIES
};
static GParamSpec* live_chart_series_properties[LIVE_CHART_SERIES_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _live_chart_timestamped_value_free0(var) ((var == NULL) ? NULL : (var = (live_chart_timestamped_value_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
struct _LiveChartSeriesPrivate {
GeeArrayList* series;
LiveChartChart* chart;
};
static gint LiveChartSeries_private_offset;
static gpointer live_chart_series_parent_class = NULL;
static gboolean __lambda7_ (LiveChartSeries* self,
LiveChartTimestampedValue* value);
static gboolean ___lambda7__gee_forall_func (gpointer g,
gpointer self);
static void __lambda8_ (LiveChartSeries* self,
gdouble value);
static void ___lambda8__live_chart_serie_value_added (LiveChartSerie* _sender,
gdouble value,
gpointer self);
static void live_chart_series_finalize (GObject * obj);
static GType live_chart_series_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
gsize byte_size);
static inline gpointer
live_chart_series_get_instance_private (LiveChartSeries* self)
{
return G_STRUCT_MEMBER_P (self, LiveChartSeries_private_offset);
}
static gpointer
_g_object_ref0 (gpointer self)
{
#line 10 "../src/series.vala"
return self ? g_object_ref (self) : NULL;
#line 56 "series.c"
}
LiveChartSeries*
live_chart_series_construct (GType object_type,
LiveChartChart* chart)
{
LiveChartSeries * self = NULL;
LiveChartChart* _tmp0_;
#line 9 "../src/series.vala"
g_return_val_if_fail (chart != NULL, NULL);
#line 9 "../src/series.vala"
self = (LiveChartSeries*) g_object_new (object_type, NULL);
#line 10 "../src/series.vala"
_tmp0_ = _g_object_ref0 (chart);
#line 10 "../src/series.vala"
_g_object_unref0 (self->priv->chart);
#line 10 "../src/series.vala"
self->priv->chart = _tmp0_;
#line 9 "../src/series.vala"
return self;
#line 77 "series.c"
}
LiveChartSeries*
live_chart_series_new (LiveChartChart* chart)
{
#line 9 "../src/series.vala"
return live_chart_series_construct (LIVE_CHART_TYPE_SERIES, chart);
#line 85 "series.c"
}
static gboolean
__lambda7_ (LiveChartSeries* self,
LiveChartTimestampedValue* value)
{
LiveChartChart* _tmp0_;
LiveChartConfig* _tmp1_;
LiveChartYAxis* _tmp2_;
gboolean result;
#line 16 "../src/series.vala"
_tmp0_ = self->priv->chart;
#line 16 "../src/series.vala"
_tmp1_ = _tmp0_->config;
#line 16 "../src/series.vala"
_tmp2_ = _tmp1_->y_axis;
#line 16 "../src/series.vala"
live_chart_yaxis_update_bounds (_tmp2_, (*value).value);
#line 16 "../src/series.vala"
result = TRUE;
#line 16 "../src/series.vala"
_live_chart_timestamped_value_free0 (value);
#line 16 "../src/series.vala"
return result;
#line 110 "series.c"
}
static gboolean
___lambda7__gee_forall_func (gpointer g,
gpointer self)
{
gboolean result;
result = __lambda7_ ((LiveChartSeries*) self, (LiveChartTimestampedValue*) g);
#line 16 "../src/series.vala"
return result;
#line 121 "series.c"
}
static void
__lambda8_ (LiveChartSeries* self,
gdouble value)
{
LiveChartChart* _tmp0_;
LiveChartConfig* _tmp1_;
LiveChartYAxis* _tmp2_;
#line 20 "../src/series.vala"
_tmp0_ = self->priv->chart;
#line 20 "../src/series.vala"
_tmp1_ = _tmp0_->config;
#line 20 "../src/series.vala"
_tmp2_ = _tmp1_->y_axis;
#line 20 "../src/series.vala"
live_chart_yaxis_update_bounds (_tmp2_, value);
#line 139 "series.c"
}
static void
___lambda8__live_chart_serie_value_added (LiveChartSerie* _sender,
gdouble value,
gpointer self)
{
#line 19 "../src/series.vala"
__lambda8_ ((LiveChartSeries*) self, value);
#line 149 "series.c"
}
LiveChartSerie*
live_chart_series_register (LiveChartSeries* self,
LiveChartSerie* serie)
{
GeeArrayList* _tmp0_;
LiveChartValues* _tmp1_;
LiveChartValues* _tmp2_;
LiveChartChart* _tmp3_;
LiveChartLegend* _tmp4_;
LiveChartLegend* _tmp5_;
LiveChartSerie* _tmp9_;
LiveChartSerie* result;
#line 13 "../src/series.vala"
g_return_val_if_fail (self != NULL, NULL);
#line 13 "../src/series.vala"
g_return_val_if_fail (serie != NULL, NULL);
#line 14 "../src/series.vala"
_tmp0_ = self->priv->series;
#line 14 "../src/series.vala"
gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, serie);
#line 16 "../src/series.vala"
_tmp1_ = live_chart_serie_get_values (serie);
#line 16 "../src/series.vala"
_tmp2_ = _tmp1_;
#line 16 "../src/series.vala"
gee_abstract_collection_foreach ((GeeAbstractCollection*) _tmp2_, ___lambda7__gee_forall_func, self);
#line 16 "../src/series.vala"
_g_object_unref0 (_tmp2_);
#line 18 "../src/series.vala"
_tmp3_ = self->priv->chart;
#line 18 "../src/series.vala"
_tmp4_ = live_chart_chart_get_legend (_tmp3_);
#line 18 "../src/series.vala"
_tmp5_ = _tmp4_;
#line 18 "../src/series.vala"
if (_tmp5_ != NULL) {
#line 188 "series.c"
LiveChartChart* _tmp6_;
LiveChartLegend* _tmp7_;
LiveChartLegend* _tmp8_;
#line 18 "../src/series.vala"
_tmp6_ = self->priv->chart;
#line 18 "../src/series.vala"
_tmp7_ = live_chart_chart_get_legend (_tmp6_);
#line 18 "../src/series.vala"
_tmp8_ = _tmp7_;
#line 18 "../src/series.vala"
live_chart_legend_add_legend (_tmp8_, serie);
#line 200 "series.c"
}
#line 19 "../src/series.vala"
g_signal_connect_object (serie, "value-added", (GCallback) ___lambda8__live_chart_serie_value_added, self, 0);
#line 22 "../src/series.vala"
_tmp9_ = _g_object_ref0 (serie);
#line 22 "../src/series.vala"
result = _tmp9_;
#line 22 "../src/series.vala"
return result;
#line 210 "series.c"
}
LiveChartSerie*
live_chart_series_get (LiveChartSeries* self,
gint index,
GError** error)
{
GeeArrayList* _tmp0_;
gint _tmp1_;
gint _tmp2_;
GeeArrayList* _tmp7_;
gpointer _tmp8_;
GError* _inner_error0_ = NULL;
LiveChartSerie* result;
#line 25 "../src/series.vala"
g_return_val_if_fail (self != NULL, NULL);
#line 26 "../src/series.vala"
_tmp0_ = self->priv->series;
#line 26 "../src/series.vala"
_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
#line 26 "../src/series.vala"
_tmp2_ = _tmp1_;
#line 26 "../src/series.vala"
if (index > (_tmp2_ - 1)) {
#line 235 "series.c"
gchar* _tmp3_;
gchar* _tmp4_;
GError* _tmp5_;
GError* _tmp6_;
#line 27 "../src/series.vala"
_tmp3_ = g_strdup_printf ("Serie at index %d not found", index);
#line 27 "../src/series.vala"
_tmp4_ = _tmp3_;
#line 27 "../src/series.vala"
_tmp5_ = g_error_new_literal (LIVE_CHART_CHART_ERROR, LIVE_CHART_CHART_ERROR_SERIE_NOT_FOUND, _tmp4_);
#line 27 "../src/series.vala"
_tmp6_ = _tmp5_;
#line 27 "../src/series.vala"
_g_free0 (_tmp4_);
#line 27 "../src/series.vala"
_inner_error0_ = _tmp6_;
#line 27 "../src/series.vala"
if (_inner_error0_->domain == LIVE_CHART_CHART_ERROR) {
#line 27 "../src/series.vala"
g_propagate_error (error, _inner_error0_);
#line 27 "../src/series.vala"
return NULL;
#line 258 "series.c"
} else {
#line 27 "../src/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/series.vala"
g_clear_error (&_inner_error0_);
#line 27 "../src/series.vala"
return NULL;
#line 266 "series.c"
}
}
#line 29 "../src/series.vala"
_tmp7_ = self->priv->series;
#line 29 "../src/series.vala"
_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, index);
#line 29 "../src/series.vala"
result = (LiveChartSerie*) _tmp8_;
#line 29 "../src/series.vala"
return result;
#line 277 "series.c"
}
LiveChartSerie*
live_chart_series_get_by_name (LiveChartSeries* self,
const gchar* name,
GError** error)
{
gchar* _tmp11_;
gchar* _tmp12_;
GError* _tmp13_;
GError* _tmp14_;
GError* _inner_error0_ = NULL;
LiveChartSerie* result;
#line 32 "../src/series.vala"
g_return_val_if_fail (self != NULL, NULL);
#line 32 "../src/series.vala"
g_return_val_if_fail (name != NULL, NULL);
#line 295 "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/series.vala"
_tmp0_ = self->priv->series;
#line 33 "../src/series.vala"
_serie_list = _tmp0_;
#line 33 "../src/series.vala"
_tmp1_ = _serie_list;
#line 33 "../src/series.vala"
_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
#line 33 "../src/series.vala"
_tmp3_ = _tmp2_;
#line 33 "../src/series.vala"
_serie_size = _tmp3_;
#line 33 "../src/series.vala"
_serie_index = -1;
#line 33 "../src/series.vala"
while (TRUE) {
#line 320 "series.c"
gint _tmp4_;
gint _tmp5_;
LiveChartSerie* serie = NULL;
GeeArrayList* _tmp6_;
gpointer _tmp7_;
LiveChartSerie* _tmp8_;
const gchar* _tmp9_;
const gchar* _tmp10_;
#line 33 "../src/series.vala"
_serie_index = _serie_index + 1;
#line 33 "../src/series.vala"
_tmp4_ = _serie_index;
#line 33 "../src/series.vala"
_tmp5_ = _serie_size;
#line 33 "../src/series.vala"
if (!(_tmp4_ < _tmp5_)) {
#line 33 "../src/series.vala"
break;
#line 339 "series.c"
}
#line 33 "../src/series.vala"
_tmp6_ = _serie_list;
#line 33 "../src/series.vala"
_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp6_, _serie_index);
#line 33 "../src/series.vala"
serie = (LiveChartSerie*) _tmp7_;
#line 34 "../src/series.vala"
_tmp8_ = serie;
#line 34 "../src/series.vala"
_tmp9_ = live_chart_serie_get_name (_tmp8_);
#line 34 "../src/series.vala"
_tmp10_ = _tmp9_;
#line 34 "../src/series.vala"
if (g_strcmp0 (_tmp10_, name) == 0) {
#line 34 "../src/series.vala"
result = serie;
#line 34 "../src/series.vala"
return result;
#line 359 "series.c"
}
#line 33 "../src/series.vala"
_g_object_unref0 (serie);
#line 363 "series.c"
}
}
#line 36 "../src/series.vala"
_tmp11_ = g_strdup_printf ("Serie with name %s not found", name);
#line 36 "../src/series.vala"
_tmp12_ = _tmp11_;
#line 36 "../src/series.vala"
_tmp13_ = g_error_new_literal (LIVE_CHART_CHART_ERROR, LIVE_CHART_CHART_ERROR_SERIE_NOT_FOUND, _tmp12_);
#line 36 "../src/series.vala"
_tmp14_ = _tmp13_;
#line 36 "../src/series.vala"
_g_free0 (_tmp12_);
#line 36 "../src/series.vala"
_inner_error0_ = _tmp14_;
#line 36 "../src/series.vala"
if (_inner_error0_->domain == LIVE_CHART_CHART_ERROR) {
#line 36 "../src/series.vala"
g_propagate_error (error, _inner_error0_);
#line 36 "../src/series.vala"
return NULL;
#line 384 "series.c"
} else {
#line 36 "../src/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/series.vala"
g_clear_error (&_inner_error0_);
#line 36 "../src/series.vala"
return NULL;
#line 392 "series.c"
}
}
GeeIterator*
live_chart_series_iterator (LiveChartSeries* self)
{
GeeArrayList* _tmp0_;
GeeListIterator* _tmp1_;
GeeIterator* result;
#line 39 "../src/series.vala"
g_return_val_if_fail (self != NULL, NULL);
#line 40 "../src/series.vala"
_tmp0_ = self->priv->series;
#line 40 "../src/series.vala"
_tmp1_ = gee_abstract_list_list_iterator ((GeeAbstractList*) _tmp0_);
#line 40 "../src/series.vala"
result = (GeeIterator*) _tmp1_;
#line 40 "../src/series.vala"
return result;
#line 412 "series.c"
}
static void
live_chart_series_class_init (LiveChartSeriesClass * klass,
gpointer klass_data)
{
#line 4 "../src/series.vala"
live_chart_series_parent_class = g_type_class_peek_parent (klass);
#line 4 "../src/series.vala"
g_type_class_adjust_private_offset (klass, &LiveChartSeries_private_offset);
#line 4 "../src/series.vala"
G_OBJECT_CLASS (klass)->finalize = live_chart_series_finalize;
#line 425 "series.c"
}
static void
live_chart_series_instance_init (LiveChartSeries * self,
gpointer klass)
{
GeeArrayList* _tmp0_;
#line 4 "../src/series.vala"
self->priv = live_chart_series_get_instance_private (self);
#line 6 "../src/series.vala"
_tmp0_ = gee_array_list_new (LIVE_CHART_TYPE_SERIE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
#line 6 "../src/series.vala"
self->priv->series = _tmp0_;
#line 439 "series.c"
}
static void
live_chart_series_finalize (GObject * obj)
{
LiveChartSeries * self;
#line 4 "../src/series.vala"
self = G_TYPE_CHECK_INSTANCE_CAST (obj, LIVE_CHART_TYPE_SERIES, LiveChartSeries);
#line 6 "../src/series.vala"
_g_object_unref0 (self->priv->series);
#line 7 "../src/series.vala"
_g_object_unref0 (self->priv->chart);
#line 4 "../src/series.vala"
G_OBJECT_CLASS (live_chart_series_parent_class)->finalize (obj);
#line 454 "series.c"
}
static GType
live_chart_series_get_type_once (void)
{
static const GTypeInfo g_define_type_info = { sizeof (LiveChartSeriesClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) live_chart_series_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LiveChartSeries), 0, (GInstanceInitFunc) live_chart_series_instance_init, NULL };
GType live_chart_series_type_id;
live_chart_series_type_id = g_type_register_static (G_TYPE_OBJECT, "LiveChartSeries", &g_define_type_info, 0);
LiveChartSeries_private_offset = g_type_add_instance_private (live_chart_series_type_id, sizeof (LiveChartSeriesPrivate));
return live_chart_series_type_id;
}
GType
live_chart_series_get_type (void)
{
static volatile gsize live_chart_series_type_id__once = 0;
if (g_once_init_enter (&live_chart_series_type_id__once)) {
GType live_chart_series_type_id;
live_chart_series_type_id = live_chart_series_get_type_once ();
g_once_init_leave (&live_chart_series_type_id__once, live_chart_series_type_id);
}
return live_chart_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;
}