X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/84402e8e2ee2a2d0bef25fdceb0a263ed8b471f6..afc75f7692eff7f345826abe82d1e23ac1c18763:/examples/s4u/dht-kademlia/answer.hpp diff --git a/examples/s4u/dht-kademlia/answer.hpp b/examples/s4u/dht-kademlia/answer.hpp index 7920e55247..34896d679a 100644 --- a/examples/s4u/dht-kademlia/answer.hpp +++ b/examples/s4u/dht-kademlia/answer.hpp @@ -12,23 +12,21 @@ #include namespace kademlia { -bool sortbydistance(const std::pair& a, const std::pair& b); - /* Node query answer. contains the elements closest to the id given. */ class Answer { unsigned int destination_id_; - unsigned int size_ = 0; + std::vector> nodes_; public: - std::vector> nodes; explicit Answer(unsigned int destination_id) : destination_id_(destination_id) {} virtual ~Answer() = default; unsigned int getDestinationId() const { return destination_id_; } - unsigned int getSize() { return size_; } + size_t getSize() const { return nodes_.size(); } + const std::vector>& getNodes() const { return nodes_; } void print(); unsigned int merge(const Answer* a); void trim(); - bool destinationFound(); + bool destinationFound() const; void addBucket(const kademlia::Bucket* bucket); }; }