From 4f86dbac5b6aa148eb2b67aca1d87f045d8233b0 Mon Sep 17 00:00:00 2001 From: Roberto Scolaro Date: Wed, 8 Jan 2025 17:18:16 +0000 Subject: [PATCH] chore(libsinsp): substitute class with namespace Signed-off-by: Roberto Scolaro --- .../libsinsp/sinsp_filter_transformers.h | 59 +++++++++---------- 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/userspace/libsinsp/sinsp_filter_transformers.h b/userspace/libsinsp/sinsp_filter_transformers.h index 6485a33fc3..5ce6ca14ce 100644 --- a/userspace/libsinsp/sinsp_filter_transformers.h +++ b/userspace/libsinsp/sinsp_filter_transformers.h @@ -22,36 +22,31 @@ limitations under the License. #include #include -class sinsp_filter_transformer_factory { -public: - sinsp_filter_transformer_factory() = delete; - ~sinsp_filter_transformer_factory() = delete; - sinsp_filter_transformer_factory operator=(const sinsp_filter_transformer_factory&) = delete; - - static std::unique_ptr create_transformer( - filter_transformer_type trtype) { - switch(trtype) { - case FTR_TOUPPER: { - return std::make_unique(); - } - case FTR_TOLOWER: { - return std::make_unique(); - } - case FTR_BASE64: { - return std::make_unique(); - } - case FTR_STORAGE: { - return std::make_unique(); - } - case FTR_BASENAME: { - return std::make_unique(); - } - case FTR_LEN: { - return std::make_unique(); - } - default: - throw sinsp_exception("transformer '" + std::to_string(trtype) + "' is not supported"); - return nullptr; - } +namespace sinsp_filter_transformer_factory { +inline std::unique_ptr create_transformer( + filter_transformer_type trtype) { + switch(trtype) { + case FTR_TOUPPER: { + return std::make_unique(); + } + case FTR_TOLOWER: { + return std::make_unique(); + } + case FTR_BASE64: { + return std::make_unique(); + } + case FTR_STORAGE: { + return std::make_unique(); + } + case FTR_BASENAME: { + return std::make_unique(); + } + case FTR_LEN: { + return std::make_unique(); + } + default: + throw sinsp_exception("transformer '" + std::to_string(trtype) + "' is not supported"); + return nullptr; } -}; +} +}; // namespace sinsp_filter_transformer_factory