

/*!
  @author d‹à‹›
  @since 2003/8/21
	@note
	licence:BSD Licence
*/


#ifndef _dktl_utility__h_
#define _dktl_utility__h_

namespace dkutil{

template<class T,class OBJ>
inline void GeneralPurposeFree(T func,OBJ obj)
{
	if(obj){func(obj);obj=NULL;}
}

template<class T>
inline void GeneralPurposeMessage(T function,char *str,...){
	int c;
	char s[c=1024+512];
	memset(s,'\0',sizeof(s));
	va_list VaList ;
	va_start( VaList , str) ;
	_vsnprintf( s ,c, str , VaList ) ;
	va_end( VaList ) ;
	function(s);
}



template<unsigned n>
struct GetKB{
	public:
		enum{value=1024*n,};
		//int GetValue(){return value;}
};

template<unsigned n>
struct GetBit{
	public:
		enum{value=n/8,};
};


}//end of dkutil namepsace

#endif //end of include once