From c39809830dd1881733ccc2e94dbc896f4269fea7 Mon Sep 17 00:00:00 2001 From: Nazarii Hnydyn Date: Thu, 2 Nov 2023 19:46:03 +0200 Subject: [PATCH] [hash]: Handle review comments. Signed-off-by: Nazarii Hnydyn --- orchagent/switch/switch_capabilities.cpp | 18 ++++++++++-------- orchagent/switch/switch_capabilities.h | 3 ++- orchagent/switch/switch_helper.cpp | 5 +++++ orchagent/switch/switch_helper.h | 2 ++ 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/orchagent/switch/switch_capabilities.cpp b/orchagent/switch/switch_capabilities.cpp index ed48cdaa8f9..d1f191bf391 100644 --- a/orchagent/switch/switch_capabilities.cpp +++ b/orchagent/switch/switch_capabilities.cpp @@ -1,9 +1,10 @@ // includes ----------------------------------------------------------------------------------------------------------- extern "C" { +#include #include #include -#include +#include #include } @@ -11,6 +12,7 @@ extern "C" { #include #include #include +#include #include #include @@ -81,28 +83,28 @@ extern sai_object_id_t gSwitchId; // functions ---------------------------------------------------------------------------------------------------------- -static std::string toStr(sai_object_type_t objType, sai_attr_id_t attrId) noexcept +static std::string toStr(sai_object_type_t objType, sai_attr_id_t attrId) { const auto *meta = sai_metadata_get_attr_metadata(objType, attrId); return meta != nullptr ? meta->attridname : "UNKNOWN"; } -static std::string toStr(sai_native_hash_field_t value) noexcept +static std::string toStr(sai_native_hash_field_t value) { const auto *name = sai_metadata_get_native_hash_field_name(value); return name != nullptr ? name : "UNKNOWN"; } -static std::string toStr(sai_hash_algorithm_t value) noexcept +static std::string toStr(sai_hash_algorithm_t value) { const auto *name = sai_metadata_get_hash_algorithm_name(value); return name != nullptr ? name : "UNKNOWN"; } -static std::string toStr(const std::set &value) noexcept +static std::string toStr(const std::set &value) { std::vector strList; @@ -118,7 +120,7 @@ static std::string toStr(const std::set &value) noexcep return join(",", strList.cbegin(), strList.cend()); } -static std::string toStr(const std::set &value) noexcept +static std::string toStr(const std::set &value) { std::vector strList; @@ -134,13 +136,13 @@ static std::string toStr(const std::set &value) noexcept return join(",", strList.cbegin(), strList.cend()); } -static std::string toStr(bool value) noexcept +static std::string toStr(bool value) { return value ? "true" : "false"; } template -static void insertBack(T1 &out, const T2 &in) noexcept +static void insertBack(T1 &out, const T2 &in) { out.insert(out.end(), in.cbegin(), in.cend()); } diff --git a/orchagent/switch/switch_capabilities.h b/orchagent/switch/switch_capabilities.h index 84d20eb9a71..9bff1df4979 100644 --- a/orchagent/switch/switch_capabilities.h +++ b/orchagent/switch/switch_capabilities.h @@ -1,9 +1,10 @@ #pragma once extern "C" { -#include #include +#include #include +#include } #include diff --git a/orchagent/switch/switch_helper.cpp b/orchagent/switch/switch_helper.cpp index 295246e55dc..23a7c3fd5a6 100644 --- a/orchagent/switch/switch_helper.cpp +++ b/orchagent/switch/switch_helper.cpp @@ -1,5 +1,10 @@ // includes ----------------------------------------------------------------------------------------------------------- +extern "C" { +#include +#include +} + #include #include #include diff --git a/orchagent/switch/switch_helper.h b/orchagent/switch/switch_helper.h index 97fd453c08a..d7be11981fe 100644 --- a/orchagent/switch/switch_helper.h +++ b/orchagent/switch/switch_helper.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "switch_container.h" class SwitchHelper final