#ifndef EXCEPTION_H__
#define EXCEPTION_H__

#include <exception>
#include <string>
#include <iostream>

namespace collapseTracklets {
    namespace exceptions {
       

#define LSST_EXCEPT(class, str)                 \
        class(str);
        
#define LSST_EXCEPTION_TYPE(t, b, c)                    \
        class t : public b {                            \
        public:                                         \
        t() : b () { };                                 \
        t(std::string s) { std::cerr << s; exit(1);  }; \
        };
        
        LSST_EXCEPTION_TYPE(ProgrammerErrorException, std::exception, 
                            collapseTracklets::exceptions::ProgrammerErrorException)
        
        LSST_EXCEPTION_TYPE(BadParameterException, ProgrammerErrorException, 
                            collapseTracklets::exceptions::BadParameterException)
        
        LSST_EXCEPTION_TYPE(UserErrorException, std::exception,
                            collapseTracklets::exceptions::UserErrorException)
        
        LSST_EXCEPTION_TYPE(InputFileFormatErrorException, UserErrorException, 
                            collapseTracklets::exceptions::InputFileFormatErrorException)
        
        LSST_EXCEPTION_TYPE(CommandlineParseErrorException, UserErrorException, 
                            collapseTracklets::exceptions::CommandlineParseErrorException)
        
        LSST_EXCEPTION_TYPE(GSLException, std::exception, 
                            collapseTracklets::exceptions::GSLException)
        
        LSST_EXCEPTION_TYPE(FileException, std::exception,
                            collapseTracklets::exceptions::FileException)

        LSST_EXCEPTION_TYPE(MemoryException, std::exception,
                            collapseTracklets::exceptions::MemoryException)

        LSST_EXCEPTION_TYPE(UninitializedException, std::exception,
                            collapseTracklets::exceptions::UninitializedException)
        
    
    }
}


#endif
