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

📄 memmanagebase.h

📁 这是一个程序的一般架构方法
💻 H
字号:
//-- {CycleCode: 141} file [0..883]
//-- {StartSubRegion: 144} module.ifndef [0..222]
// MemManageBase.h: interface for the CMemManageBase class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_MEMMANAGEBASE_H__5C942CE4_F8B7_420C_A1F8_DDF21A261BDE__INCLUDED_)
//-- {StartSubRegion: 145} module.define [223..300]
#define AFX_MEMMANAGEBASE_H__5C942CE4_F8B7_420C_A1F8_DDF21A261BDE__INCLUDED_
//-- {InsertRegion: 147} module.vulnerableDeclarations [301..552]
//## begin module.additionalDeclarations preserve=yes

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//////////////////////////////////////////////////////////////////////////
//内存管理
//申请小块但数量巨大内存时利用
//
//////////////////////////////////////////////////////////////////////////

//## end module.additionalDeclarations
//-- {AddDecl: 142} class [553..746]

template<class TYPE>
TYPE * AllotMem( UINT nSize )
{
	ASSERT(nCount == 0 ||
		AfxIsValidAddress(pElements, nSize * sizeof(TYPE)));
	
	// first do bit-wise zero initialization
	memset((void*)pElements, 0, nCount * sizeof(TYPE));
	
	// then call the constructor(s)
	for (; nCount--; pElements++)
		::new((void*)pElements) TYPE;
	
}

class CMemManageBase :public Singleton< CMemManageBase >
{
//-- {AddDecl: 143} region.generated [578..744]
public:
	CMemManageBase();
	virtual ~CMemManageBase();
public:
	void * AllotMem(UINT nSize);
	CPtrArray m_MemBlackPtr;
	UINT m_SpareSize;
	char * m_pCurren;
protected:
	void Init();
	void Clear();
};
//-- {StartSubRegion: 146} module.endif [747..883]

#endif // !defined(AFX_MEMMANAGEBASE_H__5C942CE4_F8B7_420C_A1F8_DDF21A261BDE__INCLUDED_)




















 

⌨️ 快捷键说明

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