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

📄 cmemory.hpp

📁 bt848,bt878 a采集卡的探测
💻 HPP
字号:
// A Memory block class

#ifndef _CMEMORY_HPP
#define _CMEMORY_HPP

#include <windows.h>

// Be careful, there is no copy on write!! - All owners of references will see the changes!
class CString;

class CMemory {
protected:

	// Our memory atom class
	class CMemoryAtom {
	protected:

		void* block;		// Memory block
		UINT  len;			// Length of block
		UINT  refcount;		// reference count

	public:
		CMemoryAtom(const UINT thelen = 0);
		bool	IsOk()		const { return (block != NULL); }
		bool	ReSize(const UINT Amount);
		UINT	Size()		const { return len; }
		void*	Ptr()		const { return block; }
		UINT	RefCount()	const { return refcount; } 
		void	AddRef()	{ refcount++; }
		bool	Release();
		~CMemoryAtom();
	};

protected:
	
	CMemoryAtom* atom;		// My memory atom

public:

	CMemory(const UINT thelen = 0) : atom(new CMemoryAtom(thelen)) {}
	CMemory(CMemory& blk) : atom(0) { atom = blk.atom; atom->AddRef(); }
	CMemory& operator=(CMemory& blk);

	bool IsOk() const { return atom->IsOk(); }
	bool ReSize(const UINT Amount) { return atom->ReSize(Amount); }
	UINT Size() const { return atom->Size(); }
	void* Ptr() const { return atom->Ptr(); }
	~CMemory();

	// Some useful fns
	friend CMemory LoadBinaryResource(HINSTANCE instance,LPCTSTR res,LPCTSTR type = RT_RCDATA);
	friend CMemory LoadBinaryFile(LPTSTR File);
	friend CMemory LoadBinaryFile(CString& File);

};

#endif

⌨️ 快捷键说明

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