-/* Copyright (c) 2012-2019. The SimGrid Team.
+/* Copyright (c) 2012-2020. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
}
/** @brief Prints a answer_t, for debugging purposes */
-void answer_print(answer_t answer)
+void answer_print(const_answer_t answer)
{
unsigned int cpt;
node_contact_t contact;
* @param destination the destination in which the nodes will be put
* @param source the source of the nodes to add
*/
-unsigned int answer_merge(answer_t destination, answer_t source)
+unsigned int answer_merge(answer_t destination, const_answer_t source)
{
node_contact_t contact;
node_contact_t contact_copy;
/** Helper to sort answer_t objects */
static int _answer_sort_function(const void *e1, const void *e2)
{
- node_contact_t c1 = *(const node_contact_t*)e1;
- node_contact_t c2 = *(const node_contact_t*)e2;
+ const s_node_contact_t* c1 = *(const node_contact_t*)e1;
+ const s_node_contact_t* c2 = *(const node_contact_t*)e2;
if (c1->distance == c2->distance)
return 0;
else
* @param answer the answer to sort
* @param destination_id the id of the guy we are trying to find
*/
-void answer_sort(answer_t answer)
+void answer_sort(const_answer_t answer)
{
xbt_dynar_sort(answer->nodes, &_answer_sort_function);
}
* @param answer the answer object we're going to put the data in
* @param destination_id the id of the guy we are trying to find.
*/
-void answer_add_bucket(bucket_t bucket, answer_t answer)
+void answer_add_bucket(const_bucket_t bucket, answer_t answer)
{
xbt_assert((bucket != NULL), "Provided a NULL bucket");
xbt_assert((bucket->nodes != NULL), "Provided a bucket which nodes are NULL");
/** @brief Returns if the id supplied is in the answer.
* @param id : id we're looking for
*/
-unsigned int answer_contains(answer_t answer, unsigned int id)
+unsigned int answer_contains(const_answer_t answer, unsigned int id)
{
unsigned int i = 0;
node_contact_t contact;
* @param answer the answer
* @return if the destination is found.
*/
-unsigned int answer_destination_found(answer_t answer)
+unsigned int answer_destination_found(const_answer_t answer)
{
if (xbt_dynar_is_empty(answer->nodes)) {
return 0;
}
- node_contact_t contact_tail = xbt_dynar_get_as(answer->nodes, 0, node_contact_t);
+ const s_node_contact_t* contact_tail = xbt_dynar_get_as(answer->nodes, 0, node_contact_t);
return contact_tail->distance == 0;
}