/*******************************************************************************
 * Copyright (c) 2015-2016 ONERA.
 * Ce logiciel est la propriété de l’ONERA (the French Aerospace Lab).
 * Tous droits réservés.
 *
 * Ce programme et les éléments qui l'accompagnent sont mis à disposition
 * aux conditions définies par le contrat de licence logiciel CeCILL-C soumise
 * au droit français et respectant les principes de diffusion des logiciels libres.
 * Vous pouvez utiliser, modifier et/ou redistribuer ce programme
 * sous les conditions de la licence CeCILL-C (http://www.cecill.info).

 * This software is property of ONERA (the French Aerospace Lab).
 * All rights reserved.
 *
 * This program and the accompanying materials are made available under
 * the terms of the CeCILL-C license under French law and
 * abiding by the rules of distribution of free software.
 * You can  use, modify and/ or redistribute the software under the terms of
 * the CeCILL-C license (http://www.cecill.info).
 *
 * Contributeurs/contributors:
 *     Guillaume Infantes (ONERA - Centre de Toulouse) - initial API and implementation
 *
 *******************************************************************************/

// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// 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 the
// GNU Library General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// Copyright Florent Teichteil-Koenigsbuch (2008)

#ifndef EXCEPTION_H_
#define EXCEPTION_H_

#include <exception>
#include <string>

namespace epoch {

    class Exception : public std::exception
    {
    protected :
	std::string error_message_;
	std::string function_backtrace_;
	mutable std::string what_message_;
	
    public :
	Exception(std::string const & error_message, std::string const & throwing_function = "");
	virtual ~Exception() throw();
	
	virtual const char * what() const throw();
	virtual void push_function_backtrace(std::string const & throwing_function);
	virtual void clear_function_backtrace();
    };
    

    class ParserException : public Exception
    {
    public :
	ParserException(std::string const & error_message, std::string const & throwing_function = "");
	virtual ~ParserException() throw();
    };
    
    
    class RequirementException : public ParserException
    {
    public :
	RequirementException(std::string const & error_message, std::string const & throwing_function = "");
	virtual ~RequirementException() throw();
    };
    
    
    class OverflowException : public Exception
    {
    public :
	OverflowException(std::string const & error_message, std::string const & throwing_function = "");
	virtual ~OverflowException() throw();
    };
    
    
    class NumericException : public Exception
    {
    public :
	NumericException(std::string const & error_message, std::string const & throwing_function = "");
	virtual ~NumericException() throw();
    };
    
    
    class RedundancyException : public Exception
    {
    public :
	RedundancyException(std::string const & error_message, std::string const & throwing_function = "");
	virtual ~RedundancyException() throw();
    };
    
    
    class CloneException : public Exception
    {
    public :
	CloneException(std::string const & error_message, std::string const & throwing_function = "");
	virtual ~CloneException() throw();
    };
    
    class LearnerException : public Exception
    {
    public :
	LearnerException(std::string const & error_message, std::string const & throwing_function = "");
	virtual ~LearnerException() throw();
    };
    
    
    class UndecidableException : public LearnerException
    {
    public :
	UndecidableException(std::string const & error_message, std::string const & throwing_function = "");
	virtual ~UndecidableException() throw();
    };
    
    
    class PlannerException : public Exception
    {
    public :
	PlannerException(std::string const & error_message, std::string const & throwing_function = "");
	virtual ~PlannerException() throw();
    };
    
    
    class TimeOutException : public PlannerException
    {
    public :
	TimeOutException(std::string const & error_message, std::string const & throwing_function = "");
	virtual ~TimeOutException() throw();
    };
    
    
    class IncompatibilityException : public Exception
    {
    public :
	IncompatibilityException(std::string const & error_message, std::string const & throwing_function = "");
	virtual ~IncompatibilityException() throw();
};
    
}

#endif /*EXCEPTION_H_*/
