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

#include "libdino.h"
#include <gee.h>
#include <glib-object.h>
#include <glib.h>
#include <gobject/gvaluecollector.h>
#include <string.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

#define TYPE_WEAK_NOTIFY_WRAPPER (weak_notify_wrapper_get_type ())
#define WEAK_NOTIFY_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_WEAK_NOTIFY_WRAPPER, WeakNotifyWrapper))
#define WEAK_NOTIFY_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_WEAK_NOTIFY_WRAPPER, WeakNotifyWrapperClass))
#define IS_WEAK_NOTIFY_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_WEAK_NOTIFY_WRAPPER))
#define IS_WEAK_NOTIFY_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_WEAK_NOTIFY_WRAPPER))
#define WEAK_NOTIFY_WRAPPER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_WEAK_NOTIFY_WRAPPER, WeakNotifyWrapperClass))

typedef struct _WeakNotifyWrapper WeakNotifyWrapper;
typedef struct _WeakNotifyWrapperClass WeakNotifyWrapperClass;
enum  {
	WEAK_MAP_0_PROPERTY,
	WEAK_MAP_K_TYPE,
	WEAK_MAP_K_DUP_FUNC,
	WEAK_MAP_K_DESTROY_FUNC,
	WEAK_MAP_V_TYPE,
	WEAK_MAP_V_DUP_FUNC,
	WEAK_MAP_V_DESTROY_FUNC,
	WEAK_MAP_ENTRIES_PROPERTY,
	WEAK_MAP_KEYS_PROPERTY,
	WEAK_MAP_READ_ONLY_PROPERTY,
	WEAK_MAP_SIZE_PROPERTY,
	WEAK_MAP_VALUES_PROPERTY,
	WEAK_MAP_NUM_PROPERTIES
};
static GParamSpec* weak_map_properties[WEAK_MAP_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _WeakNotifyWrapperPrivate WeakNotifyWrapperPrivate;
#define _weak_notify_wrapper_unref0(var) ((var == NULL) ? NULL : (var = (weak_notify_wrapper_unref (var), NULL)))
typedef struct _Block46Data Block46Data;
typedef struct _ParamSpecWeakNotifyWrapper ParamSpecWeakNotifyWrapper;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _WeakMapPrivate {
	GType k_type;
	GBoxedCopyFunc k_dup_func;
	GDestroyNotify k_destroy_func;
	GType v_type;
	GBoxedCopyFunc v_dup_func;
	GDestroyNotify v_destroy_func;
	GeeHashMap* hash_map;
	GeeHashMap* notify_map;
	GeeSet* _entries;
};

struct _WeakNotifyWrapper {
	GTypeInstance parent_instance;
	volatile int ref_count;
	WeakNotifyWrapperPrivate * priv;
	GWeakNotify func;
	gpointer func_target;
	GDestroyNotify func_target_destroy_notify;
};

struct _WeakNotifyWrapperClass {
	GTypeClass parent_class;
	void (*finalize) (WeakNotifyWrapper *self);
};

struct _Block46Data {
	int _ref_count_;
	WeakMap* self;
	gpointer key;
};

struct _ParamSpecWeakNotifyWrapper {
	GParamSpec parent_instance;
};

static gint WeakMap_private_offset;
static gpointer weak_map_parent_class = NULL;
static gpointer weak_notify_wrapper_parent_class = NULL;

VALA_EXTERN gpointer weak_notify_wrapper_ref (gpointer instance);
VALA_EXTERN void weak_notify_wrapper_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_weak_notify_wrapper (const gchar* name,
                                            const gchar* nick,
                                            const gchar* blurb,
                                            GType object_type,
                                            GParamFlags flags);
VALA_EXTERN void value_set_weak_notify_wrapper (GValue* value,
                                    gpointer v_object);
VALA_EXTERN void value_take_weak_notify_wrapper (GValue* value,
                                     gpointer v_object);
VALA_EXTERN gpointer value_get_weak_notify_wrapper (const GValue* value);
VALA_EXTERN GType weak_notify_wrapper_get_type (void) G_GNUC_CONST ;
static guint ___lambda16_ (WeakMap* self,
                    gconstpointer v);
static guint ____lambda16__gee_hash_data_func (gconstpointer v,
                                        gpointer self);
static gboolean ___lambda17_ (WeakMap* self,
                       gconstpointer a,
                       gconstpointer b);
static gboolean ____lambda17__gee_equal_data_func (gconstpointer a,
                                            gconstpointer b,
                                            gpointer self);
static gboolean ___lambda18_ (WeakMap* self,
                       gconstpointer a,
                       gconstpointer b);
static gboolean ____lambda18__gee_equal_data_func (gconstpointer a,
                                            gconstpointer b,
                                            gpointer self);
static guint ___lambda19_ (WeakMap* self,
                    gconstpointer v);
static guint ____lambda19__gee_hash_data_func (gconstpointer v,
                                        gpointer self);
static gboolean ___lambda20_ (WeakMap* self,
                       gconstpointer a,
                       gconstpointer b);
static gboolean ____lambda20__gee_equal_data_func (gconstpointer a,
                                            gconstpointer b,
                                            gpointer self);
static void weak_map_real_clear (GeeAbstractMap* base);
static gpointer weak_map_real_get (GeeAbstractMap* base,
                            gconstpointer key);
static gboolean weak_map_real_has (GeeAbstractMap* base,
                            gconstpointer key,
                            gconstpointer value);
static gboolean weak_map_real_has_key (GeeAbstractMap* base,
                                gconstpointer key);
static GeeMapIterator* weak_map_real_map_iterator (GeeAbstractMap* base);
static void weak_map_real_set (GeeAbstractMap* base,
                        gconstpointer key,
                        gconstpointer value);
static Block46Data* block46_data_ref (Block46Data* _data46_);
static void block46_data_unref (void * _userdata_);
static void __lambda21_ (Block46Data* _data46_,
                  GObject* obj);
static void ___lambda21__gweak_notify (gpointer self,
                                GObject* object);
VALA_EXTERN WeakNotifyWrapper* weak_notify_wrapper_new (GWeakNotify func,
                                            gpointer func_target,
                                            GDestroyNotify func_target_destroy_notify);
VALA_EXTERN WeakNotifyWrapper* weak_notify_wrapper_construct (GType object_type,
                                                  GWeakNotify func,
                                                  gpointer func_target,
                                                  GDestroyNotify func_target_destroy_notify);
static gboolean weak_map_real_unset (GeeAbstractMap* base,
                              gconstpointer key,
                              gpointer* value);
static void weak_map_real_dispose (GObject* base);
static void weak_map_finalize (GObject * obj);
static GType weak_map_get_type_once (void);
static void _vala_weak_map_get_property (GObject * object,
                                  guint property_id,
                                  GValue * value,
                                  GParamSpec * pspec);
static void _vala_weak_map_set_property (GObject * object,
                                  guint property_id,
                                  const GValue * value,
                                  GParamSpec * pspec);
static void weak_notify_wrapper_finalize (WeakNotifyWrapper * obj);
static GType weak_notify_wrapper_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
weak_map_get_instance_private (WeakMap* self)
{
	return G_STRUCT_MEMBER_P (self, WeakMap_private_offset);
}

static guint
___lambda16_ (WeakMap* self,
              gconstpointer v)
{
	guint _tmp0_ = 0U;
	GeeHashDataFunc _tmp1_;
	gpointer _tmp1__target;
	guint result;
	_tmp1_ = self->key_hash_func;
	_tmp1__target = self->key_hash_func_target;
	if (_tmp1_ != NULL) {
		GeeHashDataFunc _tmp2_;
		gpointer _tmp2__target;
		_tmp2_ = self->key_hash_func;
		_tmp2__target = self->key_hash_func_target;
		_tmp0_ = _tmp2_ (v, _tmp2__target);
	} else {
		_tmp0_ = (guint) 0;
	}
	result = _tmp0_;
	return result;
}

static guint
____lambda16__gee_hash_data_func (gconstpointer v,
                                  gpointer self)
{
	guint result;
	result = ___lambda16_ ((WeakMap*) self, v);
	return result;
}

static gboolean
___lambda17_ (WeakMap* self,
              gconstpointer a,
              gconstpointer b)
{
	gboolean _tmp0_ = FALSE;
	GeeEqualDataFunc _tmp1_;
	gpointer _tmp1__target;
	gboolean result;
	_tmp1_ = self->key_equal_func;
	_tmp1__target = self->key_equal_func_target;
	if (_tmp1_ != NULL) {
		GeeEqualDataFunc _tmp2_;
		gpointer _tmp2__target;
		_tmp2_ = self->key_equal_func;
		_tmp2__target = self->key_equal_func_target;
		_tmp0_ = _tmp2_ (a, b, _tmp2__target);
	} else {
		_tmp0_ = a == b;
	}
	result = _tmp0_;
	return result;
}

static gboolean
____lambda17__gee_equal_data_func (gconstpointer a,
                                   gconstpointer b,
                                   gpointer self)
{
	gboolean result;
	result = ___lambda17_ ((WeakMap*) self, a, b);
	return result;
}

static gboolean
___lambda18_ (WeakMap* self,
              gconstpointer a,
              gconstpointer b)
{
	gboolean _tmp0_ = FALSE;
	GeeEqualDataFunc _tmp1_;
	gpointer _tmp1__target;
	gboolean result;
	_tmp1_ = self->value_equal_func;
	_tmp1__target = self->value_equal_func_target;
	if (_tmp1_ != NULL) {
		GeeEqualDataFunc _tmp2_;
		gpointer _tmp2__target;
		_tmp2_ = self->value_equal_func;
		_tmp2__target = self->value_equal_func_target;
		_tmp0_ = _tmp2_ (a, b, _tmp2__target);
	} else {
		_tmp0_ = a == b;
	}
	result = _tmp0_;
	return result;
}

static gboolean
____lambda18__gee_equal_data_func (gconstpointer a,
                                   gconstpointer b,
                                   gpointer self)
{
	gboolean result;
	result = ___lambda18_ ((WeakMap*) self, a, b);
	return result;
}

static guint
___lambda19_ (WeakMap* self,
              gconstpointer v)
{
	guint _tmp0_ = 0U;
	GeeHashDataFunc _tmp1_;
	gpointer _tmp1__target;
	guint result;
	_tmp1_ = self->key_hash_func;
	_tmp1__target = self->key_hash_func_target;
	if (_tmp1_ != NULL) {
		GeeHashDataFunc _tmp2_;
		gpointer _tmp2__target;
		_tmp2_ = self->key_hash_func;
		_tmp2__target = self->key_hash_func_target;
		_tmp0_ = _tmp2_ (v, _tmp2__target);
	} else {
		_tmp0_ = (guint) 0;
	}
	result = _tmp0_;
	return result;
}

static guint
____lambda19__gee_hash_data_func (gconstpointer v,
                                  gpointer self)
{
	guint result;
	result = ___lambda19_ ((WeakMap*) self, v);
	return result;
}

static gboolean
___lambda20_ (WeakMap* self,
              gconstpointer a,
              gconstpointer b)
{
	gboolean _tmp0_ = FALSE;
	GeeEqualDataFunc _tmp1_;
	gpointer _tmp1__target;
	gboolean result;
	_tmp1_ = self->key_equal_func;
	_tmp1__target = self->key_equal_func_target;
	if (_tmp1_ != NULL) {
		GeeEqualDataFunc _tmp2_;
		gpointer _tmp2__target;
		_tmp2_ = self->key_equal_func;
		_tmp2__target = self->key_equal_func_target;
		_tmp0_ = _tmp2_ (a, b, _tmp2__target);
	} else {
		_tmp0_ = a == b;
	}
	result = _tmp0_;
	return result;
}

static gboolean
____lambda20__gee_equal_data_func (gconstpointer a,
                                   gconstpointer b,
                                   gpointer self)
{
	gboolean result;
	result = ___lambda20_ ((WeakMap*) self, a, b);
	return result;
}

WeakMap*
weak_map_construct (GType object_type,
                    GType k_type,
                    GBoxedCopyFunc k_dup_func,
                    GDestroyNotify k_destroy_func,
                    GType v_type,
                    GBoxedCopyFunc v_dup_func,
                    GDestroyNotify v_destroy_func,
                    GeeHashDataFunc key_hash_func,
                    gpointer key_hash_func_target,
                    GDestroyNotify key_hash_func_target_destroy_notify,
                    GeeEqualDataFunc key_equal_func,
                    gpointer key_equal_func_target,
                    GDestroyNotify key_equal_func_target_destroy_notify,
                    GeeEqualDataFunc value_equal_func,
                    gpointer value_equal_func_target,
                    GDestroyNotify value_equal_func_target_destroy_notify)
{
	WeakMap * self = NULL;
	GeeHashDataFunc _tmp0_;
	gpointer _tmp0__target;
	GDestroyNotify _tmp0__target_destroy_notify;
	GeeEqualDataFunc _tmp1_;
	gpointer _tmp1__target;
	GDestroyNotify _tmp1__target_destroy_notify;
	GeeEqualDataFunc _tmp2_;
	gpointer _tmp2__target;
	GDestroyNotify _tmp2__target_destroy_notify;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	GeeEqualDataFunc _tmp5_;
	gpointer _tmp5__target;
	self = (WeakMap*) gee_abstract_map_construct (object_type, k_type, (GBoxedCopyFunc) k_dup_func, (GDestroyNotify) k_destroy_func, v_type, (GBoxedCopyFunc) v_dup_func, (GDestroyNotify) v_destroy_func);
	self->priv->k_type = k_type;
	self->priv->k_dup_func = k_dup_func;
	self->priv->k_destroy_func = k_destroy_func;
	self->priv->v_type = v_type;
	self->priv->v_dup_func = v_dup_func;
	self->priv->v_destroy_func = v_destroy_func;
	if (!G_TYPE_IS_OBJECT (v_type)) {
		g_error ("weak_map.vala:14: WeakMap only takes values that are Objects");
	}
	_tmp0_ = key_hash_func;
	_tmp0__target = key_hash_func_target;
	_tmp0__target_destroy_notify = key_hash_func_target_destroy_notify;
	key_hash_func = NULL;
	key_hash_func_target = NULL;
	key_hash_func_target_destroy_notify = NULL;
	(self->key_hash_func_target_destroy_notify == NULL) ? NULL : (self->key_hash_func_target_destroy_notify (self->key_hash_func_target), NULL);
	self->key_hash_func = NULL;
	self->key_hash_func_target = NULL;
	self->key_hash_func_target_destroy_notify = NULL;
	self->key_hash_func = _tmp0_;
	self->key_hash_func_target = _tmp0__target;
	self->key_hash_func_target_destroy_notify = _tmp0__target_destroy_notify;
	_tmp1_ = key_equal_func;
	_tmp1__target = key_equal_func_target;
	_tmp1__target_destroy_notify = key_equal_func_target_destroy_notify;
	key_equal_func = NULL;
	key_equal_func_target = NULL;
	key_equal_func_target_destroy_notify = NULL;
	(self->key_equal_func_target_destroy_notify == NULL) ? NULL : (self->key_equal_func_target_destroy_notify (self->key_equal_func_target), NULL);
	self->key_equal_func = NULL;
	self->key_equal_func_target = NULL;
	self->key_equal_func_target_destroy_notify = NULL;
	self->key_equal_func = _tmp1_;
	self->key_equal_func_target = _tmp1__target;
	self->key_equal_func_target_destroy_notify = _tmp1__target_destroy_notify;
	_tmp2_ = value_equal_func;
	_tmp2__target = value_equal_func_target;
	_tmp2__target_destroy_notify = value_equal_func_target_destroy_notify;
	value_equal_func = NULL;
	value_equal_func_target = NULL;
	value_equal_func_target_destroy_notify = NULL;
	(self->value_equal_func_target_destroy_notify == NULL) ? NULL : (self->value_equal_func_target_destroy_notify (self->value_equal_func_target), NULL);
	self->value_equal_func = NULL;
	self->value_equal_func_target = NULL;
	self->value_equal_func_target_destroy_notify = NULL;
	self->value_equal_func = _tmp2_;
	self->value_equal_func_target = _tmp2__target;
	self->value_equal_func_target_destroy_notify = _tmp2__target_destroy_notify;
	_tmp5_ = self->key_equal_func;
	_tmp5__target = self->key_equal_func_target;
	if (_tmp5_ == NULL) {
		_tmp4_ = TRUE;
	} else {
		GeeEqualDataFunc _tmp6_;
		gpointer _tmp6__target;
		_tmp6_ = self->key_equal_func;
		_tmp6__target = self->key_equal_func_target;
		_tmp4_ = _tmp6_ == NULL;
	}
	if (_tmp4_) {
		_tmp3_ = TRUE;
	} else {
		GeeEqualDataFunc _tmp7_;
		gpointer _tmp7__target;
		_tmp7_ = self->value_equal_func;
		_tmp7__target = self->value_equal_func_target;
		_tmp3_ = _tmp7_ == NULL;
	}
	if (_tmp3_) {
		GeeHashMap* _tmp8_;
		GeeHashMap* _tmp9_;
		_tmp8_ = gee_hash_map_new (k_type, (GBoxedCopyFunc) k_dup_func, (GDestroyNotify) k_destroy_func, v_type, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
		_g_object_unref0 (self->priv->hash_map);
		self->priv->hash_map = _tmp8_;
		_tmp9_ = gee_hash_map_new (k_type, (GBoxedCopyFunc) k_dup_func, (GDestroyNotify) k_destroy_func, TYPE_WEAK_NOTIFY_WRAPPER, (GBoxedCopyFunc) weak_notify_wrapper_ref, (GDestroyNotify) weak_notify_wrapper_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
		_g_object_unref0 (self->priv->notify_map);
		self->priv->notify_map = _tmp9_;
	} else {
		GeeHashMap* _tmp10_;
		GeeHashMap* _tmp11_;
		_tmp10_ = gee_hash_map_new (k_type, (GBoxedCopyFunc) k_dup_func, (GDestroyNotify) k_destroy_func, v_type, NULL, NULL, ____lambda16__gee_hash_data_func, g_object_ref (self), g_object_unref, ____lambda17__gee_equal_data_func, g_object_ref (self), g_object_unref, ____lambda18__gee_equal_data_func, g_object_ref (self), g_object_unref);
		_g_object_unref0 (self->priv->hash_map);
		self->priv->hash_map = _tmp10_;
		_tmp11_ = gee_hash_map_new (k_type, (GBoxedCopyFunc) k_dup_func, (GDestroyNotify) k_destroy_func, TYPE_WEAK_NOTIFY_WRAPPER, (GBoxedCopyFunc) weak_notify_wrapper_ref, (GDestroyNotify) weak_notify_wrapper_unref, ____lambda19__gee_hash_data_func, g_object_ref (self), g_object_unref, ____lambda20__gee_equal_data_func, g_object_ref (self), g_object_unref, NULL, NULL, NULL);
		_g_object_unref0 (self->priv->notify_map);
		self->priv->notify_map = _tmp11_;
	}
	(key_hash_func_target_destroy_notify == NULL) ? NULL : (key_hash_func_target_destroy_notify (key_hash_func_target), NULL);
	key_hash_func = NULL;
	key_hash_func_target = NULL;
	key_hash_func_target_destroy_notify = NULL;
	(key_equal_func_target_destroy_notify == NULL) ? NULL : (key_equal_func_target_destroy_notify (key_equal_func_target), NULL);
	key_equal_func = NULL;
	key_equal_func_target = NULL;
	key_equal_func_target_destroy_notify = NULL;
	(value_equal_func_target_destroy_notify == NULL) ? NULL : (value_equal_func_target_destroy_notify (value_equal_func_target), NULL);
	value_equal_func = NULL;
	value_equal_func_target = NULL;
	value_equal_func_target_destroy_notify = NULL;
	return self;
}

WeakMap*
weak_map_new (GType k_type,
              GBoxedCopyFunc k_dup_func,
              GDestroyNotify k_destroy_func,
              GType v_type,
              GBoxedCopyFunc v_dup_func,
              GDestroyNotify v_destroy_func,
              GeeHashDataFunc key_hash_func,
              gpointer key_hash_func_target,
              GDestroyNotify key_hash_func_target_destroy_notify,
              GeeEqualDataFunc key_equal_func,
              gpointer key_equal_func_target,
              GDestroyNotify key_equal_func_target_destroy_notify,
              GeeEqualDataFunc value_equal_func,
              gpointer value_equal_func_target,
              GDestroyNotify value_equal_func_target_destroy_notify)
{
	return weak_map_construct (TYPE_WEAK_MAP, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, key_hash_func, key_hash_func_target, key_hash_func_target_destroy_notify, key_equal_func, key_equal_func_target, key_equal_func_target_destroy_notify, value_equal_func, value_equal_func_target, value_equal_func_target_destroy_notify);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
weak_map_real_clear (GeeAbstractMap* base)
{
	WeakMap * self;
	GeeHashMap* _tmp19_;
	GeeHashMap* _tmp20_;
	self = (WeakMap*) base;
	{
		GeeIterator* _key_it = NULL;
		GeeHashMap* _tmp0_;
		GeeSet* _tmp1_;
		GeeSet* _tmp2_;
		GeeSet* _tmp3_;
		GeeIterator* _tmp4_;
		GeeIterator* _tmp5_;
		_tmp0_ = self->priv->notify_map;
		_tmp1_ = gee_abstract_map_get_keys ((GeeAbstractMap*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_key_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			gpointer key = NULL;
			GeeIterator* _tmp7_;
			gpointer _tmp8_;
			GObject* o = NULL;
			GeeHashMap* _tmp9_;
			gconstpointer _tmp10_;
			gpointer _tmp11_;
			GObject* _tmp12_;
			GObject* _tmp13_;
			GeeHashMap* _tmp14_;
			gconstpointer _tmp15_;
			gpointer _tmp16_;
			WeakNotifyWrapper* _tmp17_;
			GWeakNotify _tmp18_;
			gpointer _tmp18__target;
			_tmp6_ = _key_it;
			if (!gee_iterator_next (_tmp6_)) {
				break;
			}
			_tmp7_ = _key_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			key = _tmp8_;
			_tmp9_ = self->priv->hash_map;
			_tmp10_ = key;
			_tmp11_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp9_, _tmp10_);
			_tmp12_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, G_TYPE_OBJECT, GObject));
			o = _tmp12_;
			_tmp13_ = o;
			_tmp14_ = self->priv->notify_map;
			_tmp15_ = key;
			_tmp16_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp14_, _tmp15_);
			_tmp17_ = (WeakNotifyWrapper*) _tmp16_;
			_tmp18_ = _tmp17_->func;
			_tmp18__target = _tmp17_->func_target;
			g_object_weak_unref (_tmp13_, _tmp18_, _tmp18__target);
			_weak_notify_wrapper_unref0 (_tmp17_);
			_g_object_unref0 (o);
			((key == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (key = (self->priv->k_destroy_func (key), NULL));
		}
		_g_object_unref0 (_key_it);
	}
	_tmp19_ = self->priv->hash_map;
	gee_abstract_map_clear ((GeeAbstractMap*) _tmp19_);
	_tmp20_ = self->priv->notify_map;
	gee_abstract_map_clear ((GeeAbstractMap*) _tmp20_);
}

static gpointer
weak_map_real_get (GeeAbstractMap* base,
                   gconstpointer key)
{
	WeakMap * self;
	GeeHashMap* _tmp0_;
	gpointer v = NULL;
	GeeHashMap* _tmp1_;
	gpointer _tmp2_;
	gpointer _tmp3_;
	gpointer _tmp4_;
	gpointer result;
	self = (WeakMap*) base;
	_tmp0_ = self->priv->hash_map;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, key)) {
		result = NULL;
		return result;
	}
	_tmp1_ = self->priv->hash_map;
	_tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp1_, key);
	_tmp3_ = ((_tmp2_ != NULL) && (self->priv->v_dup_func != NULL)) ? self->priv->v_dup_func ((gpointer) _tmp2_) : ((gpointer) _tmp2_);
	v = _tmp3_;
	_tmp4_ = v;
	v = NULL;
	result = _tmp4_;
	((v == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (v = (self->priv->v_destroy_func (v), NULL));
	return result;
}

static gboolean
weak_map_real_has (GeeAbstractMap* base,
                   gconstpointer key,
                   gconstpointer value)
{
	WeakMap * self;
	gboolean _tmp0_ = FALSE;
	gboolean result;
	self = (WeakMap*) base;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) self, key)) {
		gboolean _tmp1_ = FALSE;
		GeeEqualDataFunc _tmp2_;
		gpointer _tmp2__target;
		_tmp2_ = self->value_equal_func;
		_tmp2__target = self->value_equal_func_target;
		if (_tmp2_ != NULL) {
			GeeEqualDataFunc _tmp3_;
			gpointer _tmp3__target;
			GeeHashMap* _tmp4_;
			gpointer _tmp5_;
			_tmp3_ = self->value_equal_func;
			_tmp3__target = self->value_equal_func_target;
			_tmp4_ = self->priv->hash_map;
			_tmp5_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp4_, key);
			_tmp1_ = _tmp3_ (_tmp5_, value, _tmp3__target);
		} else {
			GeeHashMap* _tmp6_;
			gpointer _tmp7_;
			_tmp6_ = self->priv->hash_map;
			_tmp7_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp6_, key);
			_tmp1_ = _tmp7_ == value;
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static gboolean
weak_map_real_has_key (GeeAbstractMap* base,
                       gconstpointer key)
{
	WeakMap * self;
	GeeHashMap* _tmp0_;
	gboolean result;
	self = (WeakMap*) base;
	_tmp0_ = self->priv->hash_map;
	result = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, key);
	return result;
}

