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


#include <glib.h>
#include <glib-object.h>
#include <gdk/gdk.h>


#define PDFPC_RENDERER_CACHE_TYPE_BASE (pdfpc_renderer_cache_base_get_type ())
#define PDFPC_RENDERER_CACHE_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_RENDERER_CACHE_TYPE_BASE, pdfpcRendererCacheBase))
#define PDFPC_RENDERER_CACHE_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_RENDERER_CACHE_TYPE_BASE, pdfpcRendererCacheBaseClass))
#define PDFPC_RENDERER_CACHE_IS_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_RENDERER_CACHE_TYPE_BASE))
#define PDFPC_RENDERER_CACHE_IS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_RENDERER_CACHE_TYPE_BASE))
#define PDFPC_RENDERER_CACHE_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_RENDERER_CACHE_TYPE_BASE, pdfpcRendererCacheBaseClass))

typedef struct _pdfpcRendererCacheBase pdfpcRendererCacheBase;
typedef struct _pdfpcRendererCacheBaseClass pdfpcRendererCacheBaseClass;
typedef struct _pdfpcRendererCacheBasePrivate pdfpcRendererCacheBasePrivate;

#define PDFPC_METADATA_TYPE_BASE (pdfpc_metadata_base_get_type ())
#define PDFPC_METADATA_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_METADATA_TYPE_BASE, pdfpcMetadataBase))
#define PDFPC_METADATA_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_METADATA_TYPE_BASE, pdfpcMetadataBaseClass))
#define PDFPC_METADATA_IS_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_METADATA_TYPE_BASE))
#define PDFPC_METADATA_IS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_METADATA_TYPE_BASE))
#define PDFPC_METADATA_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_METADATA_TYPE_BASE, pdfpcMetadataBaseClass))

typedef struct _pdfpcMetadataBase pdfpcMetadataBase;
typedef struct _pdfpcMetadataBaseClass pdfpcMetadataBaseClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _pdfpcRendererCacheBase {
	GObject parent_instance;
	pdfpcRendererCacheBasePrivate * priv;
	pdfpcMetadataBase* metadata;
};

struct _pdfpcRendererCacheBaseClass {
	GObjectClass parent_class;
	void (*store) (pdfpcRendererCacheBase* self, guint index, GdkPixmap* pixmap);
	GdkPixmap* (*retrieve) (pdfpcRendererCacheBase* self, guint index);
};


static gpointer pdfpc_renderer_cache_base_parent_class = NULL;

GType pdfpc_renderer_cache_base_get_type (void) G_GNUC_CONST;
GType pdfpc_metadata_base_get_type (void) G_GNUC_CONST;
enum  {
	PDFPC_RENDERER_CACHE_BASE_DUMMY_PROPERTY
};
pdfpcRendererCacheBase* pdfpc_renderer_cache_base_construct (GType object_type, pdfpcMetadataBase* metadata);
gboolean pdfpc_renderer_cache_base_allows_prerendering (pdfpcRendererCacheBase* self);
void pdfpc_renderer_cache_base_store (pdfpcRendererCacheBase* self, guint index, GdkPixmap* pixmap);
static void pdfpc_renderer_cache_base_real_store (pdfpcRendererCacheBase* self, guint index, GdkPixmap* pixmap);
GdkPixmap* pdfpc_renderer_cache_base_retrieve (pdfpcRendererCacheBase* self, guint index);
static GdkPixmap* pdfpc_renderer_cache_base_real_retrieve (pdfpcRendererCacheBase* self, guint index);
static void pdfpc_renderer_cache_base_finalize (GObject* obj);


/**
         * Initialize the cache store
         */
static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


pdfpcRendererCacheBase* pdfpc_renderer_cache_base_construct (GType object_type, pdfpcMetadataBase* metadata) {
	pdfpcRendererCacheBase * self = NULL;
	pdfpcMetadataBase* _tmp0_;
	pdfpcMetadataBase* _tmp1_;
	g_return_val_if_fail (metadata != NULL, NULL);
	self = (pdfpcRendererCacheBase*) g_object_new (object_type, NULL);
	_tmp0_ = metadata;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->metadata);
	self->metadata = _tmp1_;
	return self;
}


