From 0117e7b6ee0e52aa25bd6bb60903d442524b0203 Mon Sep 17 00:00:00 2001 From: TimmRuppert Date: Thu, 19 Dec 2024 10:30:21 +0100 Subject: [PATCH] fix TraceFileFactory (#16) Signed-off-by: Timm Ruppert --- include/osi-utilities/tracefile/Reader.h | 2 +- src/tracefile/reader/Reader.cpp | 29 ++++++++++++------------ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/include/osi-utilities/tracefile/Reader.h b/include/osi-utilities/tracefile/Reader.h index 3aca09f..032d064 100644 --- a/include/osi-utilities/tracefile/Reader.h +++ b/include/osi-utilities/tracefile/Reader.h @@ -110,7 +110,7 @@ class TraceFileReader { /** * @brief Factory class for creating trace file readers based on file extensions */ -class TraceFileFactory { +class TraceFileReaderFactory { public: /** * @brief Creates a reader instance based on the file extension diff --git a/src/tracefile/reader/Reader.cpp b/src/tracefile/reader/Reader.cpp index 68bf0af..09b7bb0 100644 --- a/src/tracefile/reader/Reader.cpp +++ b/src/tracefile/reader/Reader.cpp @@ -9,18 +9,19 @@ #include "osi-utilities/tracefile/reader/TXTHTraceFileReader.h" #include "osi-utilities/tracefile/reader/MCAPTraceFileReader.h" -class TraceFileFactory { -public: - static std::unique_ptr createReader(const std::filesystem::path& path) { - if (path.extension().string() == ".osi") { - return std::make_unique(); - } - if (path.extension().string() == ".mcap") { - return std::make_unique(); - } - if (path.extension().string() == ".txth") { - return std::make_unique(); - } - throw std::invalid_argument("Unsupported format: " + path.extension().string()); +namespace osi3 { + +std::unique_ptr TraceFileReaderFactory::createReader(const std::filesystem::path& path) { + if (path.extension().string() == ".osi") { + return std::make_unique(); + } + if (path.extension().string() == ".mcap") { + return std::make_unique(); } -}; \ No newline at end of file + if (path.extension().string() == ".txth") { + return std::make_unique(); + } + throw std::invalid_argument("Unsupported format: " + path.extension().string()); +} + +} \ No newline at end of file