lemon/lgf_reader.h
changeset 783 ef88c0a30f85
parent 598 a3402913cffe
parent 584 33c6b6e755cd
child 786 e20173729589
child 959 17e36e175725
     1.1 --- a/lemon/lgf_reader.h	Mon Jan 12 23:11:39 2009 +0100
     1.2 +++ b/lemon/lgf_reader.h	Thu Nov 05 15:48:01 2009 +0100
     1.3 @@ -101,23 +101,23 @@
     1.4        }
     1.5      };
     1.6  
     1.7 -    template <typename _Graph, bool _dir, typename _Map,
     1.8 +    template <typename _GR, bool _dir, typename _Map,
     1.9                typename _Converter = DefaultConverter<typename _Map::Value> >
    1.10 -    class GraphArcMapStorage : public MapStorageBase<typename _Graph::Edge> {
    1.11 +    class GraphArcMapStorage : public MapStorageBase<typename _GR::Edge> {
    1.12      public:
    1.13        typedef _Map Map;
    1.14        typedef _Converter Converter;
    1.15 -      typedef _Graph Graph;
    1.16 -      typedef typename Graph::Edge Item;
    1.17 +      typedef _GR GR;
    1.18 +      typedef typename GR::Edge Item;
    1.19        static const bool dir = _dir;
    1.20  
    1.21      private:
    1.22 -      const Graph& _graph;
    1.23 +      const GR& _graph;
    1.24        Map& _map;
    1.25        Converter _converter;
    1.26  
    1.27      public:
    1.28 -      GraphArcMapStorage(const Graph& graph, Map& map,
    1.29 +      GraphArcMapStorage(const GR& graph, Map& map,
    1.30                           const Converter& converter = Converter())
    1.31          : _graph(graph), _map(map), _converter(converter) {}
    1.32        virtual ~GraphArcMapStorage() {}
    1.33 @@ -173,21 +173,21 @@
    1.34        }
    1.35      };
    1.36  
    1.37 -    template <typename Graph>
    1.38 +    template <typename GR>
    1.39      struct GraphArcLookUpConverter {
    1.40 -      const Graph& _graph;
    1.41 -      const std::map<std::string, typename Graph::Edge>& _map;
    1.42 -
    1.43 -      GraphArcLookUpConverter(const Graph& graph,
    1.44 +      const GR& _graph;
    1.45 +      const std::map<std::string, typename GR::Edge>& _map;
    1.46 +
    1.47 +      GraphArcLookUpConverter(const GR& graph,
    1.48                                const std::map<std::string,
    1.49 -                                             typename Graph::Edge>& map)
    1.50 +                                             typename GR::Edge>& map)
    1.51          : _graph(graph), _map(map) {}
    1.52  
    1.53 -      typename Graph::Arc operator()(const std::string& str) {
    1.54 +      typename GR::Arc operator()(const std::string& str) {
    1.55          if (str.empty() || (str[0] != '+' && str[0] != '-')) {
    1.56            throw FormatError("Item must start with '+' or '-'");
    1.57          }
    1.58 -        typename std::map<std::string, typename Graph::Edge>
    1.59 +        typename std::map<std::string, typename GR::Edge>
    1.60            ::const_iterator it = _map.find(str.substr(1));
    1.61          if (it == _map.end()) {
    1.62            throw FormatError("Item not found");
    1.63 @@ -387,40 +387,15 @@
    1.64  
    1.65    }
    1.66  
    1.67 -  template <typename Digraph>
    1.68 +  template <typename DGR>
    1.69    class DigraphReader;
    1.70  
    1.71 -  /// \brief Return a \ref DigraphReader class
    1.72 -  ///
    1.73 -  /// This function just returns a \ref DigraphReader class.
    1.74 -  /// \relates DigraphReader
    1.75 -  template <typename Digraph>
    1.76 -  DigraphReader<Digraph> digraphReader(Digraph& digraph,
    1.77 -                                       std::istream& is = std::cin) {
    1.78 -    DigraphReader<Digraph> tmp(digraph, is);
    1.79 -    return tmp;
    1.80 -  }
    1.81 -
    1.82 -  /// \brief Return a \ref DigraphReader class
    1.83 -  ///
    1.84 -  /// This function just returns a \ref DigraphReader class.
    1.85 -  /// \relates DigraphReader
    1.86 -  template <typename Digraph>
    1.87 -  DigraphReader<Digraph> digraphReader(Digraph& digraph,
    1.88 -                                       const std::string& fn) {
    1.89 -    DigraphReader<Digraph> tmp(digraph, fn);
    1.90 -    return tmp;
    1.91 -  }
    1.92 -
    1.93 -  /// \brief Return a \ref DigraphReader class
    1.94 -  ///
    1.95 -  /// This function just returns a \ref DigraphReader class.
    1.96 -  /// \relates DigraphReader
    1.97 -  template <typename Digraph>
    1.98 -  DigraphReader<Digraph> digraphReader(Digraph& digraph, const char* fn) {
    1.99 -    DigraphReader<Digraph> tmp(digraph, fn);
   1.100 -    return tmp;
   1.101 -  }
   1.102 +  template <typename TDGR>
   1.103 +  DigraphReader<TDGR> digraphReader(TDGR& digraph, std::istream& is = std::cin);
   1.104 +  template <typename TDGR>
   1.105 +  DigraphReader<TDGR> digraphReader(TDGR& digraph, const std::string& fn);
   1.106 +  template <typename TDGR>
   1.107 +  DigraphReader<TDGR> digraphReader(TDGR& digraph, const char *fn);
   1.108  
   1.109    /// \ingroup lemon_io
   1.110    ///
   1.111 @@ -443,7 +418,7 @@
   1.112    /// rules.
   1.113    ///
   1.114    ///\code
   1.115 -  /// DigraphReader<Digraph>(digraph, std::cin).
   1.116 +  /// DigraphReader<DGR>(digraph, std::cin).
   1.117    ///   nodeMap("coordinates", coord_map).
   1.118    ///   arcMap("capacity", cap_map).
   1.119    ///   node("source", src).
   1.120 @@ -472,21 +447,21 @@
   1.121    /// It is impossible to read this in
   1.122    /// a single pass, because the arcs are not constructed when the node
   1.123    /// maps are read.
   1.124 -  template <typename _Digraph>
   1.125 +  template <typename DGR>
   1.126    class DigraphReader {
   1.127    public:
   1.128  
   1.129 -    typedef _Digraph Digraph;
   1.130 -    TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
   1.131 +    typedef DGR Digraph;
   1.132  
   1.133    private:
   1.134  
   1.135 +    TEMPLATE_DIGRAPH_TYPEDEFS(DGR);
   1.136  
   1.137      std::istream* _is;
   1.138      bool local_is;
   1.139      std::string _filename;
   1.140  
   1.141 -    Digraph& _digraph;
   1.142 +    DGR& _digraph;
   1.143  
   1.144      std::string _nodes_caption;
   1.145      std::string _arcs_caption;
   1.146 @@ -524,7 +499,7 @@
   1.147      ///
   1.148      /// Construct a directed graph reader, which reads from the given
   1.149      /// input stream.
   1.150 -    DigraphReader(Digraph& digraph, std::istream& is = std::cin)
   1.151 +    DigraphReader(DGR& digraph, std::istream& is = std::cin)
   1.152        : _is(&is), local_is(false), _digraph(digraph),
   1.153          _use_nodes(false), _use_arcs(false),
   1.154          _skip_nodes(false), _skip_arcs(false) {}
   1.155 @@ -533,7 +508,7 @@
   1.156      ///
   1.157      /// Construct a directed graph reader, which reads from the given
   1.158      /// file.
   1.159 -    DigraphReader(Digraph& digraph, const std::string& fn)
   1.160 +    DigraphReader(DGR& digraph, const std::string& fn)
   1.161        : _is(new std::ifstream(fn.c_str())), local_is(true),
   1.162          _filename(fn), _digraph(digraph),
   1.163          _use_nodes(false), _use_arcs(false),
   1.164 @@ -548,7 +523,7 @@
   1.165      ///
   1.166      /// Construct a directed graph reader, which reads from the given
   1.167      /// file.
   1.168 -    DigraphReader(Digraph& digraph, const char* fn)
   1.169 +    DigraphReader(DGR& digraph, const char* fn)
   1.170        : _is(new std::ifstream(fn)), local_is(true),
   1.171          _filename(fn), _digraph(digraph),
   1.172          _use_nodes(false), _use_arcs(false),
   1.173 @@ -584,12 +559,13 @@
   1.174  
   1.175    private:
   1.176  
   1.177 -    friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph,
   1.178 -                                                  std::istream& is);
   1.179 -    friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph,
   1.180 -                                                  const std::string& fn);
   1.181 -    friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph,
   1.182 -                                                  const char *fn);
   1.183 +    template <typename TDGR>
   1.184 +    friend DigraphReader<TDGR> digraphReader(TDGR& digraph, std::istream& is);
   1.185 +    template <typename TDGR>
   1.186 +    friend DigraphReader<TDGR> digraphReader(TDGR& digraph, 
   1.187 +                                             const std::string& fn);
   1.188 +    template <typename TDGR>
   1.189 +    friend DigraphReader<TDGR> digraphReader(TDGR& digraph, const char *fn);
   1.190  
   1.191      DigraphReader(DigraphReader& other)
   1.192        : _is(other._is), local_is(other.local_is), _digraph(other._digraph),
   1.193 @@ -616,7 +592,7 @@
   1.194  
   1.195    public:
   1.196  
   1.197 -    /// \name Reading rules
   1.198 +    /// \name Reading Rules
   1.199      /// @{
   1.200  
   1.201      /// \brief Node map reading rule
   1.202 @@ -721,7 +697,7 @@
   1.203  
   1.204      /// @}
   1.205  
   1.206 -    /// \name Select section by name
   1.207 +    /// \name Select Section by Name
   1.208      /// @{
   1.209  
   1.210      /// \brief Set \c \@nodes section to be read
   1.211 @@ -750,7 +726,7 @@
   1.212  
   1.213      /// @}
   1.214  
   1.215 -    /// \name Using previously constructed node or arc set
   1.216 +    /// \name Using Previously Constructed Node or Arc Set
   1.217      /// @{
   1.218  
   1.219      /// \brief Use previously constructed node set
   1.220 @@ -1139,7 +1115,7 @@
   1.221  
   1.222    public:
   1.223  
   1.224 -    /// \name Execution of the reader
   1.225 +    /// \name Execution of the Reader
   1.226      /// @{
   1.227  
   1.228      /// \brief Start the batch processing
   1.229 @@ -1211,40 +1187,76 @@
   1.230      /// @}
   1.231  
   1.232    };
   1.233 -
   1.234 -  template <typename Graph>
   1.235 -  class GraphReader;
   1.236 -
   1.237 -  /// \brief Return a \ref GraphReader class
   1.238 +  
   1.239 +  /// \ingroup lemon_io
   1.240    ///
   1.241 -  /// This function just returns a \ref GraphReader class.
   1.242 -  /// \relates GraphReader
   1.243 -  template <typename Graph>
   1.244 -  GraphReader<Graph> graphReader(Graph& graph, std::istream& is = std::cin) {
   1.245 -    GraphReader<Graph> tmp(graph, is);
   1.246 +  /// \brief Return a \ref DigraphReader class
   1.247 +  ///
   1.248 +  /// This function just returns a \ref DigraphReader class.
   1.249 +  ///
   1.250 +  /// With this function a digraph can be read from an 
   1.251 +  /// \ref lgf-format "LGF" file or input stream with several maps and
   1.252 +  /// attributes. For example, there is network flow problem on a
   1.253 +  /// digraph, i.e. a digraph with a \e capacity map on the arcs and
   1.254 +  /// \e source and \e target nodes. This digraph can be read with the
   1.255 +  /// following code:
   1.256 +  ///
   1.257 +  ///\code
   1.258 +  ///ListDigraph digraph;
   1.259 +  ///ListDigraph::ArcMap<int> cm(digraph);
   1.260 +  ///ListDigraph::Node src, trg;
   1.261 +  ///digraphReader(digraph, std::cin).
   1.262 +  ///  arcMap("capacity", cap).
   1.263 +  ///  node("source", src).
   1.264 +  ///  node("target", trg).
   1.265 +  ///  run();
   1.266 +  ///\endcode
   1.267 +  ///
   1.268 +  /// For a complete documentation, please see the \ref DigraphReader
   1.269 +  /// class documentation.
   1.270 +  /// \warning Don't forget to put the \ref DigraphReader::run() "run()"
   1.271 +  /// to the end of the parameter list.
   1.272 +  /// \relates DigraphReader
   1.273 +  /// \sa digraphReader(TDGR& digraph, const std::string& fn)
   1.274 +  /// \sa digraphReader(TDGR& digraph, const char* fn)
   1.275 +  template <typename TDGR>
   1.276 +  DigraphReader<TDGR> digraphReader(TDGR& digraph, std::istream& is) {
   1.277 +    DigraphReader<TDGR> tmp(digraph, is);
   1.278      return tmp;
   1.279    }
   1.280  
   1.281 -  /// \brief Return a \ref GraphReader class
   1.282 +  /// \brief Return a \ref DigraphReader class
   1.283    ///
   1.284 -  /// This function just returns a \ref GraphReader class.
   1.285 -  /// \relates GraphReader
   1.286 -  template <typename Graph>
   1.287 -  GraphReader<Graph> graphReader(Graph& graph, const std::string& fn) {
   1.288 -    GraphReader<Graph> tmp(graph, fn);
   1.289 +  /// This function just returns a \ref DigraphReader class.
   1.290 +  /// \relates DigraphReader
   1.291 +  /// \sa digraphReader(TDGR& digraph, std::istream& is)
   1.292 +  template <typename TDGR>
   1.293 +  DigraphReader<TDGR> digraphReader(TDGR& digraph, const std::string& fn) {
   1.294 +    DigraphReader<TDGR> tmp(digraph, fn);
   1.295      return tmp;
   1.296    }
   1.297  
   1.298 -  /// \brief Return a \ref GraphReader class
   1.299 +  /// \brief Return a \ref DigraphReader class
   1.300    ///
   1.301 -  /// This function just returns a \ref GraphReader class.
   1.302 -  /// \relates GraphReader
   1.303 -  template <typename Graph>
   1.304 -  GraphReader<Graph> graphReader(Graph& graph, const char* fn) {
   1.305 -    GraphReader<Graph> tmp(graph, fn);
   1.306 +  /// This function just returns a \ref DigraphReader class.
   1.307 +  /// \relates DigraphReader
   1.308 +  /// \sa digraphReader(TDGR& digraph, std::istream& is)
   1.309 +  template <typename TDGR>
   1.310 +  DigraphReader<TDGR> digraphReader(TDGR& digraph, const char* fn) {
   1.311 +    DigraphReader<TDGR> tmp(digraph, fn);
   1.312      return tmp;
   1.313    }
   1.314  
   1.315 +  template <typename GR>
   1.316 +  class GraphReader;
   1.317 + 
   1.318 +  template <typename TGR>
   1.319 +  GraphReader<TGR> graphReader(TGR& graph, std::istream& is = std::cin);
   1.320 +  template <typename TGR>
   1.321 +  GraphReader<TGR> graphReader(TGR& graph, const std::string& fn);
   1.322 +  template <typename TGR>
   1.323 +  GraphReader<TGR> graphReader(TGR& graph, const char *fn);
   1.324 +
   1.325    /// \ingroup lemon_io
   1.326    ///
   1.327    /// \brief \ref lgf-format "LGF" reader for undirected graphs
   1.328 @@ -1260,20 +1272,21 @@
   1.329    /// prefixed with \c '+' and \c '-', then these can be read into an
   1.330    /// arc map.  Similarly, an attribute can be read into an arc, if
   1.331    /// it's value is an edge label prefixed with \c '+' or \c '-'.
   1.332 -  template <typename _Graph>
   1.333 +  template <typename GR>
   1.334    class GraphReader {
   1.335    public:
   1.336  
   1.337 -    typedef _Graph Graph;
   1.338 -    TEMPLATE_GRAPH_TYPEDEFS(Graph);
   1.339 +    typedef GR Graph;
   1.340  
   1.341    private:
   1.342  
   1.343 +    TEMPLATE_GRAPH_TYPEDEFS(GR);
   1.344 +
   1.345      std::istream* _is;
   1.346      bool local_is;
   1.347      std::string _filename;
   1.348  
   1.349 -    Graph& _graph;
   1.350 +    GR& _graph;
   1.351  
   1.352      std::string _nodes_caption;
   1.353      std::string _edges_caption;
   1.354 @@ -1311,7 +1324,7 @@
   1.355      ///
   1.356      /// Construct an undirected graph reader, which reads from the given
   1.357      /// input stream.
   1.358 -    GraphReader(Graph& graph, std::istream& is = std::cin)
   1.359 +    GraphReader(GR& graph, std::istream& is = std::cin)
   1.360        : _is(&is), local_is(false), _graph(graph),
   1.361          _use_nodes(false), _use_edges(false),
   1.362          _skip_nodes(false), _skip_edges(false) {}
   1.363 @@ -1320,7 +1333,7 @@
   1.364      ///
   1.365      /// Construct an undirected graph reader, which reads from the given
   1.366      /// file.
   1.367 -    GraphReader(Graph& graph, const std::string& fn)
   1.368 +    GraphReader(GR& graph, const std::string& fn)
   1.369        : _is(new std::ifstream(fn.c_str())), local_is(true),
   1.370          _filename(fn), _graph(graph),
   1.371          _use_nodes(false), _use_edges(false),
   1.372 @@ -1335,7 +1348,7 @@
   1.373      ///
   1.374      /// Construct an undirected graph reader, which reads from the given
   1.375      /// file.
   1.376 -    GraphReader(Graph& graph, const char* fn)
   1.377 +    GraphReader(GR& graph, const char* fn)
   1.378        : _is(new std::ifstream(fn)), local_is(true),
   1.379          _filename(fn), _graph(graph),
   1.380          _use_nodes(false), _use_edges(false),
   1.381 @@ -1370,10 +1383,12 @@
   1.382      }
   1.383  
   1.384    private:
   1.385 -    friend GraphReader<Graph> graphReader<>(Graph& graph, std::istream& is);
   1.386 -    friend GraphReader<Graph> graphReader<>(Graph& graph,
   1.387 -                                            const std::string& fn);
   1.388 -    friend GraphReader<Graph> graphReader<>(Graph& graph, const char *fn);
   1.389 +    template <typename TGR>
   1.390 +    friend GraphReader<TGR> graphReader(TGR& graph, std::istream& is);
   1.391 +    template <typename TGR>
   1.392 +    friend GraphReader<TGR> graphReader(TGR& graph, const std::string& fn); 
   1.393 +    template <typename TGR>
   1.394 +    friend GraphReader<TGR> graphReader(TGR& graph, const char *fn);
   1.395  
   1.396      GraphReader(GraphReader& other)
   1.397        : _is(other._is), local_is(other.local_is), _graph(other._graph),
   1.398 @@ -1400,7 +1415,7 @@
   1.399  
   1.400    public:
   1.401  
   1.402 -    /// \name Reading rules
   1.403 +    /// \name Reading Rules
   1.404      /// @{
   1.405  
   1.406      /// \brief Node map reading rule
   1.407 @@ -1465,7 +1480,7 @@
   1.408          new _reader_bits::GraphArcMapStorage<Graph, true, Map>(_graph, map);
   1.409        _edge_maps.push_back(std::make_pair('+' + caption, forward_storage));
   1.410        _reader_bits::MapStorageBase<Edge>* backward_storage =
   1.411 -        new _reader_bits::GraphArcMapStorage<Graph, false, Map>(_graph, map);
   1.412 +        new _reader_bits::GraphArcMapStorage<GR, false, Map>(_graph, map);
   1.413        _edge_maps.push_back(std::make_pair('-' + caption, backward_storage));
   1.414        return *this;
   1.415      }
   1.416 @@ -1479,11 +1494,11 @@
   1.417                            const Converter& converter = Converter()) {
   1.418        checkConcept<concepts::WriteMap<Arc, typename Map::Value>, Map>();
   1.419        _reader_bits::MapStorageBase<Edge>* forward_storage =
   1.420 -        new _reader_bits::GraphArcMapStorage<Graph, true, Map, Converter>
   1.421 +        new _reader_bits::GraphArcMapStorage<GR, true, Map, Converter>
   1.422          (_graph, map, converter);
   1.423        _edge_maps.push_back(std::make_pair('+' + caption, forward_storage));
   1.424        _reader_bits::MapStorageBase<Edge>* backward_storage =
   1.425 -        new _reader_bits::GraphArcMapStorage<Graph, false, Map, Converter>
   1.426 +        new _reader_bits::GraphArcMapStorage<GR, false, Map, Converter>
   1.427          (_graph, map, converter);
   1.428        _edge_maps.push_back(std::make_pair('-' + caption, backward_storage));
   1.429        return *this;
   1.430 @@ -1541,7 +1556,7 @@
   1.431      ///
   1.432      /// Add an arc reading rule to reader.
   1.433      GraphReader& arc(const std::string& caption, Arc& arc) {
   1.434 -      typedef _reader_bits::GraphArcLookUpConverter<Graph> Converter;
   1.435 +      typedef _reader_bits::GraphArcLookUpConverter<GR> Converter;
   1.436        Converter converter(_graph, _edge_index);
   1.437        _reader_bits::ValueStorageBase* storage =
   1.438          new _reader_bits::ValueStorage<Arc, Converter>(arc, converter);
   1.439 @@ -1551,7 +1566,7 @@
   1.440  
   1.441      /// @}
   1.442  
   1.443 -    /// \name Select section by name
   1.444 +    /// \name Select Section by Name
   1.445      /// @{
   1.446  
   1.447      /// \brief Set \c \@nodes section to be read
   1.448 @@ -1580,7 +1595,7 @@
   1.449  
   1.450      /// @}
   1.451  
   1.452 -    /// \name Using previously constructed node or edge set
   1.453 +    /// \name Using Previously Constructed Node or Edge Set
   1.454      /// @{
   1.455  
   1.456      /// \brief Use previously constructed node set
   1.457 @@ -1970,7 +1985,7 @@
   1.458  
   1.459    public:
   1.460  
   1.461 -    /// \name Execution of the reader
   1.462 +    /// \name Execution of the Reader
   1.463      /// @{
   1.464  
   1.465      /// \brief Start the batch processing
   1.466 @@ -2044,6 +2059,61 @@
   1.467  
   1.468    };
   1.469  
   1.470 +  /// \ingroup lemon_io
   1.471 +  ///
   1.472 +  /// \brief Return a \ref GraphReader class
   1.473 +  ///
   1.474 +  /// This function just returns a \ref GraphReader class. 
   1.475 +  ///
   1.476 +  /// With this function a graph can be read from an 
   1.477 +  /// \ref lgf-format "LGF" file or input stream with several maps and
   1.478 +  /// attributes. For example, there is weighted matching problem on a
   1.479 +  /// graph, i.e. a graph with a \e weight map on the edges. This
   1.480 +  /// graph can be read with the following code:
   1.481 +  ///
   1.482 +  ///\code
   1.483 +  ///ListGraph graph;
   1.484 +  ///ListGraph::EdgeMap<int> weight(graph);
   1.485 +  ///graphReader(graph, std::cin).
   1.486 +  ///  edgeMap("weight", weight).
   1.487 +  ///  run();
   1.488 +  ///\endcode
   1.489 +  ///
   1.490 +  /// For a complete documentation, please see the \ref GraphReader
   1.491 +  /// class documentation.
   1.492 +  /// \warning Don't forget to put the \ref GraphReader::run() "run()"
   1.493 +  /// to the end of the parameter list.
   1.494 +  /// \relates GraphReader
   1.495 +  /// \sa graphReader(TGR& graph, const std::string& fn)
   1.496 +  /// \sa graphReader(TGR& graph, const char* fn)
   1.497 +  template <typename TGR>
   1.498 +  GraphReader<TGR> graphReader(TGR& graph, std::istream& is) {
   1.499 +    GraphReader<TGR> tmp(graph, is);
   1.500 +    return tmp;
   1.501 +  }
   1.502 +
   1.503 +  /// \brief Return a \ref GraphReader class
   1.504 +  ///
   1.505 +  /// This function just returns a \ref GraphReader class.
   1.506 +  /// \relates GraphReader
   1.507 +  /// \sa graphReader(TGR& graph, std::istream& is)
   1.508 +  template <typename TGR>
   1.509 +  GraphReader<TGR> graphReader(TGR& graph, const std::string& fn) {
   1.510 +    GraphReader<TGR> tmp(graph, fn);
   1.511 +    return tmp;
   1.512 +  }
   1.513 +
   1.514 +  /// \brief Return a \ref GraphReader class
   1.515 +  ///
   1.516 +  /// This function just returns a \ref GraphReader class.
   1.517 +  /// \relates GraphReader
   1.518 +  /// \sa graphReader(TGR& graph, std::istream& is)
   1.519 +  template <typename TGR>
   1.520 +  GraphReader<TGR> graphReader(TGR& graph, const char* fn) {
   1.521 +    GraphReader<TGR> tmp(graph, fn);
   1.522 +    return tmp;
   1.523 +  }
   1.524 +
   1.525    class SectionReader;
   1.526  
   1.527    SectionReader sectionReader(std::istream& is);
   1.528 @@ -2139,7 +2209,7 @@
   1.529  
   1.530    public:
   1.531  
   1.532 -    /// \name Section readers
   1.533 +    /// \name Section Readers
   1.534      /// @{
   1.535  
   1.536      /// \brief Add a section processor with line oriented reading
   1.537 @@ -2238,7 +2308,7 @@
   1.538    public:
   1.539  
   1.540  
   1.541 -    /// \name Execution of the reader
   1.542 +    /// \name Execution of the Reader
   1.543      /// @{
   1.544  
   1.545      /// \brief Start the batch processing
   1.546 @@ -2297,12 +2367,30 @@
   1.547  
   1.548    };
   1.549  
   1.550 +  /// \ingroup lemon_io
   1.551 +  ///
   1.552 +  /// \brief Return a \ref SectionReader class
   1.553 +  ///
   1.554 +  /// This function just returns a \ref SectionReader class.
   1.555 +  ///
   1.556 +  /// Please see SectionReader documentation about the custom section
   1.557 +  /// input.
   1.558 +  ///
   1.559 +  /// \relates SectionReader
   1.560 +  /// \sa sectionReader(const std::string& fn)
   1.561 +  /// \sa sectionReader(const char *fn)
   1.562 +  inline SectionReader sectionReader(std::istream& is) {
   1.563 +    SectionReader tmp(is);
   1.564 +    return tmp;
   1.565 +  }
   1.566 +
   1.567    /// \brief Return a \ref SectionReader class
   1.568    ///
   1.569    /// This function just returns a \ref SectionReader class.
   1.570    /// \relates SectionReader
   1.571 -  inline SectionReader sectionReader(std::istream& is) {
   1.572 -    SectionReader tmp(is);
   1.573 +  /// \sa sectionReader(std::istream& is)
   1.574 +  inline SectionReader sectionReader(const std::string& fn) {
   1.575 +    SectionReader tmp(fn);
   1.576      return tmp;
   1.577    }
   1.578  
   1.579 @@ -2310,15 +2398,7 @@
   1.580    ///
   1.581    /// This function just returns a \ref SectionReader class.
   1.582    /// \relates SectionReader
   1.583 -  inline SectionReader sectionReader(const std::string& fn) {
   1.584 -    SectionReader tmp(fn);
   1.585 -    return tmp;
   1.586 -  }
   1.587 -
   1.588 -  /// \brief Return a \ref SectionReader class
   1.589 -  ///
   1.590 -  /// This function just returns a \ref SectionReader class.
   1.591 -  /// \relates SectionReader
   1.592 +  /// \sa sectionReader(std::istream& is)
   1.593    inline SectionReader sectionReader(const char* fn) {
   1.594      SectionReader tmp(fn);
   1.595      return tmp;
   1.596 @@ -2420,7 +2500,7 @@
   1.597    public:
   1.598  
   1.599  
   1.600 -    /// \name Node sections
   1.601 +    /// \name Node Sections
   1.602      /// @{
   1.603  
   1.604      /// \brief Gives back the number of node sections in the file.
   1.605 @@ -2446,7 +2526,7 @@
   1.606  
   1.607      /// @}
   1.608  
   1.609 -    /// \name Arc/Edge sections
   1.610 +    /// \name Arc/Edge Sections
   1.611      /// @{
   1.612  
   1.613      /// \brief Gives back the number of arc/edge sections in the file.
   1.614 @@ -2504,7 +2584,7 @@
   1.615  
   1.616      /// @}
   1.617  
   1.618 -    /// \name Attribute sections
   1.619 +    /// \name Attribute Sections
   1.620      /// @{
   1.621  
   1.622      /// \brief Gives back the number of attribute sections in the file.
   1.623 @@ -2530,7 +2610,7 @@
   1.624  
   1.625      /// @}
   1.626  
   1.627 -    /// \name Extra sections
   1.628 +    /// \name Extra Sections
   1.629      /// @{
   1.630  
   1.631      /// \brief Gives back the number of extra sections in the file.
   1.632 @@ -2606,7 +2686,7 @@
   1.633  
   1.634    public:
   1.635  
   1.636 -    /// \name Execution of the contents reader
   1.637 +    /// \name Execution of the Contents Reader
   1.638      /// @{
   1.639  
   1.640      /// \brief Starts the reading