/**
         * Asks the cache engine if prerendering is allowed in conjunction with it.
         *
         * The default behaviour is to allow prerendering, there might however
         * be engine implementation where prerendering does not make any sense.
         * Therefore it can be disabled by overriding this method and returning
         * false.
         */
gboolean pdfpc_renderer_cache_base_allows_prerendering (pdfpcRendererCacheBase* self) {
	gboolean result = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	result = TRUE;
	return result;
}


/**
         * Store a pixmap in the cache using the given index as identifier
         */
static void pdfpc_renderer_cache_base_real_store (pdfpcRendererCacheBase* self, guint index, GdkPixmap* pixmap) {
	g_critical ("Type `%s' does not implement abstract method `pdfpc_renderer_cache_base_store'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return;
}


void pdfpc_renderer_cache_base_store (pdfpcRendererCacheBase* self, guint index, GdkPixmap* pixmap) {
	g_return_if_fail (self != NULL);
	PDFPC_RENDERER_CACHE_BASE_GET_CLASS (self)->store (self, index, pixmap);
}


/**
         * Retrieve a stored pixmap from the cache.
         *
         * If no item with the given index is available null is returned
         */
static GdkPixmap* pdfpc_renderer_cache_base_real_retrieve (pdfpcRendererCacheBase* self, guint index) {
	g_critical ("Type `%s' does not implement abstract method `pdfpc_renderer_cache_base_retrieve'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return NULL;
}


GdkPixmap* pdfpc_renderer_cache_base_retrieve (pdfpcRendererCacheBase* self, guint index) {
	g_return_val_if_fail (self != NULL, NULL);
	return PDFPC_RENDERER_CACHE_BASE_GET_CLASS (self)->retrieve (self, index);
}


static void pdfpc_renderer_cache_base_class_init (pdfpcRendererCacheBaseClass * klass) {
	pdfpc_renderer_cache_base_parent_class = g_type_class_peek_parent (klass);
	PDFPC_RENDERER_CACHE_BASE_CLASS (klass)->store = pdfpc_renderer_cache_base_real_store;
	PDFPC_RENDERER_CACHE_BASE_CLASS (klass)->retrieve = pdfpc_renderer_cache_base_real_retrieve;
	G_OBJECT_CLASS (klass)->finalize = pdfpc_renderer_cache_base_finalize;
}


static void pdfpc_renderer_cache_base_instance_init (pdfpcRendererCacheBase * self) {
}


static void pdfpc_renderer_cache_base_finalize (GObject* obj) {
	pdfpcRendererCacheBase * self;
	self = PDFPC_RENDERER_CACHE_BASE (obj);
	_g_object_unref0 (self->metadata);
	G_OBJECT_CLASS (pdfpc_renderer_cache_base_parent_class)->finalize (obj);
}


/**
     * Base Cache store interface which needs to be implemented by every
     * working cache.
     */
GType pdfpc_renderer_cache_base_get_type (void) {
	static volatile gsize pdfpc_renderer_cache_base_type_id__volatile = 0;
	if (g_once_init_enter (&pdfpc_renderer_cache_base_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (pdfpcRendererCacheBaseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pdfpc_renderer_cache_base_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (pdfpcRendererCacheBase), 0, (GInstanceInitFunc) pdfpc_renderer_cache_base_instance_init, NULL };
		GType pdfpc_renderer_cache_base_type_id;
		pdfpc_renderer_cache_base_type_id = g_type_register_static (G_TYPE_OBJECT, "pdfpcRendererCacheBase", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
		g_once_init_leave (&pdfpc_renderer_cache_base_type_id__volatile, pdfpc_renderer_cache_base_type_id);
	}
	return pdfpc_renderer_cache_base_type_id__volatile;
}



