Files
sunnypilot/tools/replay/filereader.h
Dean Lee 2156e71e7a move replay from selfdrive/ui/replay to tools/replay (#24971)
* mv to tools/replay

* change folder

* add .gitignore

* fix build doc

* disable warning

* enable warning after build

* build qt/util.cc qt/api.cc to library

* cleanup
old-commit-hash: fd5b3d7603
2022-06-28 16:12:42 +02:00

21 lines
556 B
C++

#pragma once
#include <atomic>
#include <string>
class FileReader {
public:
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) {}
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);
size_t chunk_size_;
int max_retries_;
bool cache_to_local_;
};
std::string cacheFilePath(const std::string &url);