[Lemon-commits] [lemon_svn] alpar: r2156 - in hugo/trunk: gui lemon lemon/concept

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:50:35 CET 2006


Author: alpar
Date: Thu Aug 18 15:33:49 2005
New Revision: 2156

Modified:
   hugo/trunk/gui/all_include.h
   hugo/trunk/gui/graph_displayer_canvas-edge.cc
   hugo/trunk/gui/graph_displayer_canvas-event.cc
   hugo/trunk/gui/graph_displayer_canvas-node.cc
   hugo/trunk/gui/graph_displayer_canvas.h
   hugo/trunk/gui/map_win.cc
   hugo/trunk/gui/mapstorage.cc
   hugo/trunk/lemon/concept/graph.h
   hugo/trunk/lemon/concept/path.h
   hugo/trunk/lemon/concept/undir_graph.h
   hugo/trunk/lemon/full_graph.h

Log:
- The number of gcc-4.0 warnings has significantly decreases.
- Some code clean-up in gui 

Modified: hugo/trunk/gui/all_include.h
==============================================================================
--- hugo/trunk/gui/all_include.h	(original)
+++ hugo/trunk/gui/all_include.h	Thu Aug 18 15:33:49 2005
@@ -40,6 +40,7 @@
 typedef ListGraph Graph;
 typedef Graph::NodeMap<Coordinates> CoordinatesMap;
 typedef Graph::Node Node;
+typedef Graph::Edge Edge;
 typedef Graph::EdgeIt EdgeIt;
 typedef Graph::NodeIt NodeIt;
 

Modified: hugo/trunk/gui/graph_displayer_canvas-edge.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas-edge.cc	(original)
+++ hugo/trunk/gui/graph_displayer_canvas-edge.cc	Thu Aug 18 15:33:49 2005
@@ -3,7 +3,7 @@
 #include <cmath>
 
 
-int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Graph::Edge edge)
+int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Edge edge)
 {
   Graph::EdgeMap<double> * actual_map;
   double min, max;
@@ -49,7 +49,7 @@
   return 0;
 };
 
-int GraphDisplayerCanvas::changeEdgeColor (std::string mapname, Graph::Edge edge)
+int GraphDisplayerCanvas::changeEdgeColor (std::string mapname, Edge edge)
 {  
 
   //function maps the range of the maximum and
@@ -116,7 +116,7 @@
   return 0;
 };
 
