mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-05-10 08:42:02 +02:00
Add EXTENSION parameter for filename
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user