/*======================================================================================

	Program:		Range Imaging Toolkit (RITK)
	Module:			ritkThreadedJob.h
	Version:		$Revision: 1817 $
	Date:			$Date: 2011-09-30 16:52:28 +0200 (Fri, 30 Sep 2011) $

	Copyright (c) 2010-2011
	Pattern Recognition Lab, 
    University Erlangen-Nuremberg, Germany
    All rights reserved.

	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 RITKCopyright.txt for more information.

	http://www5.informatik.uni-erlangen.de/research/software/ritk

========================================================================================*/

#ifndef THREADEDJOB_H__
#define THREADEDJOB_H__

#include "ritkCore.h"

#include <QString>
#include <QObject>

namespace ritk
{


/**	@ingroup	Core
 *	@class		ThreadedJob
 *	@author		Jakob Wasza
 *	@brief		Base class for all jobs that have to be executed in the working thread
 *
 *	@details
 *	This class defines the basic interface for jobs that have to be executed in
 *	the working thread. Subclasses have to provide an implementation of the
 *	Execute() method where the actual work is done. This method is called
 *	by the threader. Note that a threaded job as provided here should not
 *	contain massive work. It is rather meant as a concept for small tasks
 *	that require threading and are not worth setting up an own threading class.
 */
class CORE_EXPORT ThreadedJob : public QObject
{
	Q_OBJECT

public:
	/// Constructor
	ThreadedJob();
	/// Destructor
    virtual ~ThreadedJob();

	/**	@brief	Delete the job after execution
	 *	@return	true or false
	 *
	 *	@details
	 *	Returns whether the job has to be deleted after execution.
	 *	By default this method returns true. If this behaviour is
	 *	unwanted subclasses have simply to overwrite this method.
	 */
	virtual bool DeleteAfterExecution();

	/// Where the actual work is done
    virtual void Execute() = 0;
};

} // end namespace ritk

#endif // THREADEDJOB_H__