-int GraphDisplayerCanvas::changeEdgeText (std::string mapname, Graph::Edge edge)
+int GraphDisplayerCanvas::changeEdgeText (std::string mapname, Edge edge)
 {
   //the number in the map will be written on the edge
   //EXCEPT when the name of the map is Default, because

Modified: hugo/trunk/gui/graph_displayer_canvas-event.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas-event.cc	(original)
+++ hugo/trunk/gui/graph_displayer_canvas-event.cc	Thu Aug 18 15:33:49 2005
@@ -225,7 +225,7 @@
 
       isbutton=1;
 
-      active_node=NodeIt(mapstorage.graph,mapstorage.graph.addNode());
+      active_node=mapstorage.graph.addNode();
 
       //initiating values corresponding to new node in maps
 
@@ -339,7 +339,7 @@
 	    {
 	      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
 	      target_item=(get_item_at(clicked_x, clicked_y));
-	      Graph::NodeIt target_node=INVALID;
+	      Node target_node=INVALID;
 	      for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
 		{
 		  if(nodesmap[i]==target_item)
@@ -354,14 +354,17 @@
 		    {
           mapstorage.modified = true;
 
-		      *(nodesmap[target_node]) << Gnome::Canvas::Properties::fill_color("red");
+		      *(nodesmap[target_node]) <<
+			Gnome::Canvas::Properties::fill_color("red");
 
 		      //creating new edge
-		      active_edge=EdgeIt(mapstorage.graph,mapstorage.graph.addEdge(active_node, target_node));
+		      active_edge=mapstorage.graph.addEdge(active_node,
+							   target_node);
 
 		      //initiating values corresponding to new edge in maps
 		      mapstorage.initMapsForEdge(active_edge);
-                      (*mapstorage.edgemap_storage["id"])[active_edge] = mapstorage.graph.id(active_edge);
+                      (*mapstorage.edgemap_storage["id"])[active_edge] = 
+			mapstorage.graph.id(active_edge);
 	  
 		      //calculating coordinates of new edge
 		      Gnome::Canvas::Points coos;
@@ -555,7 +558,7 @@
 	  //If the click happened on an edge we place the entrywidget there and fill in the value of the activated map at that edge.
 	  {
 	    //for determine, whether it was an edge
-	    Graph::EdgeIt clicked_edge=INVALID;
+	    Edge clicked_edge=INVALID;
 
 	    //find the activated item between texts
 	    active_item=(get_item_at(e->button.x, e->button.y));
@@ -677,7 +680,7 @@
 	  //If the click happened on an edge we place the entrywidget there and fill in the value of the activated map at that edge.
 	  {
 	    //for determine, whether it was a node
-	    Graph::NodeIt clicked_node=INVALID;
+	    Node clicked_node=INVALID;
 
 	    //find the activated item between texts
 	    active_item=(get_item_at(e->button.x, e->button.y));
@@ -849,21 +852,14 @@
   return false;
 }
 
-void GraphDisplayerCanvas::deleteItem(NodeIt node_to_delete)
+void GraphDisplayerCanvas::deleteItem(Node node_to_delete)
 {
   delete(nodetextmap[node_to_delete]);
   delete(nodesmap[node_to_delete]);
   mapstorage.graph.erase(node_to_delete);
 }
 
-void GraphDisplayerCanvas::deleteItem(EdgeIt edge_to_delete)
-{
-  delete(edgetextmap[edge_to_delete]);
-  delete(edgesmap[edge_to_delete]);
-  mapstorage.graph.erase(edge_to_delete);
-}
-
-void GraphDisplayerCanvas::deleteItem(Graph::Edge edge_to_delete)
+void GraphDisplayerCanvas::deleteItem(Edge edge_to_delete)
 {
   delete(edgetextmap[edge_to_delete]);
   delete(edgesmap[edge_to_delete]);

Modified: hugo/trunk/gui/graph_displayer_canvas-node.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas-node.cc	(original)
+++ hugo/trunk/gui/graph_displayer_canvas-node.cc	Thu Aug 18 15:33:49 2005
@@ -3,7 +3,7 @@
 #include <cmath>
 
 
-int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Graph::Node node)
+int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Node node)
 {
   Graph::NodeMap<double> * actual_map;
   double min, max;
@@ -69,7 +69,7 @@
   return 0;
 };
 
-int GraphDisplayerCanvas::changeNodeColor (std::string mapname, Graph::Node node)
+int GraphDisplayerCanvas::changeNodeColor (std::string mapname, Node node)
 {  
 
   //function maps the range of the maximum and
@@ -141,7 +141,7 @@
   return 0;
 };
 
-int GraphDisplayerCanvas::changeNodeText (std::string mapname, Graph::Node node)
+int GraphDisplayerCanvas::changeNodeText (std::string mapname, Node node)
 {
 
   //the number in the map will be written on the node

Modified: hugo/trunk/gui/graph_displayer_canvas.h
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas.h	(original)
+++ hugo/trunk/gui/graph_displayer_canvas.h	Thu Aug 18 15:33:49 2005
@@ -23,27 +23,27 @@
 
   ///Changes the linewidth attribute according to the given map.
   ///\param mapname is the name of the map which contains the new values
-  int changeEdgeWidth (std::string mapname, Graph::Edge new_item=INVALID);
+  int changeEdgeWidth (std::string mapname, Edge new_item=INVALID);
 
   ///Changes the linecolor attribute according to the given map.
   ///\param mapname is the name of the map which contains the new values
-  int changeEdgeColor (std::string mapname, Graph::Edge new_item=INVALID);
+  int changeEdgeColor (std::string mapname, Edge new_item=INVALID);
 
   ///Changes the text of line attribute according to the given map.
   ///\param mapname is the name of the map which contains the new values
-  int changeEdgeText (std::string mapname, Graph::Edge new_item=INVALID);
+  int changeEdgeText (std::string mapname, Edge new_item=INVALID);
 
   ///Changes the linewidth attribute according to the given map.
   ///\param mapname is the name of the map which contains the new values
-  int changeNodeRadius (std::string mapname, Graph::Node new_item=INVALID);
+  int changeNodeRadius (std::string mapname, Node new_item=INVALID);
 
   ///Changes the linecolor attribute according to the given map.
   ///\param mapname is the name of the map which contains the new values
-  int changeNodeColor (std::string mapname, Graph::Node new_item=INVALID);
+  int changeNodeColor (std::string mapname, Node new_item=INVALID);
 
   ///Changes the text of line attribute according to the given map.
   ///\param mapname is the name of the map which contains the new values
-  int changeNodeText (std::string mapname, Graph::Node new_item=INVALID);
+  int changeNodeText (std::string mapname, Node new_item=INVALID);
 
   ///Callback for 'ViewZoomIn' action.
   virtual void zoomIn();
@@ -119,11 +119,9 @@
 
 private:
   ///Deletes the given element.
-  void deleteItem(NodeIt);
+  void deleteItem(Node);
   ///Deletes the given element.
-  void deleteItem(EdgeIt);
-  ///Deletes the given element.
-  void deleteItem(Graph::Edge);
+  void deleteItem(Edge);
 
 private:
 
@@ -166,9 +164,9 @@
   ///1. we cannot query the item at he cursor as fast as it could not cause a Segmentation Fault
   ///2. we would like to handle only ony item per movement, therefore quering it is not a working solution
   Gnome::Canvas::Item * active_item, * target_item;
-  Graph::NodeIt active_node;
-  Graph::EdgeIt active_edge;
-  Graph::EdgeIt forming_edge;
+  Node active_node;
+  Edge active_edge;
+  Edge forming_edge;
 
   std::string nodemap_to_edit, edgemap_to_edit;
 

Modified: hugo/trunk/gui/map_win.cc
==============================================================================
--- hugo/trunk/gui/map_win.cc	(original)
+++ hugo/trunk/gui/map_win.cc	Thu Aug 18 15:33:49 2005
@@ -217,7 +217,7 @@
   }
 };
 
-void MapWin::updateNode(Graph::Node node)
+void MapWin::updateNode(Node node)
 {
   for(int i=0;i<NODE_PROPERTY_NUM;i++)
     {
@@ -250,7 +250,7 @@
     }
 }
 
-void MapWin::updateEdge(Graph::Edge edge)
+void MapWin::updateEdge(Edge edge)
 {
   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
     {

Modified: hugo/trunk/gui/mapstorage.cc
==============================================================================
--- hugo/trunk/gui/mapstorage.cc	(original)
+++ hugo/trunk/gui/mapstorage.cc	Thu Aug 18 15:33:49 2005
@@ -116,7 +116,7 @@
   return min;
 }
 
-void MapStorage::initMapsForEdge(Graph::Edge e)
+void MapStorage::initMapsForEdge(Edge e)
 {
   std::map< std::string,Graph::EdgeMap<double> * >::iterator ems_it;
   for(ems_it=edgemap_storage.begin();ems_it!=edgemap_storage.end();ems_it++)

Modified: hugo/trunk/lemon/concept/graph.h
==============================================================================
--- hugo/trunk/lemon/concept/graph.h	(original)
+++ hugo/trunk/lemon/concept/graph.h	Thu Aug 18 15:33:49 2005
@@ -404,7 +404,7 @@
     
         /// This constructor sets the iterator to the first edge of \c g.
         ///@param g the graph
-        EdgeIt(const StaticGraph& g) { }
+        EdgeIt(const StaticGraph& g) { ignore_unused_variable_warning(g); }
         /// Edge -> EdgeIt conversion
 
         /// Sets the iterator to the value of the trivial iterator \c e.

Modified: hugo/trunk/lemon/concept/path.h
==============================================================================
--- hugo/trunk/lemon/concept/path.h	(original)
+++ hugo/trunk/lemon/concept/path.h	Thu Aug 18 15:33:49 2005
@@ -24,6 +24,7 @@
 #define LEMON_CONCEPT_PATH_H
 
 #include <lemon/invalid.h>
+#include <lemon/concept_check.h>
 
 namespace lemon {
   namespace concept {
@@ -54,7 +55,9 @@
 
       /// \param _g The graph in which the path is.
       ///
-      Path(const Graph &_g) {}
+      Path(const Graph &_g) {
+	ignore_unused_variable_warning(_g);
+      }
 
       /// Length of the path.
       int length() const {return 0;}

Modified: hugo/trunk/lemon/concept/undir_graph.h
==============================================================================
--- hugo/trunk/lemon/concept/undir_graph.h	(original)
+++ hugo/trunk/lemon/concept/undir_graph.h	Thu Aug 18 15:33:49 2005
@@ -557,7 +557,7 @@
     
         /// This constructor sets the iterator to the first edge of \c g.
         ///@param g the graph
-        EdgeIt(const UndirGraph &g) { }
+        EdgeIt(const UndirGraph &g) { ignore_unused_variable_warning(g); }
         /// Edge -> EdgeIt conversion
 
         /// Sets the iterator to the value of the trivial iterator \c e.
@@ -605,7 +605,10 @@
         /// the node.
         ///@param n the node
         ///@param g the graph
-        OutEdgeIt(const UndirGraph& n, const Node& g) { }
+        OutEdgeIt(const UndirGraph& n, const Node& g) {
+	  ignore_unused_variable_warning(n);
+	  ignore_unused_variable_warning(g);
+	}
         /// Edge -> OutEdgeIt conversion
 
         /// Sets the iterator to the value of the trivial iterator.
@@ -654,7 +657,10 @@
         /// the node.
         ///@param n the node
         ///@param g the graph
-        InEdgeIt(const UndirGraph& g, const Node& n) { }
+        InEdgeIt(const UndirGraph& g, const Node& n) { 
+	  ignore_unused_variable_warning(n);
+	  ignore_unused_variable_warning(g);
+	}
         /// Edge -> InEdgeIt conversion
 
         /// Sets the iterator to the value of the trivial iterator \c e.

Modified: hugo/trunk/lemon/full_graph.h
==============================================================================
--- hugo/trunk/lemon/full_graph.h	(original)
+++ hugo/trunk/lemon/full_graph.h	Thu Aug 18 15:33:49 2005
@@ -125,10 +125,10 @@
 
     protected:
       int id;
-      Node(int _id) { id = _id;}
+      Node(int _id) : id(_id) {}
     public:
       Node() {}
-      Node (Invalid) { id = -1; }
+      Node (Invalid) : id(-1) {}
       bool operator==(const Node node) const {return id == node.id;}
       bool operator!=(const Node node) const {return id != node.id;}
       bool operator<(const Node node) const {return id < node.id;}
@@ -260,12 +260,12 @@
 
     Node source(Edge e) const { 
       /// \todo we may do it faster
-      return ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2; 
+      return Node(((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2);
     }
 
     Node target(Edge e) const { 
       int source = ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2;;
-      return e.id - (source) * (source - 1) / 2; 
+      return Node(e.id - (source) * (source - 1) / 2);
     }
 
 



More information about the Lemon-commits mailing list