static GeeMapIterator*
weak_map_real_map_iterator (GeeAbstractMap* base)
{
	WeakMap * self;
	self = (WeakMap*) base;
	g_assert_not_reached ();
}

static Block46Data*
block46_data_ref (Block46Data* _data46_)
{
	g_atomic_int_inc (&_data46_->_ref_count_);
	return _data46_;
}

static void
block46_data_unref (void * _userdata_)
{
	Block46Data* _data46_;
	_data46_ = (Block46Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data46_->_ref_count_)) {
		WeakMap* self;
		self = _data46_->self;
		((_data46_->key == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (_data46_->key = (self->priv->k_destroy_func (_data46_->key), NULL));
		_g_object_unref0 (self);
		g_slice_free (Block46Data, _data46_);
	}
}

static void
__lambda21_ (Block46Data* _data46_,
             GObject* obj)
{
	WeakMap* self;
	GeeHashMap* _tmp0_;
	GeeHashMap* _tmp1_;
	self = _data46_->self;
	g_return_if_fail (obj != NULL);
	_tmp0_ = self->priv->hash_map;
	gee_abstract_map_unset ((GeeAbstractMap*) _tmp0_, _data46_->key, NULL);
	_tmp1_ = self->priv->notify_map;
	gee_abstract_map_unset ((GeeAbstractMap*) _tmp1_, _data46_->key, NULL);
}

static void
___lambda21__gweak_notify (gpointer self,
                           GObject* object)
{
	__lambda21_ (self, object);
}

static void
weak_map_real_set (GeeAbstractMap* base,
                   gconstpointer key,
                   gconstpointer value)
{
	WeakMap * self;
	Block46Data* _data46_;
	gpointer _tmp0_;
	GObject* v_obj = NULL;
	GObject* _tmp1_;
	WeakNotifyWrapper* notify_wrap = NULL;
	WeakNotifyWrapper* _tmp2_;
	GeeHashMap* _tmp3_;
	GWeakNotify _tmp4_;
	gpointer _tmp4__target;
	GeeHashMap* _tmp5_;
	self = (WeakMap*) base;
	_data46_ = g_slice_new0 (Block46Data);
	_data46_->_ref_count_ = 1;
	_data46_->self = g_object_ref (self);
	_tmp0_ = ((key != NULL) && (self->priv->k_dup_func != NULL)) ? self->priv->k_dup_func ((gpointer) key) : ((gpointer) key);
	((_data46_->key == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (_data46_->key = (self->priv->k_destroy_func (_data46_->key), NULL));
	_data46_->key = _tmp0_;
	_vala_assert (value != NULL, "value != null");
	gee_abstract_map_unset ((GeeAbstractMap*) self, _data46_->key, NULL);
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (value, G_TYPE_OBJECT, GObject));
	v_obj = _tmp1_;
	_tmp2_ = weak_notify_wrapper_new (___lambda21__gweak_notify, block46_data_ref (_data46_), block46_data_unref);
	notify_wrap = _tmp2_;
	_tmp3_ = self->priv->notify_map;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp3_, _data46_->key, notify_wrap);
	_tmp4_ = notify_wrap->func;
	_tmp4__target = notify_wrap->func_target;
	g_object_weak_ref (v_obj, _tmp4_, _tmp4__target);
	_tmp5_ = self->priv->hash_map;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp5_, _data46_->key, value);
	_weak_notify_wrapper_unref0 (notify_wrap);
	_g_object_unref0 (v_obj);
	block46_data_unref (_data46_);
	_data46_ = NULL;
}

