Quad tree search badaxisexception.cc

From Minor Miracle Software
Jump to: navigation, search
// BadAxisException.cc

#ifndef BADAXISEXCEPTION_CC
#define BADAXISEXCEPTION_CC

#include "TemasBase.h"


#ifdef __USE_STD_IOSTREAM
#include <exception.h>
#else
#include <exception>
#endif

#include <string>

using namespace std;

class BadAxisException : public exception
{
	string Error_string;

public:
	BadAxisException(){}

	BadAxisException( const BadAxisException &B )
	{
		Error_string = B.Error_string;
	}

	~BadAxisException(){}

	BadAxisException( string S )
	{
		Error_string = S;
	}

	virtual const char* what()
	{
		return Error_string.data();
	}

    void test( int Axis_float ) throw (BadAxisException)
	{
		if( Axis_float > MaxAxis )
		{
			string S = "BadAxisException: The axis is more than ";
			S += "1024";
			S += "\n";
			throw BadAxisException( S );
		} // if

		if( Axis_float < MinAxis )
		{
			string T = "BadAxisException: The axis is less than ";
			T += "0";
			T += "\n";
			throw BadAxisException( T );
		} // if
	} // test
};
#endif // BadAxisException