/*********************************************************************
 * This file is part of the PRAPI library.
 *
 * Copyright (C) 2001 Topi Mäenpää and Jaakko Viertola
 * All rights reserved.
 *
 * This program is free software. You can redistribute and/or modify
 * it under the terms of the free software licence found in the
 * accompanying file "COPYING". The licence terms must always be
 * redistributed with this source file. The above copyright notice
 * must be reproduced in all modified and unmodified copies of this
 * source file.
 *
 * $Revision: 1.8 $
 *********************************************************************/

#ifndef _FEATUREEXTRACTOR_H
#define _FEATUREEXTRACTOR_H

#include <List.h>
#include <Exception.h>

namespace prapi
{
	/**
	 * An exception for errors in feature extraction.
	 **/
	class FeatureExtractionException : public util::Exception
	{
	public:
		FeatureExtractionException(std::string message) : util::Exception(message) {}
	};
	
	/**
	 * FeatureExtractor is an interface for operations that calculate a
	 * feature vector out of something. This is a very general
	 * representation as the type of "something" isn't restricted in any
	 * way. It may be an image, a speech sample or whatever.
	 **/
	template <class T, class U> class FeatureExtractor : virtual public util::Object
	{
	public:
		virtual ~FeatureExtractor() {}
		/**
		 * Create a feature vector for a pattern. In most cases, the
		 * length of the returned vector is assumed to be constant for all
		 * possible patterns. This assumption is not restrictive, however,
		 * and one may use the returned value as needed.
		 *
		 * @param pattern a sample
		 * @return a feature vector
		 **/
		virtual util::List<T> getFeatureVector(const U& pattern) throw (FeatureExtractionException&) = 0;
	};
}

#endif
