-/* Copyright (c) 2012-2020. The SimGrid Team.
+/* Copyright (c) 2012-2021. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
namespace kademlia {
-/** @brief Prints a answer_t, for debugging purposes */
-void Answer::print()
+/** @brief Prints an Answer, for debugging purposes */
+void Answer::print() const
{
XBT_INFO("Searching %08x, size %zu", destination_id_, nodes_.size());
unsigned int i = 0;
return not nodes_.empty() && nodes_.begin()->second == 0;
}
-/** @brief Adds the content of a bucket unsigned into a answer object.
- * @param bucket the bucket we have to had unsigned into
- */
+/** @brief Adds the content of a bucket unsigned into an answer object.
+ * @param bucket the bucket we have to had unsigned into
+ */
void Answer::addBucket(const Bucket* bucket)
{
xbt_assert((bucket != nullptr), "Provided a NULL bucket");
- for (auto const& id : bucket->nodes) {
+ for (auto const& id : bucket->nodes_) {
unsigned int distance = id ^ destination_id_;
- nodes_.push_back(std::pair<unsigned int, unsigned int>(id, distance));
+ nodes_.emplace_back(id, distance);
}
}
-}
+} // namespace kademlia