You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					21 lines
				
				556 B
			
		
		
			
		
	
	
					21 lines
				
				556 B
			| 
											4 years ago
										 | #pragma once
 | ||
|  | 
 | ||
|  | #include <atomic>
 | ||
|  | #include <string>
 | ||
|  | 
 | ||
|  | class FileReader {
 | ||
|  | public:
 | ||
| 
											4 years ago
										 |   FileReader(bool cache_to_local, size_t chunk_size = 0, int retries = 3)
 | ||
|  |       : cache_to_local_(cache_to_local), chunk_size_(chunk_size), max_retries_(retries) {}
 | ||
| 
											4 years ago
										 |   virtual ~FileReader() {}
 | ||
|  |   std::string read(const std::string &file, std::atomic<bool> *abort = nullptr);
 | ||
|  | 
 | ||
|  | private:
 | ||
|  |   std::string download(const std::string &url, std::atomic<bool> *abort);
 | ||
| 
											4 years ago
										 |   size_t chunk_size_;
 | ||
| 
											4 years ago
										 |   int max_retries_;
 | ||
|  |   bool cache_to_local_;
 | ||
|  | };
 | ||
|  | 
 | ||
|  | std::string cacheFilePath(const std::string &url);
 |