lemon/lgf_reader.h
changeset 163 c82fd9568d75
parent 162 33247f6fff16
child 165 b4c336c27a03
     1.1 --- a/lemon/lgf_reader.h	Tue May 27 16:01:20 2008 +0200
     1.2 +++ b/lemon/lgf_reader.h	Sat May 31 12:31:21 2008 +0200
     1.3 @@ -467,7 +467,7 @@
     1.4        : _is(other._is), local_is(other.local_is), _digraph(other._digraph),
     1.5  	_use_nodes(other._use_nodes), _use_arcs(other._use_arcs) {
     1.6  
     1.7 -      other.is = 0;
     1.8 +      other._is = 0;
     1.9        other.local_is = false;
    1.10        
    1.11        _node_index.swap(other._node_index);
    1.12 @@ -1078,8 +1078,10 @@
    1.13      ///
    1.14      /// This function starts the batch processing
    1.15      void run() {
    1.16 -      
    1.17        LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
    1.18 +      if (!*_is) {
    1.19 +	throw DataFormatError("Cannot find file");
    1.20 +      }
    1.21        
    1.22        bool nodes_done = false;
    1.23        bool arcs_done = false;
    1.24 @@ -1160,20 +1162,23 @@
    1.25    /// \relates DigraphReader
    1.26    template <typename Digraph>
    1.27    DigraphReader<Digraph> digraphReader(std::istream& is, Digraph& digraph) {
    1.28 -    return DigraphReader<Digraph>(is, digraph);
    1.29 +    DigraphReader<Digraph> tmp(is, digraph);
    1.30 +    return tmp;
    1.31    }
    1.32  
    1.33    /// \relates DigraphReader
    1.34    template <typename Digraph>
    1.35    DigraphReader<Digraph> digraphReader(const std::string& fn, 
    1.36  				       Digraph& digraph) {
    1.37 -    return DigraphReader<Digraph>(fn, digraph);
    1.38 +    DigraphReader<Digraph> tmp(fn, digraph);
    1.39 +    return tmp;
    1.40    }
    1.41  
    1.42    /// \relates DigraphReader
    1.43    template <typename Digraph>
    1.44    DigraphReader<Digraph> digraphReader(const char* fn, Digraph& digraph) {
    1.45 -    return DigraphReader<Digraph>(fn, digraph);
    1.46 +    DigraphReader<Digraph> tmp(fn, digraph);
    1.47 +    return tmp;
    1.48    }
    1.49  }
    1.50