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

📄 allocationdoc.h

📁 操作系统内存管理模拟
💻 H
字号:
// AllocationDoc.h : interface of the CAllocationDoc class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_ALLOCATIONDOC_H__332F84BC_68AB_4B0E_A635_152EE5C39560__INCLUDED_)
#define AFX_ALLOCATIONDOC_H__332F84BC_68AB_4B0E_A635_152EE5C39560__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

typedef struct MYWORD {
	union {
		MYWORD *prelink;//指向该节点的前驱节点
		MYWORD *uplink;//指向某空闲块的首节点
	};
	int size;//表示空闲块的大小
	int tag;//标明该块是空闲还是已经分配
	MYWORD *nextlink;//指向该节点的后继节点
}MYWORD,*Space;

class CAllocationDoc : public CDocument
{
protected: // create from serialization only
	CAllocationDoc();
	DECLARE_DYNCREATE(CAllocationDoc)

// Attributes
public:
	int joblist[100];//存储作业代号
	Space jobarray[100];//存储所在内存位置的结构
	int jobsize[100];//存储作业大小
	int jobcount;//存储当前在内存中的作业数
	CString information[10];

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAllocationDoc)
	public:
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);
	//}}AFX_VIRTUAL

// Implementation
public:
	int getJoblist(int i);//得到作业代号
	Space getJobarray(int i);//得到所在内存位置的结构
	int getJobcount();//得到当前在内存中的作业数
	int getJobsize(int i);//得到作业大小
	void Setsquare(int i,int j,COLORREF color);//设置图形中某一格的颜色
	COLORREF GetSquare(int i,int j);
	COLORREF GetCurrentColor();
	Space Initialize(int size);
	Space Pnode();//得到当前空闲链表中指针所指的内存地址
	Space Startnode();//得到起始内存地址
	Space Node();
	Space Allocation(Space p,int n,int jobnumber);//分配内存空间
	Space Foot(Space p);//指向某空闲块的底部
	void Free(int jobnumber);//释放内存空间
	virtual ~CAllocationDoc();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	COLORREF m_clrCurrentColor;
	COLORREF m_clrGrid[8][8];//对应图中的64个小格
	Space p;
	Space q;
	Space pnode;
	//{{AFX_MSG(CAllocationDoc)
		// NOTE - the ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_ALLOCATIONDOC_H__332F84BC_68AB_4B0E_A635_152EE5C39560__INCLUDED_)

⌨️ 快捷键说明

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