static gboolean
weak_map_real_unset (GeeAbstractMap* base,
                     gconstpointer key,
                     gpointer* value)
{
	WeakMap * self;
	gpointer _vala_value = NULL;
	GeeHashMap* _tmp0_;
	GObject* v_obj = NULL;
	GeeHashMap* _tmp1_;
	gpointer _tmp2_;
	GObject* _tmp3_;
	GObject* _tmp4_;
	GeeHashMap* _tmp5_;
	gpointer _tmp6_;
	WeakNotifyWrapper* _tmp7_;
	GWeakNotify _tmp8_;
	gpointer _tmp8__target;
	GeeHashMap* _tmp9_;
	GeeHashMap* _tmp10_;
	gpointer _tmp11_ = NULL;
	gboolean _tmp12_;
	gpointer _tmp13_;
	gboolean result;
	self = (WeakMap*) base;
	_tmp0_ = self->priv->hash_map;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, key)) {
		((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL));
		_vala_value = NULL;
		result = FALSE;
		if (value) {
			*value = _vala_value;
		} else {
			((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL));
		}
		return result;
	}
	_tmp1_ = self->priv->hash_map;
	_tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp1_, key);
	_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, G_TYPE_OBJECT, GObject));
	v_obj = _tmp3_;
	_tmp4_ = v_obj;
	_tmp5_ = self->priv->notify_map;
	_tmp6_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp5_, key);
	_tmp7_ = (WeakNotifyWrapper*) _tmp6_;
	_tmp8_ = _tmp7_->func;
	_tmp8__target = _tmp7_->func_target;
	g_object_weak_unref (_tmp4_, _tmp8_, _tmp8__target);
	_weak_notify_wrapper_unref0 (_tmp7_);
	_tmp9_ = self->priv->notify_map;
	gee_abstract_map_unset ((GeeAbstractMap*) _tmp9_, key, NULL);
	_tmp10_ = self->priv->hash_map;
	_tmp12_ = gee_abstract_map_unset ((GeeAbstractMap*) _tmp10_, key, &_tmp11_);
	((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL));
	_tmp13_ = ((_tmp11_ != NULL) && (self->priv->v_dup_func != NULL)) ? self->priv->v_dup_func ((gpointer) _tmp11_) : ((gpointer) _tmp11_);
	_vala_value = _tmp13_;
	result = _tmp12_;
	_g_object_unref0 (v_obj);
	if (value) {
		*value = _vala_value;
	} else {
		((_vala_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (_vala_value = (self->priv->v_destroy_func (_vala_value), NULL));
	}
	return result;
}

static void
weak_map_real_dispose (GObject* base)
{
	WeakMap * self;
	self = (WeakMap*) base;
	{
		GeeIterator* _key_it = NULL;
		GeeHashMap* _tmp0_;
		GeeSet* _tmp1_;
		GeeSet* _tmp2_;
		GeeSet* _tmp3_;
		GeeIterator* _tmp4_;
		GeeIterator* _tmp5_;
		_tmp0_ = self->priv->notify_map;
		_tmp1_ = gee_abstract_map_get_keys ((GeeAbstractMap*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_key_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			gpointer key = NULL;
			GeeIterator* _tmp7_;
			gpointer _tmp8_;
			GObject* o = NULL;
			GeeHashMap* _tmp9_;
			gconstpointer _tmp10_;
			gpointer _tmp11_;
			GObject* _tmp12_;
			GObject* _tmp13_;
			GeeHashMap* _tmp14_;
			gconstpointer _tmp15_;
			gpointer _tmp16_;
			WeakNotifyWrapper* _tmp17_;
			GWeakNotify _tmp18_;
			gpointer _tmp18__target;
			_tmp6_ = _key_it;
			if (!gee_iterator_next (_tmp6_)) {
				break;
			}
			_tmp7_ = _key_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			key = _tmp8_;
			_tmp9_ = self->priv->hash_map;
			_tmp10_ = key;
			_tmp11_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp9_, _tmp10_);
			_tmp12_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, G_TYPE_OBJECT, GObject));
			o = _tmp12_;
			_tmp13_ = o;
			_tmp14_ = self->priv->notify_map;
			_tmp15_ = key;
			_tmp16_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp14_, _tmp15_);
			_tmp17_ = (WeakNotifyWrapper*) _tmp16_;
			_tmp18_ = _tmp17_->func;
			_tmp18__target = _tmp17_->func_target;
			g_object_weak_unref (_tmp13_, _tmp18_, _tmp18__target);
			_weak_notify_wrapper_unref0 (_tmp17_);
			_g_object_unref0 (o);
			((key == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (key = (self->priv->k_destroy_func (key), NULL));
		}
		_g_object_unref0 (_key_it);
	}
}

