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

/* valadynamicsignal.vala
 *
 * Copyright (C) 2007-2008  Jürg Billeter
 *
 * 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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Jürg Billeter <j@bitron.ch>
 */

#include <glib.h>
#include <glib-object.h>
#include "vala.h"
#include <stdlib.h>
#include <string.h>

#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))

struct _ValaDynamicSignalPrivate {
	ValaDataType* _dynamic_type;
	ValaExpression* _handler;
};


static gpointer vala_dynamic_signal_parent_class = NULL;

#define VALA_DYNAMIC_SIGNAL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VALA_TYPE_DYNAMIC_SIGNAL, ValaDynamicSignalPrivate))
static gboolean vala_dynamic_signal_real_check (ValaCodeNode* base, ValaCodeContext* context);
static void vala_dynamic_signal_finalize (ValaCodeNode * obj);


ValaDynamicSignal* vala_dynamic_signal_construct (GType object_type, ValaDataType* dynamic_type, const gchar* name, ValaDataType* return_type, ValaSourceReference* source_reference, ValaComment* comment) {
	ValaDynamicSignal* self = NULL;
	const gchar* _tmp0_;
	ValaDataType* _tmp1_;
	ValaSourceReference* _tmp2_;
	ValaComment* _tmp3_;
	ValaDataType* _tmp4_;
	g_return_val_if_fail (dynamic_type != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	g_return_val_if_fail (return_type != NULL, NULL);
	_tmp0_ = name;
	_tmp1_ = return_type;
	_tmp2_ = source_reference;
	_tmp3_ = comment;
	self = (ValaDynamicSignal*) vala_signal_construct (object_type, _tmp0_, _tmp1_, _tmp2_, _tmp3_);
	_tmp4_ = dynamic_type;
	vala_dynamic_signal_set_dynamic_type (self, _tmp4_);
	return self;
}


ValaDynamicSignal* vala_dynamic_signal_new (ValaDataType* dynamic_type, const gchar* name, ValaDataType* return_type, ValaSourceReference* source_reference, ValaComment* comment) {
	return vala_dynamic_signal_construct (VALA_TYPE_DYNAMIC_SIGNAL, dynamic_type, name, return_type, source_reference, comment);
}


static gboolean vala_dynamic_signal_real_check (ValaCodeNode* base, ValaCodeContext* context) {
	ValaDynamicSignal * self;
	gboolean result = FALSE;
	self = (ValaDynamicSignal*) base;
	g_return_val_if_fail (context != NULL, FALSE);
	result = TRUE;
	return result;
}


ValaDataType* vala_dynamic_signal_get_dynamic_type (ValaDynamicSignal* self) {
	ValaDataType* result;
	ValaDataType* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_dynamic_type;
	result = _tmp0_;
	return result;
}


static gpointer _vala_code_node_ref0 (gpointer self) {
	return self ? vala_code_node_ref (self) : NULL;
}


void vala_dynamic_signal_set_dynamic_type (ValaDynamicSignal* self, ValaDataType* value) {
	ValaDataType* _tmp0_;
	ValaDataType* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _vala_code_node_ref0 (_tmp0_);
	_vala_code_node_unref0 (self->priv->_dynamic_type);
	self->priv->_dynamic_type = _tmp1_;
}


ValaExpression* vala_dynamic_signal_get_handler (ValaDynamicSignal* self) {
	ValaExpression* result;
	ValaExpression* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_handler;
	result = _tmp0_;
	return result;
}


void vala_dynamic_signal_set_handler (ValaDynamicSignal* self, ValaExpression* value) {
	ValaExpression* _tmp0_;
	ValaExpression* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _vala_code_node_ref0 (_tmp0_);
	_vala_code_node_unref0 (self->priv->_handler);
	self->priv->_handler = _tmp1_;
}


static void vala_dynamic_signal_class_init (ValaDynamicSignalClass * klass) {
	vala_dynamic_signal_parent_class = g_type_class_peek_parent (klass);
	((ValaCodeNodeClass *) klass)->finalize = vala_dynamic_signal_finalize;
	g_type_class_add_private (klass, sizeof (ValaDynamicSignalPrivate));
	((ValaCodeNodeClass *) klass)->check = (gboolean (*) (ValaCodeNode *, ValaCodeContext*)) vala_dynamic_signal_real_check;
}


static void vala_dynamic_signal_instance_init (ValaDynamicSignal * self) {
	self->priv = VALA_DYNAMIC_SIGNAL_GET_PRIVATE (self);
}


static void vala_dynamic_signal_finalize (ValaCodeNode * obj) {
	ValaDynamicSignal * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_DYNAMIC_SIGNAL, ValaDynamicSignal);
	_vala_code_node_unref0 (self->priv->_dynamic_type);
	_vala_code_node_unref0 (self->priv->_handler);
	VALA_CODE_NODE_CLASS (vala_dynamic_signal_parent_class)->finalize (obj);
}


/**
 * Represents a late bound signal.
 */
GType vala_dynamic_signal_get_type (void) {
	static volatile gsize vala_dynamic_signal_type_id__volatile = 0;
	if (g_once_init_enter (&vala_dynamic_signal_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ValaDynamicSignalClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_dynamic_signal_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaDynamicSignal), 0, (GInstanceInitFunc) vala_dynamic_signal_instance_init, NULL };
		GType vala_dynamic_signal_type_id;
		vala_dynamic_signal_type_id = g_type_register_static (VALA_TYPE_SIGNAL, "ValaDynamicSignal", &g_define_type_info, 0);
		g_once_init_leave (&vala_dynamic_signal_type_id__volatile, vala_dynamic_signal_type_id);
	}
	return vala_dynamic_signal_type_id__volatile;
}



