This C++ program demonstrates the implementation of a priority queue and a file access management system using classes. The project includes classes for users, a priority queue, files, a file list, and a hash table.
This project showcases the implementation of a max-heap priority queue that is utilized to manage user access to files in a file access management system. It allows users to be assigned priority keys and grants access to files based on these priorities.
The project provides implementations for various classes that interact to achieve the file access management system:
-
User
class: Represents a user with a priority key, user ID, operation type (read or write), and access status. -
PriorityQueue
class: Implements a max-heap priority queue. Users can be added to the queue based on their priority keys. It provides functions likeAddToQueue
,ExtractMax
,FindMax
,FindMin
,IsEmpty
, andSize
. -
File
class: Represents a file with a file name, file ID, number of accessors, and a priority queue of users with access to the file. -
FileList
class: Manages a list of files and provides functions likePrintFileList
,GrantAccess
,AddFile
, andIsEmpty
. -
HashTable
class: Implements a hash table for efficient storage and retrieval of files. It offers functions likeInsertFile
,PrintHash
, andRequestFileAccess
.
-
User
- Represents a user with a priority key, user ID, operation type, and access status.
- Provides constructors, an overloaded
<<
operator for printing, and aPrintUser
function.
-
PriorityQueue
- Implements a max-heap priority queue for users.
- Provides functions to add users, extract the maximum user, find the maximum and minimum users, check if the queue is empty, and get the size.
-
File
- Represents a file with a file name, file ID, accessors queue, and number of accessors.
- Provides constructors and an overloaded
<<
operator for printing.
-
FileList
- Manages a list of files and provides functions for printing the file list, granting access to files, adding files, and checking if the list is empty.
-
HashTable
- Implements a hash table for file storage and retrieval.
- Provides functions for inserting files, printing the hash table, and requesting file access.
Ensure you have a C++ compiler installed on your system, such as GCC or Visual C++.
-
Clone or download the repository.
-
Open a terminal or command prompt and navigate to the project directory.
-
Compile the code using the appropriate compiler command. For example, using g++:
g++ main.cpp -o file_access_management