static GeeSet*
weak_map_real_get_entries (GeeAbstractMap* base)
{
	GeeSet* result;
	WeakMap* self;
	GeeSet* _tmp0_;
	GeeSet* _tmp1_;
	self = (WeakMap*) base;
	_tmp0_ = self->priv->_entries;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static GeeSet*
weak_map_real_get_keys (GeeAbstractMap* base)
{
	GeeSet* result;
	WeakMap* self;
	GeeHashMap* _tmp0_;
	GeeSet* _tmp1_;
	GeeSet* _tmp2_;
	self = (WeakMap*) base;
	_tmp0_ = self->priv->hash_map;
	_tmp1_ = gee_abstract_map_get_keys ((GeeAbstractMap*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static gboolean
weak_map_real_get_read_only (GeeAbstractMap* base)
{
	WeakMap* self;
	self = (WeakMap*) base;
	g_assert_not_reached ();
}

static gint
weak_map_real_get_size (GeeAbstractMap* base)
{
	gint result;
	WeakMap* self;
	GeeHashMap* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	self = (WeakMap*) base;
	_tmp0_ = self->priv->hash_map;
	_tmp1_ = gee_abstract_map_get_size ((GeeAbstractMap*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static GeeCollection*
weak_map_real_get_values (GeeAbstractMap* base)
{
	WeakMap* self;
	self = (WeakMap*) base;
	g_assert_not_reached ();
}

static void
weak_map_class_init (WeakMapClass * klass,
                     gpointer klass_data)
{
	weak_map_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WeakMap_private_offset);
	((GeeAbstractMapClass *) klass)->clear = (void (*) (GeeAbstractMap*)) weak_map_real_clear;
	((GeeAbstractMapClass *) klass)->get = (gpointer (*) (GeeAbstractMap*, gconstpointer)) weak_map_real_get;
	((GeeAbstractMapClass *) klass)->has = (gboolean (*) (GeeAbstractMap*, gconstpointer, gconstpointer)) weak_map_real_has;
	((GeeAbstractMapClass *) klass)->has_key = (gboolean (*) (GeeAbstractMap*, gconstpointer)) weak_map_real_has_key;
	((GeeAbstractMapClass *) klass)->map_iterator = (GeeMapIterator* (*) (GeeAbstractMap*)) weak_map_real_map_iterator;
	((GeeAbstractMapClass *) klass)->set = (void (*) (GeeAbstractMap*, gconstpointer, gconstpointer)) weak_map_real_set;
	((GeeAbstractMapClass *) klass)->unset = (gboolean (*) (GeeAbstractMap*, gconstpointer, gpointer*)) weak_map_real_unset;
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) weak_map_real_dispose;
	GEE_ABSTRACT_MAP_CLASS (klass)->get_entries = (GeeSet* (*) (GeeAbstractMap*)) weak_map_real_get_entries;
	GEE_ABSTRACT_MAP_CLASS (klass)->get_keys = (GeeSet* (*) (GeeAbstractMap*)) weak_map_real_get_keys;
	GEE_ABSTRACT_MAP_CLASS (klass)->get_read_only = (gboolean (*) (GeeAbstractMap*)) weak_map_real_get_read_only;
	GEE_ABSTRACT_MAP_CLASS (klass)->get_size = (gint (*) (GeeAbstractMap*)) weak_map_real_get_size;
	GEE_ABSTRACT_MAP_CLASS (klass)->get_values = (GeeCollection* (*) (GeeAbstractMap*)) weak_map_real_get_values;
	G_OBJECT_CLASS (klass)->get_property = _vala_weak_map_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_weak_map_set_property;
	G_OBJECT_CLASS (klass)->finalize = weak_map_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WEAK_MAP_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WEAK_MAP_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WEAK_MAP_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WEAK_MAP_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WEAK_MAP_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WEAK_MAP_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WEAK_MAP_ENTRIES_PROPERTY, weak_map_properties[WEAK_MAP_ENTRIES_PROPERTY] = g_param_spec_object ("entries", "entries", "entries", GEE_TYPE_SET, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WEAK_MAP_KEYS_PROPERTY, weak_map_properties[WEAK_MAP_KEYS_PROPERTY] = g_param_spec_object ("keys", "keys", "keys", GEE_TYPE_SET, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WEAK_MAP_READ_ONLY_PROPERTY, weak_map_properties[WEAK_MAP_READ_ONLY_PROPERTY] = g_param_spec_boolean ("read-only", "read-only", "read-only", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WEAK_MAP_SIZE_PROPERTY, weak_map_properties[WEAK_MAP_SIZE_PROPERTY] = g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WEAK_MAP_VALUES_PROPERTY, weak_map_properties[WEAK_MAP_VALUES_PROPERTY] = g_param_spec_object ("values", "values", "values", GEE_TYPE_COLLECTION, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
weak_map_instance_init (WeakMap * self,
                        gpointer klass)
{
	self->priv = weak_map_get_instance_private (self);
	self->key_hash_func = NULL;
	self->key_hash_func_target = NULL;
	self->key_hash_func_target_destroy_notify = NULL;
	self->key_equal_func = NULL;
	self->key_equal_func_target = NULL;
	self->key_equal_func_target_destroy_notify = NULL;
	self->value_equal_func = NULL;
	self->value_equal_func_target = NULL;
	self->value_equal_func_target_destroy_notify = NULL;
}

static void
weak_map_finalize (GObject * obj)
{
	WeakMap * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_WEAK_MAP, WeakMap);
	_g_object_unref0 (self->priv->hash_map);
	_g_object_unref0 (self->priv->notify_map);
	(self->key_hash_func_target_destroy_notify == NULL) ? NULL : (self->key_hash_func_target_destroy_notify (self->key_hash_func_target), NULL);
	self->key_hash_func = NULL;
	self->key_hash_func_target = NULL;
	self->key_hash_func_target_destroy_notify = NULL;
	(self->key_equal_func_target_destroy_notify == NULL) ? NULL : (self->key_equal_func_target_destroy_notify (self->key_equal_func_target), NULL);
	self->key_equal_func = NULL;
	self->key_equal_func_target = NULL;
	self->key_equal_func_target_destroy_notify = NULL;
	(self->value_equal_func_target_destroy_notify == NULL) ? NULL : (self->value_equal_func_target_destroy_notify (self->value_equal_func_target), NULL);
	self->value_equal_func = NULL;
	self->value_equal_func_target = NULL;
	self->value_equal_func_target_destroy_notify = NULL;
	_g_object_unref0 (self->priv->_entries);
	G_OBJECT_CLASS (weak_map_parent_class)->finalize (obj);
}

static GType
weak_map_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WeakMapClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) weak_map_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WeakMap), 0, (GInstanceInitFunc) weak_map_instance_init, NULL };
	GType weak_map_type_id;
	weak_map_type_id = g_type_register_static (GEE_TYPE_ABSTRACT_MAP, "WeakMap", &g_define_type_info, 0);
	WeakMap_private_offset = g_type_add_instance_private (weak_map_type_id, sizeof (WeakMapPrivate));
	return weak_map_type_id;
}

GType
weak_map_get_type (void)
{
	static volatile gsize weak_map_type_id__once = 0;
	if (g_once_init_enter (&weak_map_type_id__once)) {
		GType weak_map_type_id;
		weak_map_type_id = weak_map_get_type_once ();
		g_once_init_leave (&weak_map_type_id__once, weak_map_type_id);
	}
	return weak_map_type_id__once;
}

static void
_vala_weak_map_get_property (GObject * object,
                             guint property_id,
                             GValue * value,
                             GParamSpec * pspec)
{
	WeakMap * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_WEAK_MAP, WeakMap);
	switch (property_id) {
		case WEAK_MAP_ENTRIES_PROPERTY:
		g_value_take_object (value, gee_abstract_map_get_entries ((GeeAbstractMap*) self));
		break;
		case WEAK_MAP_KEYS_PROPERTY:
		g_value_take_object (value, gee_abstract_map_get_keys ((GeeAbstractMap*) self));
		break;
		case WEAK_MAP_READ_ONLY_PROPERTY:
		g_value_set_boolean (value, gee_abstract_map_get_read_only ((GeeAbstractMap*) self));
		break;
		case WEAK_MAP_SIZE_PROPERTY:
		g_value_set_int (value, gee_abstract_map_get_size ((GeeAbstractMap*) self));
		break;
		case WEAK_MAP_VALUES_PROPERTY:
		g_value_take_object (value, gee_abstract_map_get_values ((GeeAbstractMap*) self));
		break;
		case WEAK_MAP_K_TYPE:
		g_value_set_gtype (value, self->priv->k_type);
		break;
		case WEAK_MAP_K_DUP_FUNC:
		g_value_set_pointer (value, self->priv->k_dup_func);
		break;
		case WEAK_MAP_K_DESTROY_FUNC:
		g_value_set_pointer (value, self->priv->k_destroy_func);
		break;
		case WEAK_MAP_V_TYPE:
		g_value_set_gtype (value, self->priv->v_type);
		break;
		case WEAK_MAP_V_DUP_FUNC:
		g_value_set_pointer (value, self->priv->v_dup_func);
		break;
		case WEAK_MAP_V_DESTROY_FUNC:
		g_value_set_pointer (value, self->priv->v_destroy_func);
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_weak_map_set_property (GObject * object,
                             guint property_id,
                             const GValue * value,
                             GParamSpec * pspec)
{
	WeakMap * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_WEAK_MAP, WeakMap);
	switch (property_id) {
		case WEAK_MAP_K_TYPE:
		self->priv->k_type = g_value_get_gtype (value);
		break;
		case WEAK_MAP_K_DUP_FUNC:
		self->priv->k_dup_func = g_value_get_pointer (value);
		break;
		case WEAK_MAP_K_DESTROY_FUNC:
		self->priv->k_destroy_func = g_value_get_pointer (value);
		break;
		case WEAK_MAP_V_TYPE:
		self->priv->v_type = g_value_get_gtype (value);
		break;
		case WEAK_MAP_V_DUP_FUNC:
		self->priv->v_dup_func = g_value_get_pointer (value);
		break;
		case WEAK_MAP_V_DESTROY_FUNC:
		self->priv->v_destroy_func = g_value_get_pointer (value);
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

WeakNotifyWrapper*
weak_notify_wrapper_construct (GType object_type,
                               GWeakNotify func,
                               gpointer func_target,
                               GDestroyNotify func_target_destroy_notify)
{
	WeakNotifyWrapper* self = NULL;
	GWeakNotify _tmp0_;
	gpointer _tmp0__target;
	GDestroyNotify _tmp0__target_destroy_notify;
	self = (WeakNotifyWrapper*) g_type_create_instance (object_type);
	_tmp0_ = func;
	_tmp0__target = func_target;
	_tmp0__target_destroy_notify = func_target_destroy_notify;
	func = NULL;
	func_target = NULL;
	func_target_destroy_notify = NULL;
	(self->func_target_destroy_notify == NULL) ? NULL : (self->func_target_destroy_notify (self->func_target), NULL);
	self->func = NULL;
	self->func_target = NULL;
	self->func_target_destroy_notify = NULL;
	self->func = _tmp0_;
	self->func_target = _tmp0__target;
	self->func_target_destroy_notify = _tmp0__target_destroy_notify;
	(func_target_destroy_notify == NULL) ? NULL : (func_target_destroy_notify (func_target), NULL);
	func = NULL;
	func_target = NULL;
	func_target_destroy_notify = NULL;
	return self;
}

WeakNotifyWrapper*
weak_notify_wrapper_new (GWeakNotify func,
                         gpointer func_target,
                         GDestroyNotify func_target_destroy_notify)
{
	return weak_notify_wrapper_construct (TYPE_WEAK_NOTIFY_WRAPPER, func, func_target, func_target_destroy_notify);
}

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

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

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

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

static gchar*
value_weak_notify_wrapper_collect_value (GValue* value,
                                         guint n_collect_values,
                                         GTypeCValue* collect_values,
                                         guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		WeakNotifyWrapper * 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 = weak_notify_wrapper_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
value_weak_notify_wrapper_lcopy_value (const GValue* value,
                                       guint n_collect_values,
                                       GTypeCValue* collect_values,
                                       guint collect_flags)
{
	WeakNotifyWrapper ** 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 = weak_notify_wrapper_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
param_spec_weak_notify_wrapper (const gchar* name,
                                const gchar* nick,
                                const gchar* blurb,
                                GType object_type,
                                GParamFlags flags)
{
	ParamSpecWeakNotifyWrapper* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_WEAK_NOTIFY_WRAPPER), 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_weak_notify_wrapper (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_WEAK_NOTIFY_WRAPPER), NULL);
	return value->data[0].v_pointer;
}

void
value_set_weak_notify_wrapper (GValue* value,
                               gpointer v_object)
{
	WeakNotifyWrapper * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_WEAK_NOTIFY_WRAPPER));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_WEAK_NOTIFY_WRAPPER));
		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;
		weak_notify_wrapper_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		weak_notify_wrapper_unref (old);
	}
}

void
value_take_weak_notify_wrapper (GValue* value,
                                gpointer v_object)
{
	WeakNotifyWrapper * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_WEAK_NOTIFY_WRAPPER));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_WEAK_NOTIFY_WRAPPER));
		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) {
		weak_notify_wrapper_unref (old);
	}
}

