dllist.h

来自「程序使用的是在nachos体系架构下完成双向链表的构建」· C头文件 代码 · 共 41 行

H
41
字号
#ifndef DLLIST_H#define DLLIST_H#include"copyright.h"#include"utility.h"class DLListElement {   public:     DLListElement(void *itemPtr, int sortKey);	// initialize a list element     DLListElement *next;		// next element on list, 				// NULL if this is the last     DLListElement *prev;       // previous element on list                                // NULL if this is the first     int key;		    	// priority, for a sorted list     void *item; 	    	// pointer to item on the list};class DLList {  public:    DLList();			// initialize the list    ~DLList();			// de-allocate the list    void Prepend(void *item); 	// add to head of list     void Append(void *item); 	// add to tail of list     void *Remove(int *keyPtr); 	// remove from head of list                                // set *keyPtr to key of the removed item                                // return item (or NULL if list is empty)          bool IsEmpty();		// return true if list has no element        // Routines to put/get items on/off list in order (sorted by key)    void SortedInsert(void *item, int sortKey);	    void *SortedRemove(int *keyPtr); 	  // remove first item    void Print();  private:    DLListElement *first;  	// Head of the list, NULL if list is empty    DLListElement *last;	// Last element of list,NULL if empty};#endif

⌨️ 快捷键说明

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