Skip to content

Commit c398098

Browse files
committed
[hash]: Handle review comments.
Signed-off-by: Nazarii Hnydyn <nazariig@nvidia.com>
1 parent 4b3d4db commit c398098

4 files changed

Lines changed: 19 additions & 9 deletions

File tree

orchagent/switch/switch_capabilities.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
// includes -----------------------------------------------------------------------------------------------------------
22

33
extern "C" {
4+
#include <saitypes.h>
45
#include <saiobject.h>
56
#include <saistatus.h>
6-
#include <saitypes.h>
7+
#include <saihash.h>
78
#include <saiswitch.h>
89
}
910

1011
#include <cstdint>
1112
#include <string>
1213
#include <vector>
1314
#include <set>
15+
#include <unordered_map>
1416
#include <algorithm>
1517

1618
#include <sai_serialize.h>
@@ -81,28 +83,28 @@ extern sai_object_id_t gSwitchId;
8183

8284
// functions ----------------------------------------------------------------------------------------------------------
8385

84-
static std::string toStr(sai_object_type_t objType, sai_attr_id_t attrId) noexcept
86+
static std::string toStr(sai_object_type_t objType, sai_attr_id_t attrId)
8587
{
8688
const auto *meta = sai_metadata_get_attr_metadata(objType, attrId);
8789

8890
return meta != nullptr ? meta->attridname : "UNKNOWN";
8991
}
9092

91-
static std::string toStr(sai_native_hash_field_t value) noexcept
93+
static std::string toStr(sai_native_hash_field_t value)
9294
{
9395
const auto *name = sai_metadata_get_native_hash_field_name(value);
9496

9597
return name != nullptr ? name : "UNKNOWN";
9698
}
9799

98-
static std::string toStr(sai_hash_algorithm_t value) noexcept
100+
static std::string toStr(sai_hash_algorithm_t value)
99101
{
100102
const auto *name = sai_metadata_get_hash_algorithm_name(value);
101103

102104
return name != nullptr ? name : "UNKNOWN";
103105
}
104106

105-
static std::string toStr(const std::set<sai_native_hash_field_t> &value) noexcept
107+
static std::string toStr(const std::set<sai_native_hash_field_t> &value)
106108
{
107109
std::vector<std::string> strList;
108110

@@ -118,7 +120,7 @@ static std::string toStr(const std::set<sai_native_hash_field_t> &value) noexcep
118120
return join(",", strList.cbegin(), strList.cend());
119121
}
120122

121-
static std::string toStr(const std::set<sai_hash_algorithm_t> &value) noexcept
123+
static std::string toStr(const std::set<sai_hash_algorithm_t> &value)
122124
{
123125
std::vector<std::string> strList;
124126

@@ -134,13 +136,13 @@ static std::string toStr(const std::set<sai_hash_algorithm_t> &value) noexcept
134136
return join(",", strList.cbegin(), strList.cend());
135137
}
136138

137-
static std::string toStr(bool value) noexcept
139+
static std::string toStr(bool value)
138140
{
139141
return value ? "true" : "false";
140142
}
141143

142144
template <typename T1, typename T2>
143-
static void insertBack(T1 &out, const T2 &in) noexcept
145+
static void insertBack(T1 &out, const T2 &in)
144146
{
145147
out.insert(out.end(), in.cbegin(), in.cend());
146148
}

orchagent/switch/switch_capabilities.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#pragma once
22

33
extern "C" {
4-
#include <saiobject.h>
54
#include <saitypes.h>
5+
#include <saiobject.h>
66
#include <saihash.h>
7+
#include <saiswitch.h>
78
}
89

910
#include <vector>

orchagent/switch/switch_helper.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
// includes -----------------------------------------------------------------------------------------------------------
22

3+
extern "C" {
4+
#include <saihash.h>
5+
#include <saiswitch.h>
6+
}
7+
38
#include <unordered_map>
49
#include <unordered_set>
510
#include <string>

orchagent/switch/switch_helper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#pragma once
22

3+
#include <string>
4+
35
#include "switch_container.h"
46

57
class SwitchHelper final

0 commit comments

Comments
 (0)