|
|
/home/brennan/n-sim/OrbisQuartus/control/source_node_graph.cppGo to the documentation of this file.00001 00014 /* 00015 * Copyright 2007. Los Alamos National Security, LLC. This material 00016 * was produced under U.S. Government contract DE-AC52-06NA25396 for 00017 * Los Alamos National Laboratory (LANL), which is operated by Los 00018 * Alamos National Security, LLC, for the Department of Energy. The 00019 * U.S. Government has rights to use, reproduce, and distribute this 00020 * software. NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, 00021 * LLC, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL 00022 * LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified to 00023 * produce derivative works, such modified software should be clearly 00024 * marked, so as not to confuse it with the version available from LANL. 00025 * 00026 * Additionally, this program is free software; you can redistribute 00027 * it and/or modify it under the terms of the GNU General Public 00028 * License as published by the Free Software Foundation; version 2 of 00029 * the License. Accordingly, this program is distributed in the hope 00030 * it will be useful, but WITHOUT ANY WARRANTY; without even the 00031 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00032 * PURPOSE. See the GNU General Public License for more details. 00033 */ 00034 00035 00036 #include <avl.h> 00037 #include <configuration.h> 00038 #include <sensor_node.h> 00039 #include <source.h> 00040 #include "source_node_graph.h" 00041 00042 00043 Source_node_graph::Source_node_graph(Configuration *config) 00044 { 00045 AVL_node<unsigned long> *list, *sublist; 00046 Source_type_tree *source_tree = config->get_sources(); 00047 00048 while (source_tree != NULL) { 00049 for (list = source_tree->tree.find_min(); list != 0; 00050 list = list->get_next()) { 00051 Source *source = (Source *)list->elt(); 00052 00053 for (sublist = config->get_nodes()->find_min(); 00054 sublist != 0; sublist = sublist->get_next()) { 00055 Sensor_node *node = 00056 (Sensor_node *)sublist->elt(); 00057 Edge *edge = find_edge(source->key_value(), 00058 node->key_value()); 00059 edge->dist = source->distance(node); 00060 } 00061 } 00062 source_tree = source_tree->next; 00063 } 00064 } |