/*
** SellaNMS
** $Id: gui.h,v 1.12 2005/05/15 05:21:17 sella Exp $
** Copyright (c) 2001-2005 Digital Genesis Software, LLC. All Rights Reserved.
** Released under the GPL Version 2 License.
** http://www.digitalgenesis.com
*/

#ifndef __DGS_MODULE_OUTPUT_GUI_H
#define __DGS_MODULE_OUTPUT_GUI_H

#ifdef HAVE_CONFIG_H
	#include "config.h"
#endif

#include "defaults.h"
#include "util.h"
#include "policy_framework/policy_framework.h"
#include "../output.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <stl/queue>
#include <stl/string>
#include <stl/hash_map>

#define MODULE_OUTPUT_GUI_DELAY_DEFAULT (USLEEP_LONGLOOP_TIME * 2)
#define MODULE_OUTPUT_GUI_QUEUEDEPTH_DEFAULT MODULE_OUTPUT_QUEUEDEPTH_DEFAULT

typedef struct hash_map<string, queue<variable_binding_t> > gui_queue_t;

class Gui: public Output {
	public:
		Gui();
		virtual ~Gui();

	protected:
		virtual RESULT setQueue(gui_queue_t *guiQueue, pthread_mutex_t *guiQueueMutex);
		virtual RESULT GuiQueueNext(const string &status, variable_binding_t &policy_output);
		virtual RESULT registerStatus(const string &status);
		virtual RESULT printConfig();

	private:
		virtual RESULT scheduler();
		virtual RESULT execute();
		virtual RESULT readConfig();
		virtual RESULT childStart(Module *child_module);
		virtual RESULT processPolicyOutput(variable_binding_t &policy_output);

		gui_queue_t *guiQueue;
		pthread_mutex_t *guiQueueMutex;

		bool historyEnabled;
		unsigned long delay;
};

#endif

/*
** Local Variables:
** c-basic-offset: 3
** tab-width: 3
** End:
** vim600: fdm=marker
** vim: noet ts=3 sw=3
*/
