Registration Queueing Reporting System
This is a toy C++ project! Please don’t take it seriously!
How to build and run?
Please build and run this program on Linux or macOS.
If you have to use Windows to compile this program (Hold on, are you sure about this?), please remove the compiler
will prevent you from compiling. Also, please replace all the color codes in
config.h with empty strings since they
display as excepted on Windows.
Navigate to the build directory and run CMake (version >= 3.16) to configure the project and generate a native build
sudo apt install cmake or
brew install cmake to install CMake.
cd build cmake .. cmake --build . ./RQRS
- Beautiful Color Scheme (may not work correctly in Windows)
- STL-style data structure interfaces
- Passing by value boosted with move semantics
- Comparing and hashing of customized objects achieved by specializations of
- Fair IO exception handling design
- Uniform naming convention
- Function headers and detailed documentation.
- Code optimized with modern C++ features
- Memory leaks resolved by using smart pointer.
- … and so on! 🙂
Please enter integers between 0 and 13 to pick the next operation. The prompt below is also shown in the program.
1. Move 12 hours forward. 2. Move a few days forward. 3. Create new registrations. 4. Withdraw a registration. 5. Recover a registration. 6. Update the profession category for a record. 7. Update the risk status for a record. 8. Add a treatment deadline for a record. 9. Print this prompt again. 10. Retrieve a Database record by ID. <- Implemented with B+-tree. 11. Retrieve a Database record by NAME. <- Implemented with B-tree. 12. Remove a Database record by ID. <- Implemented with B+-tree. 13. Remove a Database record by NAME. <- Implemented with B-tree. 0. Exit!
Important IO Information
- All input records will be written into the
xis the Registry ID that you just specified!
- All treatment records will be written into
data/appointment.csv(will be generated if not exists).
- All reports generated (weekly or monthly) will be output to console and written into
data/report.txt(will be generated if not exists) in the sorted order you just specified. Magic?
We assume that there are 5 local registries and 5 appointment locations. This is the default configuration
config.h, but it’s possible to adapt this program to an arbitrary number of local registries and appointment
But to make sure the program works correctly, csv data files must be provided correctly. They must be put in a
data must be in the same directory as executable
m local registries,
csv files containing registration records must be named from
reg_m.csv. They must contain rows in format
|ID||Name||Address||Phone||Profession ID||Date of Birth||Risk Status||Registry ID|
n appointment locations, a
location_preference.csv must be provided with rows in the following format
|Registries ID||Preference #1||Preference #2||……||Preference #n|
Otherwise, the program will not work correctly. (May or may not add error detection functions later.)
To simplify the code, records are compared and hashed only based on their IDs and Names. In other words, two records with the same ID and Name will get the same hash values, and they will be considered equal in searching operations. However, they will be assigned different priorities in the centralized queue as expected.
Project File Structure
project | main.cpp | config.h | fibonacciHeap.h | fibonacciHeap.cpp | centralizedQueue.h | centralizedQueue.cpp | queue.h | queue.cpp | registrationRecord.h | registrationRecord.cpp | eventDriver.h | eventDriver.cpp | recordProcessor.h | recordProcessor.cpp | databaseSchema.h | databaseSchema.cpp | BPlusTree.h | BPlusTree.cpp | BTree.h | BTree.cpp | utilities.h | utilities.cpp | └───build └───data │ reg_1.csv │ reg_2.csv │ reg_3.csv │ reg_4.csv │ reg_5.csv │ location_preferences.csv
If you are having difficulties compiling with CMake, please use the
Before execution, please run
cp -r build/data . to make sure
RQRS executable and the
data folder are under the
outname := RQRS CXX := g++ CXXFLAGS := -Wall -Wextra -Wpedantic -Werror -std=c++17 -g srcfiles := $(shell find . -maxdepth 1 -name "*.cpp") objects := $(patsubst %.cpp, %.o, $(srcfiles)) all: $(outname) $(outname): $(objects) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $(outname) $(objects) $(LDLIBS) depend: .depend .depend: $(srcfiles) rm -f ./.depend $(CXX) $(CXXFLAGS) -MM $^>>./.depend; clean: rm -f $(objects) clear: clean rm -f *~ .depend $(outname) include .depend