Skip to content

Commit

Permalink
[orchagent]: Update some functions to use const reference parameters (s…
Browse files Browse the repository at this point in the history
  • Loading branch information
Shuotian Cheng authored Jun 6, 2017
1 parent b893b4f commit d246efe
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions orchagent/intfsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ IntfsOrch::IntfsOrch(DBConnector *db, string tableName) :
SWSS_LOG_ENTER();
}

sai_object_id_t IntfsOrch::getRouterIntfsId(string alias)
sai_object_id_t IntfsOrch::getRouterIntfsId(const string &alias)
{
Port port;
gPortsOrch->getPort(alias, port);
assert(port.m_rif_id);
return port.m_rif_id;
}

void IntfsOrch::increaseRouterIntfsRefCount(const string alias)
void IntfsOrch::increaseRouterIntfsRefCount(const string &alias)
{
SWSS_LOG_ENTER();

Expand All @@ -40,7 +40,7 @@ void IntfsOrch::increaseRouterIntfsRefCount(const string alias)
alias.c_str(), m_syncdIntfses[alias].ref_count);
}

void IntfsOrch::decreaseRouterIntfsRefCount(const string alias)
void IntfsOrch::decreaseRouterIntfsRefCount(const string &alias)
{
SWSS_LOG_ENTER();

Expand Down
8 changes: 4 additions & 4 deletions orchagent/intfsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ class IntfsOrch : public Orch
public:
IntfsOrch(DBConnector *db, string tableName);

sai_object_id_t getRouterIntfsId(string);
sai_object_id_t getRouterIntfsId(const string&);

void increaseRouterIntfsRefCount(const string);
void decreaseRouterIntfsRefCount(const string);
void increaseRouterIntfsRefCount(const string&);
void decreaseRouterIntfsRefCount(const string&);
private:
IntfsTable m_syncdIntfses;
void doTask(Consumer &consumer);

int getRouterIntfsRefCount(string);
int getRouterIntfsRefCount(const string&);

bool addRouterIntfs(Port &port);
bool removeRouterIntfs(Port &port);
Expand Down
12 changes: 6 additions & 6 deletions orchagent/neighorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,38 +74,38 @@ bool NeighOrch::removeNextHop(IpAddress ipAddress, string alias)
return true;
}

sai_object_id_t NeighOrch::getNextHopId(IpAddress ipAddress)
sai_object_id_t NeighOrch::getNextHopId(const IpAddress &ipAddress)
{
assert(hasNextHop(ipAddress));
return m_syncdNextHops[ipAddress].next_hop_id;
}

int NeighOrch::getNextHopRefCount(IpAddress ipAddress)
int NeighOrch::getNextHopRefCount(const IpAddress &ipAddress)
{
assert(hasNextHop(ipAddress));
return m_syncdNextHops[ipAddress].ref_count;
}

void NeighOrch::increaseNextHopRefCount(IpAddress ipAddress)
void NeighOrch::increaseNextHopRefCount(const IpAddress &ipAddress)
{
assert(hasNextHop(ipAddress));
m_syncdNextHops[ipAddress].ref_count ++;
}

void NeighOrch::decreaseNextHopRefCount(IpAddress ipAddress)
void NeighOrch::decreaseNextHopRefCount(const IpAddress &ipAddress)
{
assert(hasNextHop(ipAddress));
m_syncdNextHops[ipAddress].ref_count --;
}

bool NeighOrch::getNeighborEntry(const IpAddress& ipAddress, NeighborEntry& neighborEntry, MacAddress& macAddress)
bool NeighOrch::getNeighborEntry(const IpAddress &ipAddress, NeighborEntry &neighborEntry, MacAddress &macAddress)
{
if (!hasNextHop(ipAddress))
{
return false;
}

for (const auto& entry : m_syncdNeighbors)
for (const auto &entry : m_syncdNeighbors)
{
if (entry.first.ip_address == ipAddress)
{
Expand Down
8 changes: 4 additions & 4 deletions orchagent/neighorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ class NeighOrch : public Orch, public Subject

bool hasNextHop(IpAddress);

sai_object_id_t getNextHopId(IpAddress);
int getNextHopRefCount(IpAddress);
sai_object_id_t getNextHopId(const IpAddress&);
int getNextHopRefCount(const IpAddress&);

void increaseNextHopRefCount(IpAddress);
void decreaseNextHopRefCount(IpAddress);
void increaseNextHopRefCount(const IpAddress&);
void decreaseNextHopRefCount(const IpAddress&);

bool getNeighborEntry(const IpAddress&, NeighborEntry&, MacAddress&);

Expand Down

0 comments on commit d246efe

Please sign in to comment.