/* rygel-environment-test.c generated by valac 0.25.1.16-16e7a, the Vala compiler
 * generated from rygel-environment-test.vala, do not modify */

/*
 * Copyright (C) 2012 Intel Corporation.
 *
 * Author: Jens Georg <jensg@openismus.com>
 *
 * This file is part of Rygel.
 *
 * Rygel 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 of the License, or
 * (at your option) any later version.
 *
 * Rygel 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 program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gst/gst.h>
#include <gobject/gvaluecollector.h>


#define TYPE_ENVIRONMENT_TEST (environment_test_get_type ())
#define ENVIRONMENT_TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ENVIRONMENT_TEST, EnvironmentTest))
#define ENVIRONMENT_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ENVIRONMENT_TEST, EnvironmentTestClass))
#define IS_ENVIRONMENT_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ENVIRONMENT_TEST))
#define IS_ENVIRONMENT_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ENVIRONMENT_TEST))
#define ENVIRONMENT_TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ENVIRONMENT_TEST, EnvironmentTestClass))

typedef struct _EnvironmentTest EnvironmentTest;
typedef struct _EnvironmentTestClass EnvironmentTestClass;
typedef struct _EnvironmentTestPrivate EnvironmentTestPrivate;
typedef struct _ParamSpecEnvironmentTest ParamSpecEnvironmentTest;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _EnvironmentTest {
	GTypeInstance parent_instance;
	volatile int ref_count;
	EnvironmentTestPrivate * priv;
};

struct _EnvironmentTestClass {
	GTypeClass parent_class;
	void (*finalize) (EnvironmentTest *self);
};

struct _ParamSpecEnvironmentTest {
	GParamSpec parent_instance;
};


static gpointer environment_test_parent_class = NULL;

gpointer environment_test_ref (gpointer instance);
void environment_test_unref (gpointer instance);
GParamSpec* param_spec_environment_test (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_environment_test (GValue* value, gpointer v_object);
void value_take_environment_test (GValue* value, gpointer v_object);
gpointer value_get_environment_test (const GValue* value);
GType environment_test_get_type (void) G_GNUC_CONST;
enum  {
	ENVIRONMENT_TEST_DUMMY_PROPERTY
};
gint environment_test_main (gchar** args, int args_length1);
EnvironmentTest* environment_test_new (void);
EnvironmentTest* environment_test_construct (GType object_type);
static void environment_test_finalize (EnvironmentTest* obj);


gint environment_test_main (gchar** args, int args_length1) {
	gint result = 0;
	_vala_assert ((G_TIME_SPAN_SECOND * GST_USECOND) == ((GTimeSpan) GST_SECOND), "TimeSpan.SECOND * Gst.USECOND == Gst.SECOND");
	result = 0;
	return result;
}


int main (int argc, char ** argv) {
#if !GLIB_CHECK_VERSION (2,35,0)
	g_type_init ();
#endif
	return environment_test_main (argv, argc);
}


EnvironmentTest* environment_test_construct (GType object_type) {
	EnvironmentTest* self = NULL;
	self = (EnvironmentTest*) g_type_create_instance (object_type);
	return self;
}


EnvironmentTest* environment_test_new (void) {
	return environment_test_construct (TYPE_ENVIRONMENT_TEST);
}


static void value_environment_test_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void value_environment_test_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		environment_test_unref (value->data[0].v_pointer);
	}
}


static void value_environment_test_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = environment_test_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer value_environment_test_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* value_environment_test_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		EnvironmentTest* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = environment_test_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* value_environment_test_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	EnvironmentTest** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = environment_test_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* param_spec_environment_test (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	ParamSpecEnvironmentTest* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_ENVIRONMENT_TEST), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer value_get_environment_test (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ENVIRONMENT_TEST), NULL);
	return value->data[0].v_pointer;
}


void value_set_environment_test (GValue* value, gpointer v_object) {
	EnvironmentTest* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ENVIRONMENT_TEST));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_ENVIRONMENT_TEST));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		environment_test_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		environment_test_unref (old);
	}
}


void value_take_environment_test (GValue* value, gpointer v_object) {
	EnvironmentTest* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ENVIRONMENT_TEST));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_ENVIRONMENT_TEST));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		environment_test_unref (old);
	}
}


static void environment_test_class_init (EnvironmentTestClass * klass) {
	environment_test_parent_class = g_type_class_peek_parent (klass);
	((EnvironmentTestClass *) klass)->finalize = environment_test_finalize;
}


static void environment_test_instance_init (EnvironmentTest * self) {
	self->ref_count = 1;
}


static void environment_test_finalize (EnvironmentTest* obj) {
	EnvironmentTest * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_ENVIRONMENT_TEST, EnvironmentTest);
	g_signal_handlers_destroy (self);
}


GType environment_test_get_type (void) {
	static volatile gsize environment_test_type_id__volatile = 0;
	if (g_once_init_enter (&environment_test_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { value_environment_test_init, value_environment_test_free_value, value_environment_test_copy_value, value_environment_test_peek_pointer, "p", value_environment_test_collect_value, "p", value_environment_test_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (EnvironmentTestClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) environment_test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EnvironmentTest), 0, (GInstanceInitFunc) environment_test_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType environment_test_type_id;
		environment_test_type_id = g_type_register_fundamental (g_type_fundamental_next (), "EnvironmentTest", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&environment_test_type_id__volatile, environment_test_type_id);
	}
	return environment_test_type_id__volatile;
}


gpointer environment_test_ref (gpointer instance) {
	EnvironmentTest* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void environment_test_unref (gpointer instance) {
	EnvironmentTest* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		ENVIRONMENT_TEST_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}



