sorting-algorithms/include/sort_controller.hpp

66 lines
2.1 KiB
C++

#ifndef SORT_CONTROLLER_HPP
#define SORT_CONTROLLER_HPP
#include "trees.hpp"
#include <chrono>
#include <fstream>
#include <string>
#include <vector>
enum SortType {INSERTION = 0, MERGE, HEAP, BST, RBT, LAST};
class SortController
{
public:
std::ofstream outputFile;
SortController();
void CheckArguments(int argc, char* arguments[]);
void ReadWordFile(void);
void RunBenchmarks(void);
void SetFilename(std::string name);
std::string GetFilename(void);
void SetOutput(std::string filename);
bool IsOutputSpecified(void);
void TestInsertion(void);
void TestMerge(void);
void TestHeap(void);
void ConstructBST(void);
void ConstructRBT(void);
void BSTInsert(std::string key);
void BSTSearch(std::string key);
void BSTInOrderTreeTraversal(std::string key);
void BSTPrintParentKey(std::string key);
void BSTPrintLeftChild(std::string key);
void BSTPrintRightChild(std::string key);
void BSTPrintPathToRoot(std::string key);
void RBTInsert(std::string key);
void RBTSearch(std::string key);
void RBTInOrderTreeTraversal(std::string key);
void RBTPrintParentKey(std::string key);
void RBTPrintLeftChild(std::string key);
void RBTPrintRightChild(std::string key);
void RBTPrintPathToRoot(std::string key);
void RBTPrintColor(std::string key);
void RBTPrintParentColor(std::string key);
void RBTPrintUncleColor(std::string key);
protected:
;
private:
std::string filename;
SortType currentType;
std::string wordToLocate;
tree_implementation::BinarySearchTree binarySearchTree;
tree_implementation::RedBlackTree redBlackTree;
std::chrono::duration<double> sortTime;
std::vector<std::string> newWordList;
std::vector<std::string> originalWordList;
int lineCount;
bool defaultFile, defaultOnly, fileGiven, allLists, sortGiven, locate;
void Benchmarking(void);
void BenchmarkingAll(void);
void OutputResult(void);
void EchoSortTime(std::string outputFilename);
void WriteOutputToFile(std::string outputFilename);
};
#endif