aboutsummaryrefslogtreecommitdiffstats
path: root/vdslib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-08-08 18:54:50 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-08-08 19:41:04 +0000
commit9b2f725bf7e92cacf73e1ef9c60e82e20990f9c8 (patch)
tree94d708dfaf869863e17eb9faaae801c58712e5b1 /vdslib
parentb0e64927bc95abe3587262084dd57fbb3ef038e4 (diff)
Add noexcept
Diffstat (limited to 'vdslib')
-rw-r--r--vdslib/src/vespa/vdslib/state/clusterstate.cpp8
-rw-r--r--vdslib/src/vespa/vdslib/state/clusterstate.h14
2 files changed, 11 insertions, 11 deletions
diff --git a/vdslib/src/vespa/vdslib/state/clusterstate.cpp b/vdslib/src/vespa/vdslib/state/clusterstate.cpp
index e9159eef631..6a319af68ef 100644
--- a/vdslib/src/vespa/vdslib/state/clusterstate.cpp
+++ b/vdslib/src/vespa/vdslib/state/clusterstate.cpp
@@ -250,7 +250,7 @@ ClusterState::serialize(vespalib::asciistream & out, bool ignoreNewFeatures) con
}
bool
-ClusterState::operator==(const ClusterState& other) const
+ClusterState::operator==(const ClusterState& other) const noexcept
{
return (_version == other._version &&
*_clusterState == *other._clusterState &&
@@ -260,13 +260,13 @@ ClusterState::operator==(const ClusterState& other) const
}
bool
-ClusterState::operator!=(const ClusterState& other) const
+ClusterState::operator!=(const ClusterState& other) const noexcept
{
return !(*this == other);
}
uint16_t
-ClusterState::getNodeCount(const NodeType& type) const
+ClusterState::getNodeCount(const NodeType& type) const noexcept
{
return _nodeCount[type];
}
@@ -282,7 +282,7 @@ const NodeState&
ClusterState::getNodeState(const Node& node) const
{
// If it actually has an entry in map, return that
- std::map<Node, NodeState>::const_iterator it = _nodeStates.find(node);
+ auto it = _nodeStates.find(node);
if (it != _nodeStates.end()) return it->second;
// If beyond node count, the node is down.
diff --git a/vdslib/src/vespa/vdslib/state/clusterstate.h b/vdslib/src/vespa/vdslib/state/clusterstate.h
index 3af5a45fcac..44af81f52ce 100644
--- a/vdslib/src/vespa/vdslib/state/clusterstate.h
+++ b/vdslib/src/vespa/vdslib/state/clusterstate.h
@@ -45,23 +45,23 @@ public:
std::string getTextualDifference(const ClusterState& other) const;
void serialize(vespalib::asciistream & out, bool ignoreNewFeatures) const;
- bool operator==(const ClusterState& other) const;
- bool operator!=(const ClusterState& other) const;
+ bool operator==(const ClusterState& other) const noexcept;
+ bool operator!=(const ClusterState& other) const noexcept;
uint32_t getVersion() const { return _version; }
/**
* Returns the smallest number above the highest node index found of the
* given type that is not down.
*/
- uint16_t getNodeCount(const NodeType& type) const;
- uint16_t getDistributionBitCount() const { return _distributionBits; }
- const State& getClusterState() const { return *_clusterState; }
+ uint16_t getNodeCount(const NodeType& type) const noexcept;
+ uint16_t getDistributionBitCount() const noexcept { return _distributionBits; }
+ const State& getClusterState() const noexcept { return *_clusterState; }
const NodeState& getNodeState(const Node& node) const;
- void setVersion(uint32_t version) { _version = version; }
+ void setVersion(uint32_t version) noexcept { _version = version; }
void setClusterState(const State& state);
void setNodeState(const Node& node, const NodeState& state);
- void setDistributionBitCount(uint16_t count) { _distributionBits = count; }
+ void setDistributionBitCount(uint16_t count) noexcept { _distributionBits = count; }
void print(std::ostream& out, bool verbose, const std::string& indent) const override;