⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 utility.h

📁 matlab的视频接口程序
💻 H
字号:
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//	utility.h
//		Utitlity functions used by the Matlab VFM module
//		These functions are type safe.
//	Copyright
//		(c) 1998 School of Information Systems 
//	Author
//		Farzad Pezeshkpour
//	Revision
//		1998/12/16
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

#ifndef __UTITLITY__
#define __UTITLITY__


//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// Safe deletion of pointers
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
template <class T> T* delete_ptr (T *&ptr) {
	if (ptr != NULL) {
		delete ptr;
		ptr = NULL;
	}
	return ptr;
}

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// Safe deletion of arrays
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
template <class T> T* delete_array (T *&ptr) {
	if (ptr != NULL) {
		delete []ptr;
		ptr = NULL;
	}
	return ptr;
}

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// Max
// Compares two values. Returns the largest.
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
template <class T> T Max (T a, T b) {
	return (a > b ? a : b);
}

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// Min
// Returns the smallest of two values
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
template <class T> T Min(T a, T b) {
	return (a > b ? b : a);
}

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// Abs
// Returns the absolute of a numeric type
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
template <class T> T Abs (T a) {
	return (a > 0 ? a : -a);
}


#endif //__UTITLITY__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -