-
Notifications
You must be signed in to change notification settings - Fork 13
Code structure
alesbe edited this page May 23, 2022
·
6 revisions
The source code it's easy to understand and lightweight! Here you'll find a summary about how the project is structured, but every .cpp file contains comments and explanations of each functions. All the source code is located in the /src directory.
If you want to add a new sorting algorithm here you can find a wiki page that explains that without needing to understand the whole code base. Let's dive in!
-
main.cpp: Main function containing the main loop. -
SortController.h / SortController.cpp: Class to manage the vector that will be sorted and the methods related to it. -
Sortable.h / Sortable.cpp: Class to create the objects that will compose the vector (managed bySortController). -
SortAlgorithms.h / SortAlgorithms.cpp: Sorting algorithms. -
Utils.h / Utils.cpp: Utility functions.
The visualizer runs in two different threads, one that sorts the visualizer and the main one, that draws the elements on screen, that way the program runs smooth and non-blocking!
The sorting thread is started in detached mode in main.cpp:
sortingThread = std::thread(&SortController::startSort, &sortController, sortType);
🚧 Wiki page not finished, come back later! 🚧