Add get path suffixes method to BufferUtils

This commit is contained in:
2020-04-21 20:12:34 +02:00
parent 4c0dde41e5
commit 8be4c4db3f
2 changed files with 42 additions and 0 deletions
+31
View File
@@ -64,3 +64,34 @@ string BufferUtils::get_latest_file(const string& latest_filename)
return filename.substr(0, filename.size()-1);
}
vector<BufferUtils::path_sufix> BufferUtils::get_path_suffixes (
const uint64_t start_pulse_id,
const uint64_t stop_pulse_id)
{
vector<BufferUtils::path_sufix> result;
uint64_t start_file_base = start_pulse_id / FILE_MOD;
start_file_base *= FILE_MOD;
for (
uint64_t first_pulse_id=start_file_base;
first_pulse_id <= stop_pulse_id;
first_pulse_id += FILE_MOD) {
uint64_t folder_base = first_pulse_id / FOLDER_MOD;
folder_base *= FOLDER_MOD;
uint64_t file_base = first_pulse_id / FILE_MOD;
file_base *= FILE_MOD;
stringstream folder;
folder << folder_base << "/";
folder << file_base << FILE_EXTENSION;
result.emplace_back<BufferUtils::path_sufix>(
{first_pulse_id,
first_pulse_id+FILE_MOD+1,
folder.str()});
}
}