//------------------------------------------------------------------------------
// Lamp : Open source game middleware
// Copyright (C) 2004  Junpei Ohtani ( Email : junpee@users.sourceforge.jp )
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library 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
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//------------------------------------------------------------------------------

/** @file
 * 限界値ヘッダ
 * @author Junpee
 */

#ifndef LIMIT_H_
#define LIMIT_H_

namespace Lamp{

//------------------------------------------------------------------------------
/**
 * 限界値
 */
class Limit{
public:
	/// char最小値
	static const char charMin = (-128);
	/// char最大値
	static const char charMax = (127);
	/// u_char最小値
	static const u_char uCharMin = (0);
	/// u_char最大値
	static const u_char uCharMax = (0xff);

	/// short最小値
	static const short shortMin = (-32768);
	/// short最大値
	static const short shortMax = (32767);
	/// u_short最小値
	static const u_short uShortMin = (0);
	/// u_short最大値
	static const u_short uShortMax = (0xffff);

	/// int最小値
	static const int intMin = (-2147483647 - 1);
	/// int最大値
	static const int intMax = (2147483647);
	/// u_int最小値
	static const u_int uIntMin = (0);
	/// u_int最大値
	static const u_int uIntMax = (0xffffffff);

	/// float最小の正数
	static const float floatPositiveMin;
	/// float最大値
	static const float floatMax;
	/// float最大値平方根
	static const float floatMaxSqrt;

	/// double最小値
	static const double doubleMin;
	/// double最大値
	static const double doubleMax;

	//--------------------------------------------------------------------------
	/**
	 * charの範囲内か
	 * @param value チェックする値
	 */
	static bool inCharRange(int value){
		return ((value >= charMin) && (value <= charMax));
	}

	/**
	 * u_charの範囲内か
	 * @param value チェックする値
	 */
	static bool inUCharRange(int value){
		return ((value >= uCharMin) && (value <= uCharMax));
	}

	//--------------------------------------------------------------------------
	/**
	 * shortの範囲内か
	 * @param value チェックする値
	 */
	static bool inShortRange(int value){
		return ((value >= shortMin) && (value <= shortMax));
	}

	/**
	 * u_shortの範囲内か
	 * @param value チェックする値
	 */
	static bool inUShortRange(int value){
		return ((value >= uShortMin) && (value <= uShortMax));
	}

private:
	//--------------------------------------------------------------------------
	// コンストラクタの隠蔽
	Limit();

};

//------------------------------------------------------------------------------
} // End of namespace Lamp
#endif // End of _H_
//------------------------------------------------------------------------------
