[Lemon-commits] Alpar Juttner: Update to compile with the latest...

Lemon HG hg at lemon.cs.elte.hu
Fri Oct 10 14:38:34 CEST 2008


details:   http://lemon.cs.elte.hu/hg/glemon/rev/f227a74db59d
changeset: 7:f227a74db59d
user:      Alpar Juttner <alpar [at] cs.elte.hu>
date:      Fri Oct 10 13:36:20 2008 +0100
description:
	Update to compile with the latest LEMON (version 1.0 or
	[5e12d7734036])

diffstat:

3 files changed, 24 insertions(+), 17 deletions(-)
io_helper.cc  |    2 +-
mapstorage.cc |   16 +++++++++++-----
xml.h         |   23 ++++++++++++-----------

diffs (169 lines):

diff -r 3a44a2bb6da8 -r f227a74db59d io_helper.cc
--- a/io_helper.cc	Wed Aug 13 17:24:25 2008 +0100
+++ b/io_helper.cc	Fri Oct 10 13:36:20 2008 +0100
@@ -27,7 +27,7 @@
       }
       else
       {
-        throw DataFormatError("Bad format");
+        throw FormatError("Bad format");
       }
     }
   }
diff -r 3a44a2bb6da8 -r f227a74db59d mapstorage.cc
--- a/mapstorage.cc	Wed Aug 13 17:24:25 2008 +0100
+++ b/mapstorage.cc	Fri Oct 10 13:36:20 2008 +0100
@@ -722,7 +722,7 @@
 
   // write .lgf file
   {
-    DigraphWriter<Digraph> gwriter(filename, digraph);
+    DigraphWriter<Digraph> gwriter(digraph, filename);
 
     gwriter.nodeMap("label", node_label);
     gwriter.arcMap("label", arc_label);
@@ -826,7 +826,7 @@
   // write .conf file
   if (gui_sect_save_dest == CONF_FILE)
   {
-    DigraphWriter<Digraph> lwriter(filename + ".conf", digraph);
+    DigraphWriter<Digraph> lwriter(digraph, filename + ".conf");
     GuiWriter gui_writer(this);
     gui_writer.write(lwriter.ostream());
     lwriter.run();
@@ -1337,7 +1337,7 @@
   using std::map;
   using std::string;
 
-  DigraphReader<Digraph> greader(filename, digraph);
+  DigraphReader<Digraph> greader(digraph, filename);
 
   // read the label maps
   greader.nodeMap("label", node_label);
@@ -1460,7 +1460,10 @@
     {
       if(active_nodemaps[N_RADIUS]!="")
 	{
-	  _nodeSizes=getNumericNodeMap(active_nodemaps[N_RADIUS]);
+	  const  Digraph::NodeMap<double> &temp = 
+	    getNumericNodeMap(active_nodemaps[N_RADIUS]);
+	  for(NodeIt n(digraph);n!=INVALID;++n)
+	    _nodeSizes[n]= temp[n];
 	}
       if(active_nodemaps[N_COLOR]!="")
 	{
@@ -1483,7 +1486,10 @@
     {
       if(active_arcmaps[E_WIDTH]!="")
 	{
-	  _arcWidths=getNumericArcMap(active_arcmaps[E_WIDTH]);
+	  const  Digraph::ArcMap<double> &temp = 
+	    getNumericArcMap(active_arcmaps[E_WIDTH]);
+	  for(ArcIt a(digraph);a!=INVALID;++a)
+	    _arcWidths[a]=temp[a];
 	}
       if(active_arcmaps[E_COLOR]!="")
 	{
diff -r 3a44a2bb6da8 -r f227a74db59d xml.h
--- a/xml.h	Wed Aug 13 17:24:25 2008 +0100
+++ b/xml.h	Fri Oct 10 13:36:20 2008 +0100
@@ -25,6 +25,7 @@
 #include <list>
 #include <map>
 #include <lemon/error.h>
+#include <lemon/assert.h>
 #include <lemon/dim2.h>
 
 namespace lemon {
@@ -74,7 +75,7 @@
       if(write())
 	if(level>=0) indent(level);
 	else level=0;
-      else throw LogicError();	
+      else LEMON_ASSERT(true, "Invalid indentation.");	
     }
   
     ///Read/write a tag
@@ -159,7 +160,7 @@
 
     void skipWhiteSpaces()
     {
-      if(write()) throw LogicError();
+      if(write()) LEMON_ASSERT(true, "Can't skip whitespaces in write mode.");
       {
 	char c;
 	while (is.get(c) && std::isspace(c,is.getloc()))
@@ -180,7 +181,7 @@
     ///
     void useTag(const std::string &_tag) {
       if(nextTag()==_tag) useTag();
-      else throw DataFormatError("",line_number,"Unexpected token name");
+      else throw FormatError("Unexpected token name","",line_number);
     }
   public:
     ///Return the next tag (if a tag follows on the stream).
@@ -189,16 +190,16 @@
     ///
     const std::string &nextTag() 
     {
-      if(write()) throw LogicError();
+      if(write()) LEMON_ASSERT(true,"Don't use nextTag() in write mode");
       else if(next_tag.empty()) {
 	char c;
 	skipWhiteSpaces();
 	if(!is.get(c) || c!='<')
-	  throw DataFormatError("",line_number,"Bad format");
+	  throw FormatError("Bad format","",line_number);
 	next_tag.clear();
 	while (is.get(c) && c!='>') next_tag.push_back(c);
 	if(c!='>')
-	  throw DataFormatError("",line_number,"Bad format");
+	  throw FormatError("Bad format","",line_number);
       }
       return next_tag;
     }
@@ -229,7 +230,7 @@
       else {
 	skipWhiteSpaces();
 	if(!(is >> const_cast<int &>(v))) 
-	  throw DataFormatError("",line_number,"Not an 'int'");
+	  throw FormatError("Not an 'int'","",line_number);
       }
       return *this;
     }
@@ -239,7 +240,7 @@
       else {
 	skipWhiteSpaces();
 	if(!(is >> const_cast<double &>(v))) 
-	  throw DataFormatError("",line_number,"Not an 'double'");
+	  throw FormatError("Not an 'double'","",line_number);
       }
       return *this;
     }
@@ -271,7 +272,7 @@
 	while (is.get(c) && c!='<')
 	  if(c=='\\')
 	    if(!is.get(c))
-	      throw DataFormatError("",line_number,"Bad string");
+	      throw FormatError("Bad string","",line_number);
 	    else switch(c) {
 	    case 'n':
 	      w.push_back('\n');
@@ -285,7 +286,7 @@
 	    w.push_back(c);
 	  }
 	if(c!='<')
-	  throw DataFormatError("",line_number,"Unexpected eof");
+	  throw FormatError("Unexpected eof","",line_number);
 	is.unget();
       }
       return *this;
@@ -425,7 +426,7 @@
   ///\relates XmlIo
   ///
   template<class T>
-  void xml(XmlIo &x,lemon::dim2::BoundingBox<T> &v)
+  void xml(XmlIo &x,lemon::dim2::Box<T> &v)
   {
     if(x.write()) {
       if(!v.empty()) {



More information about the Lemon-commits mailing list