#pragma once #include #include #include class DownloadManager { private: const unsigned max_files = 50; std::vector download_queue = {}; std::vector file_queue = {}; /** * @brief open file in DownloadManager (THREAD-ONLY) * * this function opens a file, but blocks until a slot is available, so * should only be used in threads */ std::fstream* open_file(std::string filename); /** * @brief close file in DownloadManager (THREAD-ONLY) * * this function closes a file and removes it's pointer from the file_queue * vector */ void close_file(std::fstream* file_ptr); public: DownloadManager(); virtual ~DownloadManager(); /** @brief downlaod `url` to `file` and close `file` when done */ virtual std::thread* wget(std::string url, std::string filename); };