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

📄 _obj_managers.h

📁 http代理程序
💻 H
字号:
#ifndef ___obj_managers_h__
#define ___obj_managers_h__

/*
Generic object manager
Traits for the managed objects the object
*/
template< class T >
struct _object_manager
{
	// Managed type
	typedef T managed_type;	

	// Function name	: init_object
	// Description	    : Init the managed object
	// Return type		: void 
	// Argument         : managed_type& a
	void init_object( managed_type& a )
	{
	}

	// Function name	: delete_object
	// Description	    : Destroys the managed object
	// Return type		: void 
	// Argument         : managed_type& a
	void delete_object( managed_type& a )
	{
	}
};

/*
Pointer manager
*/
template< class T >
struct _pointer_manager :
	public _object_manager< T >
{

	// Function name	: init_object
	// Description	    : Init the managed object
	// Return type		: void 
	// Argument         : managed_type& a
	void init_object( managed_type& a )
	{
		a = NULL;
	}

	// Function name	: delete_object
	// Description	    : Deletes the pointer
	// Return type		: void 
	// Argument         : managed_type& a
	void delete_object( managed_type& a )
	{
		if( a != NULL )
		{
			delete a;
			a = NULL;
		}
	}
};

/*
Array manager
*/
template< class T >
struct _array_manager :
	public _object_manager< T >
{

	// Function name	: init_object
	// Description	    : Init the managed object
	// Return type		: void 
	// Argument         : managed_type& a
	void init_object( managed_type& a )
	{
		a = NULL;
	}

	// Function name	: delete_object
	// Description	    : Deletes the array
	// Return type		: void 
	// Argument         : managed_type& a
	void delete_object( managed_type& a )
	{
		if( a != NULL )
		{
			delete[] a;
			a = NULL;
		}
	}
};


#endif // ___obj_managers_h__

⌨️ 快捷键说明

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