static void
weak_notify_wrapper_class_init (WeakNotifyWrapperClass * klass,
                                gpointer klass_data)
{
	weak_notify_wrapper_parent_class = g_type_class_peek_parent (klass);
	((WeakNotifyWrapperClass *) klass)->finalize = weak_notify_wrapper_finalize;
}

static void
weak_notify_wrapper_instance_init (WeakNotifyWrapper * self,
                                   gpointer klass)
{
	self->ref_count = 1;
}

static void
weak_notify_wrapper_finalize (WeakNotifyWrapper * obj)
{
	WeakNotifyWrapper * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_WEAK_NOTIFY_WRAPPER, WeakNotifyWrapper);
	g_signal_handlers_destroy (self);
	(self->func_target_destroy_notify == NULL) ? NULL : (self->func_target_destroy_notify (self->func_target), NULL);
	self->func = NULL;
	self->func_target = NULL;
	self->func_target_destroy_notify = NULL;
}

static GType
weak_notify_wrapper_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { value_weak_notify_wrapper_init, value_weak_notify_wrapper_free_value, value_weak_notify_wrapper_copy_value, value_weak_notify_wrapper_peek_pointer, "p", value_weak_notify_wrapper_collect_value, "p", value_weak_notify_wrapper_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (WeakNotifyWrapperClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) weak_notify_wrapper_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WeakNotifyWrapper), 0, (GInstanceInitFunc) weak_notify_wrapper_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 weak_notify_wrapper_type_id;
	weak_notify_wrapper_type_id = g_type_register_fundamental (g_type_fundamental_next (), "WeakNotifyWrapper", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return weak_notify_wrapper_type_id;
}

GType
weak_notify_wrapper_get_type (void)
{
	static volatile gsize weak_notify_wrapper_type_id__once = 0;
	if (g_once_init_enter (&weak_notify_wrapper_type_id__once)) {
		GType weak_notify_wrapper_type_id;
		weak_notify_wrapper_type_id = weak_notify_wrapper_get_type_once ();
		g_once_init_leave (&weak_notify_wrapper_type_id__once, weak_notify_wrapper_type_id);
	}
	return weak_notify_wrapper_type_id__once;
}

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

void
weak_notify_wrapper_unref (gpointer instance)
{
	WeakNotifyWrapper * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		WEAK_NOTIFY_WRAPPER_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

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;
}

