/*
 * (c) 2005 Research Group Dr. Fuhrmann, University of Karlsruhe, Germany
 * All rights reserved.
 *
 * Author:
 *         Stefan Denk <denk@ira.uka.de>
 *         Kendy Kutzner <kutzner@ira.uka.de>
 *
 * $Id: igorinterface.h,v 1.3 2005/12/27 12:12:33 kutzner Exp $
 *
 */

#ifndef _IGORINTERFACE_H_
#define _IGORINTERFACE_H_

#include "vtqueue.h"

/** Receives messages from the igor.
 * Since the igor_receive() call may block indefinitely, the task to fetch
 * messages from the igor is put into this thread. Messages received are put in
 * a queue of messages. After a message is received, somebody else can be woken
 * up.
 */
class igorinterface : public cThread {
	public:
		/** Main loop.
		 * Receives messages, puts them into a queue, signals a waiter.
		 * \bug Implementation incomplete
		 */
		void Action();
		/** constructs such a thread
		 * \param q The queue where this tread should all received message put to.
		 * \param w A vdr-defined condition variable where this thread should signal that something arrived.
		 * \param s The igor-socket where to poll for new messages.
		 */
		igorinterface(cqueue * q, cCondWait * w, int * s) : _q(q), _w(w), _s(s) {};
	private:
		/** The queue where to put new messages */
		cqueue *_q;
		/** The conditional variable where to signal new messages */
		cCondWait * _w;
		/** The socket where to receive new messages from */
		int * _s;
};



#endif // _IGORINTERFACE_H_
