An easy avoiding of a bug
authordeba
Wed, 06 Sep 2006 10:01:15 +0000
changeset 22002f2ac1b1ca1e
parent 2199 1229af45cc69
child 2201 597714206430
An easy avoiding of a bug

The functional interfaces are removed.
Better solution could be a reference counted core of the io interfaces

Now it is huge work so just write that:

GraphReader<ListGraph>(std::cin, graph).

Instead of:

graphReader(std::cin, graph).
lemon/graph_reader.h
lemon/graph_writer.h
     1.1 --- a/lemon/graph_reader.h	Wed Sep 06 09:55:37 2006 +0000
     1.2 +++ b/lemon/graph_reader.h	Wed Sep 06 10:01:15 2006 +0000
     1.3 @@ -344,36 +344,6 @@
     1.4    };
     1.5  
     1.6  
     1.7 -  /// \brief Read a graph from the input.
     1.8 -  ///
     1.9 -  /// It is a helper function to read a graph from the given input
    1.10 -  /// stream. It gives back an GraphReader object and this object
    1.11 -  /// can read more maps, labeled nodes, edges and attributes.
    1.12 -  ///
    1.13 -  /// \warning Do not forget to call the \c run() function.
    1.14 -  ///
    1.15 -  /// \param is The input stream.
    1.16 -  /// \param g The graph.
    1.17 -  template<typename Graph>
    1.18 -  GraphReader<Graph> graphReader(std::istream& is, Graph &g) {
    1.19 -    return GraphReader<Graph>(is, g);
    1.20 -  }
    1.21 -
    1.22 -  /// \brief Read a graph from the input.
    1.23 -  ///
    1.24 -  /// It is a helper function to read a graph from the given input
    1.25 -  /// file. It gives back an GraphReader object and this object
    1.26 -  /// can read more maps, labeled nodes, edges and attributes.
    1.27 -  ///
    1.28 -  /// \warning Do not forget to call the \c run() function.
    1.29 -  ///
    1.30 -  /// \param fn The input filename.
    1.31 -  /// \param g The graph.
    1.32 -  template<typename Graph>
    1.33 -  GraphReader<Graph> graphReader(const std::string& fn, Graph &g) {
    1.34 -    return GraphReader<Graph>(fn, g);
    1.35 -  }
    1.36 -
    1.37    /// \brief The undirected graph reader class.
    1.38    ///
    1.39    /// The \c UGraphReader class provides the graph input. 
    1.40 @@ -755,37 +725,6 @@
    1.41      AttributeReader<ReaderTraits> attribute_reader;
    1.42    };
    1.43  
    1.44 -  /// \brief Read an undirected graph from the input.
    1.45 -  ///
    1.46 -  /// It is a helper function to read an undirected graph from the given input
    1.47 -  /// stream. It gives back an UGraphReader object and this object
    1.48 -  /// can read more maps, labeled nodes, edges, undirected edges and
    1.49 -  /// attributes.
    1.50 -  ///
    1.51 -  /// \warning Do not forget to call the \c run() function.
    1.52 -  ///
    1.53 -  /// \param is The input stream.
    1.54 -  /// \param g The graph.
    1.55 -  template<typename Graph>
    1.56 -  UGraphReader<Graph> uGraphReader(std::istream& is, Graph &g) {
    1.57 -    return GraphReader<Graph>(is, g);
    1.58 -  }
    1.59 -
    1.60 -  /// \brief Read an undirected graph from the input.
    1.61 -  ///
    1.62 -  /// It is a helper function to read an undirected graph from the given input
    1.63 -  /// file. It gives back an UGraphReader object and this object
    1.64 -  /// can read more maps, labeled nodes, edges, undirected edges and 
    1.65 -  /// attributes.
    1.66 -  ///
    1.67 -  /// \warning Do not forget to call the \c run() function.
    1.68 -  ///
    1.69 -  /// \param fn The input filename.
    1.70 -  /// \param g The graph.
    1.71 -  template<typename Graph>
    1.72 -  UGraphReader<Graph> uGraphReader(const std::string& fn, Graph &g) {
    1.73 -    return GraphReader<Graph>(fn, g);
    1.74 -  }
    1.75  
    1.76    /// @}
    1.77  }
     2.1 --- a/lemon/graph_writer.h	Wed Sep 06 09:55:37 2006 +0000
     2.2 +++ b/lemon/graph_writer.h	Wed Sep 06 10:01:15 2006 +0000
     2.3 @@ -36,24 +36,24 @@
     2.4  
     2.5    /// \brief The graph writer class.
     2.6    ///
     2.7 -  /// The \c GraphWriter class provides the graph output. 
     2.8 -  /// Before you read this documentation it might be useful to read the general
     2.9 -  /// description of  \ref graph-io-page "Graph Input-Output".
    2.10 +  /// The \c GraphWriter class provides the graph output.  Before you
    2.11 +  /// read this documentation it might be useful to read the general
    2.12 +  /// description of \ref graph-io-page "Graph Input-Output".
    2.13    ///
    2.14 -  /// To write a graph
    2.15 -  /// you should first give writing commands to the writer. You can declare
    2.16 -  /// write commands as \c NodeMap or \c EdgeMap writing and labeled Node and
    2.17 -  /// Edge writing.
    2.18 +  /// To write a graph you should first give writing commands to the
    2.19 +  /// writer. You can declare write commands as \c NodeMap or \c
    2.20 +  /// EdgeMap writing and labeled Node and Edge writing.
    2.21    ///
    2.22    ///\code
    2.23    /// GraphWriter<ListGraph> writer(std::cout, graph);
    2.24    ///\endcode
    2.25    ///
    2.26 -  /// The \c writeNodeMap() function declares a \c NodeMap writing 
    2.27 -  /// command in the \c GraphWriter. You should give as parameter 
    2.28 -  /// the name of the map and the map object. The NodeMap writing 
    2.29 -  /// command with name "label" should write a unique map because it 
    2.30 -  /// is regarded as label map (such a map is essential if the graph has edges).
    2.31 +  /// The \c writeNodeMap() function declares a \c NodeMap writing
    2.32 +  /// command in the \c GraphWriter. You should give as parameter the
    2.33 +  /// name of the map and the map object. The NodeMap writing command
    2.34 +  /// with name "label" should write a unique map because it is
    2.35 +  /// regarded as label map (such a map is essential if the graph has
    2.36 +  /// edges).
    2.37    ///
    2.38    ///\code
    2.39    /// IdMap<ListGraph, Node> nodeLabelMap;
    2.40 @@ -282,35 +282,6 @@
    2.41    };
    2.42  
    2.43  
    2.44 -
    2.45 -  /// \brief Write a graph to the output.
    2.46 -  ///
    2.47 -  /// It is a helper function to write a graph to the given output
    2.48 -  /// stream. It gives back a GraphWriter object and this object
    2.49 -  /// can write more maps, labeled nodes and edges and attributes.
    2.50 -  /// \warning Do not forget to call the \c run() function.
    2.51 -  ///
    2.52 -  /// \param os The output stream.
    2.53 -  /// \param g The graph.
    2.54 -  template <typename Graph>
    2.55 -  GraphWriter<Graph> graphWriter(std::ostream& os, const Graph &g) {
    2.56 -    return GraphWriter<Graph>(os, g);
    2.57 -  }
    2.58 -
    2.59 -  /// \brief Write a graph to the output.
    2.60 -  ///
    2.61 -  /// It is a helper function to write a graph to the given output
    2.62 -  /// file. It gives back a GraphWriter object and this object
    2.63 -  /// can write more maps, labeled nodes and edges and attributes.
    2.64 -  /// \warning Do not forget to call the \c run() function.
    2.65 -  ///
    2.66 -  /// \param fn The filename.
    2.67 -  /// \param g The graph.
    2.68 -  template <typename Graph>
    2.69 -  GraphWriter<Graph> graphWriter(const std::string& fn, const Graph &g) {
    2.70 -    return GraphWriter<Graph>(fn, g);
    2.71 -  }
    2.72 -
    2.73    /// \brief The undirected graph writer class.
    2.74    ///
    2.75    /// The \c UGraphWriter class provides the ugraph output. To write 
    2.76 @@ -438,7 +409,8 @@
    2.77  
    2.78      /// \brief Issue a new node map writing command to the writer.
    2.79      ///
    2.80 -   /// This function issues a new <i> node map writing command</i> to the writer.
    2.81 +    /// This function issues a new <i> node map writing command</i> to
    2.82 +    /// the writer.
    2.83      template <typename Map>
    2.84      UGraphWriter& writeNodeMap(std::string name, const Map& map) {
    2.85        nodeset_writer.writeNodeMap(name, map);
    2.86 @@ -447,7 +419,8 @@
    2.87  
    2.88      /// \brief Issue a new node map writing command to the writer.
    2.89      ///
    2.90 -   /// This function issues a new <i> node map writing command</i> to the writer.
    2.91 +    /// This function issues a new <i> node map writing command</i> to
    2.92 +    /// the writer.
    2.93      template <typename Writer, typename Map>
    2.94      UGraphWriter& writeNodeMap(std::string name, const Map& map, 
    2.95  			      const Writer& writer = Writer()) {
    2.96 @@ -457,7 +430,8 @@
    2.97  
    2.98      /// \brief Issue a new edge map writing command to the writer.
    2.99      ///
   2.100 -   /// This function issues a new <i> edge map writing command</i> to the writer.
   2.101 +    /// This function issues a new <i> edge map writing command</i> to
   2.102 +    /// the writer.
   2.103      template <typename Map>
   2.104      UGraphWriter& writeEdgeMap(std::string name, const Map& map) { 
   2.105        u_edgeset_writer.writeEdgeMap(name, map);
   2.106 @@ -466,7 +440,8 @@
   2.107  
   2.108      /// \brief Issue a new edge map writing command to the writer.
   2.109      ///
   2.110 -   /// This function issues a new <i> edge map writing command</i> to the writer.
   2.111 +    /// This function issues a new <i> edge map writing command</i> to
   2.112 +    /// the writer.
   2.113      template <typename Writer, typename Map>
   2.114      UGraphWriter& writeEdgeMap(std::string name, const Map& map,
   2.115  				   const Writer& writer = Writer()) {
   2.116 @@ -577,9 +552,9 @@
   2.117  
   2.118      /// \brief Write the label of the given undirected edge.
   2.119      ///
   2.120 -    /// It writes the label of the given undirected edge. If there was written 
   2.121 -    /// an "label" named edge map then it will write the map value belonging to 
   2.122 -    /// the edge.
   2.123 +    /// It writes the label of the given undirected edge. If there was
   2.124 +    /// written an "label" named edge map then it will write the map
   2.125 +    /// value belonging to the edge.
   2.126      void writeLabel(std::ostream& os, const UEdge& item) const {
   2.127        u_edgeset_writer.writeLabel(os, item);
   2.128      } 
   2.129 @@ -599,37 +574,6 @@
   2.130      AttributeWriter<WriterTraits> attribute_writer;
   2.131    };
   2.132  
   2.133 -  /// \brief Write an undirected graph to the output.
   2.134 -  ///
   2.135 -  /// It is a helper function to write an undirected graph to the given output
   2.136 -  /// stream. It gives back an UGraphWriter object and this object
   2.137 -  /// can write more maps, labeled nodes and edges and attributes.
   2.138 -  /// \warning Do not forget to call the \c run() function.
   2.139 -  ///
   2.140 -  /// \param os The output stream.
   2.141 -  /// \param g The graph.
   2.142 -  template <typename Graph>
   2.143 -  UGraphWriter<Graph> uGraphWriter(std::ostream& os, const Graph &g) {
   2.144 -    return UGraphWriter<Graph>(os, g);
   2.145 -  }
   2.146 -
   2.147 -  /// \brief Write an undirected graph to the output.
   2.148 -  ///
   2.149 -  /// It is a helper function to write an undirected graph to the given output
   2.150 -  /// file. It gives back an UGraphWriter object and this object
   2.151 -  /// can write more maps, labeled nodes, edges, undirected edges and 
   2.152 -  /// attributes.
   2.153 -  ///
   2.154 -  /// \warning Do not forget to call the \c run() function.
   2.155 -  ///
   2.156 -  /// \param fn The output file.
   2.157 -  /// \param g The graph.
   2.158 -  template <typename Graph>
   2.159 -  UGraphWriter<Graph> uGraphWriter(const std::string& fn, 
   2.160 -					   const Graph &g) {
   2.161 -    return UGraphWriter<Graph>(fn, g);
   2.162 -  }
   2.163 -
   2.164    /// @}
   2.165  
   2.166  }