I NEED THE FUNCTIONS IN THE CODE BELOW TO BE WORKING FOR THE PROGRAM. IT WILL RE
ID: 3539728 • Letter: I
Question
I NEED THE FUNCTIONS IN THE CODE BELOW TO BE WORKING FOR THE PROGRAM. IT WILL READ FROM A FILE
Develop a software application that will simulate the functions of a Disk Buffer Cache (DBC) facility.
The user will provide the application with an input file containing a sequence of positive numbers. Each number will represent a simulated disk block access. A number in the file may repeat several places indicating multiple accesses to the same simulated disk block. The application will input one number from the file at a time. It will consider this number to be the simulated disk block currently being accessed.
//Data Structures
struct NodeType;
typdef NodeType * NodePtr;
struct NodeType
{
int block;
NodePtr fHashLink;
NodePtr bHashLink;
NodePtr fUsageLink;
NodePtr bUsageLink;
}
//Implement each linked list as Circular Doubly Linked List with a Dummy Node.
//Class
class CacheList
{
private:
NodePtr head;
public:
CacheList ( );
NodePtr searchHashList (int block);
void enqueHashList ( NodePtr nodep );
NodePtr removeHashList ( NodePtr nodep );
void enqueUsageList ( int block );
void enqueUsageList ( NodePtr nodep );
NodePtr dequeUsageList ( );
NodePtr removeUsageList (NodePtr nodep);
};
CacheList :: CacheList ( )
{
//Create a dummy node and initialize it.
head = new NodeType;
head->block = -9999;
head->fHashLink = head;
head ->bHashLink = head;
head->fUsageLink = head;
head ->bUsageLink = head;
}
//Searchees Hash List for a node with the specified block.
//If found, returns the pointer to the node.
//else returns NULL.
NodePtr CacheList :: searchHashList ( int block )
{
}
//Adds the supplied node to the end of Hash List
void CacheList :: enqueHashList ( NodePtr nodep )
{
}
//Pre-condition: The node is in the list.
//Removes the supplied node from the Hash List
//Also returns back the pointer to the removed node.
NodePtr CacheList :: removeHashList ( NodePtr nodep)
{
}
//Creates a node, adds the supplied block number in the node
//and enLists the node at end of Usage List.
/Initially, this method is called repeatedly to build the Usage List.
//In building the List, this method is passed -1 as the block value.
void CacheList :: enqueUsageList ( int block )
{
}
//EnLists the supplied node to the end of the Usage List.
void CacheList :: enqueUsageList ( NodePtr nodep )
{
}
//precondition: Usage List is not empty
//DeLists the node at the head of the Usage List.
//Returns a pointer to the deListd node.
NodePtr CacheList:: dequeUsageList ( )
{
}
//precondition : The node being removed is in the list.
//Remove the supplied node from the Usage List
//Also returns back the pointer to the removed node.
void CacheList :: removeUsageList ( NodePtr nodep)
{
}
void main ( )
{
//Input simulation parameters.
//Create Hash Lists
//Create an array of CacheList object depending the number of Hash Lists.
//Each CacheList object will represent a Hash List
//Create Usage List.
//Depending upon the number of buffers simulated, create a CacheList object.
//This CacheList object will represent a Usage List.
//Add nodes with initial block value of -1 to this list.
//Read Blocks From File
//Read a block at a time from the file and handle it.
}
Explanation / Answer
send this question to me here
http://www.liveperson.com/expert/muhammad-sumair-saqib/
I'll give you perfect solution in lowest price
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.