From bf881f54682cd229b1ef47c9500b55733e69e224 Mon Sep 17 00:00:00 2001 From: Andrej Babic Date: Mon, 20 Apr 2020 10:02:05 +0200 Subject: [PATCH] Add EXTENSION parameter for filename --- core-buffer/include/BufferUtils.hpp | 1 + core-buffer/src/BufferUtils.cpp | 3 ++- core-buffer/test/test_buffer_utils.cpp | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core-buffer/include/BufferUtils.hpp b/core-buffer/include/BufferUtils.hpp index d1e07eb..10f022d 100644 --- a/core-buffer/include/BufferUtils.hpp +++ b/core-buffer/include/BufferUtils.hpp @@ -7,6 +7,7 @@ namespace BufferUtils { extern const size_t FILE_MOD; extern const size_t FOLDER_MOD; + extern const std::string FILE_EXTENSION; std::string get_filename( std::string root_folder, diff --git a/core-buffer/src/BufferUtils.cpp b/core-buffer/src/BufferUtils.cpp index a37491f..5647e32 100644 --- a/core-buffer/src/BufferUtils.cpp +++ b/core-buffer/src/BufferUtils.cpp @@ -7,6 +7,7 @@ using namespace std; const size_t BufferUtils::FILE_MOD = 1000; // Must be power of 10 and >= than FILE_MOD. const size_t BufferUtils::FOLDER_MOD = 100000; +const std::string BufferUtils::FILE_EXTENSION = ".h5"; string BufferUtils::get_filename( std::string root_folder, @@ -23,7 +24,7 @@ string BufferUtils::get_filename( folder << root_folder << "/"; folder << device_name << "/"; folder << folder_base << "/"; - folder << file_base << ".bin"; + folder << file_base << FILE_EXTENSION; return folder.str(); } diff --git a/core-buffer/test/test_buffer_utils.cpp b/core-buffer/test/test_buffer_utils.cpp index 95a785e..53182a4 100644 --- a/core-buffer/test/test_buffer_utils.cpp +++ b/core-buffer/test/test_buffer_utils.cpp @@ -5,7 +5,8 @@ using namespace std; TEST(BufferUtils, get_filename) { - auto expected_file = "/root/device-1/12300000/12345000.bin"; + auto expected_file = "/root/device-1/12300000/12345000" + + BufferUtils::FILE_EXTENSION; auto root_folder = "/root"; auto device_name = "device-1";