/* vala-dmap-container-db.c generated by valac 0.56.17, the Vala compiler
 * generated from vala-dmap-container-db.vala, do not modify */

/*   FILE: vala-dmap-db.vala -- A DmapContainerDb implementation in Vala
 * AUTHOR: W. Michael Petullo <mike@flyn.org>
 *   DATE: 21 December 2010 
 *
 * Copyright (c) 2010 W. Michael Petullo <new@flyn.org>
 * All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include <glib-object.h>
#include <libdmapsharing/dmap.h>
#include <gee.h>
#include <glib.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TYPE_VALA_DMAP_CONTAINER_DB (vala_dmap_container_db_get_type ())
#define VALA_DMAP_CONTAINER_DB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_VALA_DMAP_CONTAINER_DB, ValaDmapContainerDb))
#define VALA_DMAP_CONTAINER_DB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_VALA_DMAP_CONTAINER_DB, ValaDmapContainerDbClass))
#define IS_VALA_DMAP_CONTAINER_DB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_VALA_DMAP_CONTAINER_DB))
#define IS_VALA_DMAP_CONTAINER_DB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_VALA_DMAP_CONTAINER_DB))
#define VALA_DMAP_CONTAINER_DB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_VALA_DMAP_CONTAINER_DB, ValaDmapContainerDbClass))

typedef struct _ValaDmapContainerDb ValaDmapContainerDb;
typedef struct _ValaDmapContainerDbClass ValaDmapContainerDbClass;
typedef struct _ValaDmapContainerDbPrivate ValaDmapContainerDbPrivate;
enum  {
	VALA_DMAP_CONTAINER_DB_0_PROPERTY,
	VALA_DMAP_CONTAINER_DB_NUM_PROPERTIES
};
static GParamSpec* vala_dmap_container_db_properties[VALA_DMAP_CONTAINER_DB_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _ValaDmapContainerDb {
	GObject parent_instance;
	ValaDmapContainerDbPrivate * priv;
};

struct _ValaDmapContainerDbClass {
	GObjectClass parent_class;
};

struct _ValaDmapContainerDbPrivate {
	GeeArrayList* db;
};

static gint ValaDmapContainerDb_private_offset;
static gpointer vala_dmap_container_db_parent_class = NULL;
static DmapContainerDbInterface * vala_dmap_container_db_dmap_container_db_parent_iface = NULL;

VALA_EXTERN GType vala_dmap_container_db_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ValaDmapContainerDb, g_object_unref)
static gint64 vala_dmap_container_db_real_count (DmapContainerDb* base);
static void vala_dmap_container_db_real_foreach (DmapContainerDb* base,
                                          DmapIdContainerRecordFunc func,
                                          gpointer func_target);
static DmapContainerRecord* vala_dmap_container_db_real_lookup_by_id (DmapContainerDb* base,
                                                               guint id);
static void vala_dmap_container_db_real_add (DmapContainerDb* base,
                                      DmapContainerRecord* record,
                                      GError** error);
VALA_EXTERN ValaDmapContainerDb* vala_dmap_container_db_new (void);
VALA_EXTERN ValaDmapContainerDb* vala_dmap_container_db_construct (GType object_type);
static void vala_dmap_container_db_finalize (GObject * obj);
static GType vala_dmap_container_db_get_type_once (void);

static inline gpointer
vala_dmap_container_db_get_instance_private (ValaDmapContainerDb* self)
{
	return G_STRUCT_MEMBER_P (self, ValaDmapContainerDb_private_offset);
}

static gint64
vala_dmap_container_db_real_count (DmapContainerDb* base)
{
	ValaDmapContainerDb * self;
	GeeArrayList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gint64 result;
	self = (ValaDmapContainerDb*) base;
	_tmp0_ = self->priv->db;
	_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = (gint64) _tmp2_;
	return result;
}

static void
vala_dmap_container_db_real_foreach (DmapContainerDb* base,
                                     DmapIdContainerRecordFunc func,
                                     gpointer func_target)
{
	ValaDmapContainerDb * self;
	gint i = 0;
	self = (ValaDmapContainerDb*) base;
	{
		gboolean _tmp0_ = FALSE;
		i = 0;
		_tmp0_ = TRUE;
		while (TRUE) {
			GeeArrayList* _tmp2_;
			gint _tmp3_;
			gint _tmp4_;
			GeeArrayList* _tmp5_;
			gpointer _tmp6_;
			DmapContainerRecord* _tmp7_;
			if (!_tmp0_) {
				gint _tmp1_;
				_tmp1_ = i;
				i = _tmp1_ + 1;
			}
			_tmp0_ = FALSE;
			_tmp2_ = self->priv->db;
			_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
			_tmp4_ = _tmp3_;
			if (!(i < _tmp4_)) {
				break;
			}
			_tmp5_ = self->priv->db;
			_tmp6_ = gee_abstract_list_get ((GeeAbstractList*) _tmp5_, i);
			_tmp7_ = (DmapContainerRecord*) _tmp6_;
			func ((guint) i, _tmp7_, func_target);
			_g_object_unref0 (_tmp7_);
		}
	}
}

static DmapContainerRecord*
vala_dmap_container_db_real_lookup_by_id (DmapContainerDb* base,
                                          guint id)
{
	ValaDmapContainerDb * self;
	self = (ValaDmapContainerDb*) base;
	g_error ("vala-dmap-container-db.vala:40: lookup_by_id not implemented");
}

static void
vala_dmap_container_db_real_add (DmapContainerDb* base,
                                 DmapContainerRecord* record,
                                 GError** error)
{
	ValaDmapContainerDb * self;
	self = (ValaDmapContainerDb*) base;
	g_return_if_fail (record != NULL);
	g_error ("vala-dmap-container-db.vala:44: add not implemented");
}

ValaDmapContainerDb*
vala_dmap_container_db_construct (GType object_type)
{
	ValaDmapContainerDb * self = NULL;
	self = (ValaDmapContainerDb*) g_object_new (object_type, NULL);
	return self;
}

ValaDmapContainerDb*
vala_dmap_container_db_new (void)
{
	return vala_dmap_container_db_construct (TYPE_VALA_DMAP_CONTAINER_DB);
}

static void
vala_dmap_container_db_class_init (ValaDmapContainerDbClass * klass,
                                   gpointer klass_data)
{
	vala_dmap_container_db_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ValaDmapContainerDb_private_offset);
	G_OBJECT_CLASS (klass)->finalize = vala_dmap_container_db_finalize;
}

static void
vala_dmap_container_db_dmap_container_db_interface_init (DmapContainerDbInterface * iface,
                                                         gpointer iface_data)
{
	vala_dmap_container_db_dmap_container_db_parent_iface = g_type_interface_peek_parent (iface);
	iface->count = (gint64 (*) (DmapContainerDb*)) vala_dmap_container_db_real_count;
	iface->foreach = (void (*) (DmapContainerDb*, DmapIdContainerRecordFunc, gpointer)) vala_dmap_container_db_real_foreach;
	iface->lookup_by_id = (DmapContainerRecord* (*) (DmapContainerDb*, guint)) vala_dmap_container_db_real_lookup_by_id;
	iface->add = (void (*) (DmapContainerDb*, DmapContainerRecord*, GError**)) vala_dmap_container_db_real_add;
}

static void
vala_dmap_container_db_instance_init (ValaDmapContainerDb * self,
                                      gpointer klass)
{
	GeeArrayList* _tmp0_;
	self->priv = vala_dmap_container_db_get_instance_private (self);
	_tmp0_ = gee_array_list_new (dmap_container_record_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->priv->db = _tmp0_;
}

static void
vala_dmap_container_db_finalize (GObject * obj)
{
	ValaDmapContainerDb * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_VALA_DMAP_CONTAINER_DB, ValaDmapContainerDb);
	_g_object_unref0 (self->priv->db);
	G_OBJECT_CLASS (vala_dmap_container_db_parent_class)->finalize (obj);
}

static GType
vala_dmap_container_db_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ValaDmapContainerDbClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_dmap_container_db_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaDmapContainerDb), 0, (GInstanceInitFunc) vala_dmap_container_db_instance_init, NULL };
	static const GInterfaceInfo dmap_container_db_info = { (GInterfaceInitFunc) vala_dmap_container_db_dmap_container_db_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType vala_dmap_container_db_type_id;
	vala_dmap_container_db_type_id = g_type_register_static (G_TYPE_OBJECT, "ValaDmapContainerDb", &g_define_type_info, 0);
	g_type_add_interface_static (vala_dmap_container_db_type_id, dmap_container_db_get_type (), &dmap_container_db_info);
	ValaDmapContainerDb_private_offset = g_type_add_instance_private (vala_dmap_container_db_type_id, sizeof (ValaDmapContainerDbPrivate));
	return vala_dmap_container_db_type_id;
}

GType
vala_dmap_container_db_get_type (void)
{
	static volatile gsize vala_dmap_container_db_type_id__once = 0;
	if (g_once_init_enter (&vala_dmap_container_db_type_id__once)) {
		GType vala_dmap_container_db_type_id;
		vala_dmap_container_db_type_id = vala_dmap_container_db_get_type_once ();
		g_once_init_leave (&vala_dmap_container_db_type_id__once, vala_dmap_container_db_type_id);
	}
	return vala_dmap_container_db_type_id__once;
}

