lemon/lgf_reader.h
changeset 969 cfdbf1574403
parent 959 17e36e175725
parent 877 141f9c0db4a3
child 966 c8fce9beb46a
equal deleted inserted replaced
46:f0ae74dddb27 47:77177e220fd3
   425   ///   node("target", trg).
   425   ///   node("target", trg).
   426   ///   attribute("caption", caption).
   426   ///   attribute("caption", caption).
   427   ///   run();
   427   ///   run();
   428   ///\endcode
   428   ///\endcode
   429   ///
   429   ///
   430   /// By default the reader uses the first section in the file of the
   430   /// By default, the reader uses the first section in the file of the
   431   /// proper type. If a section has an optional name, then it can be
   431   /// proper type. If a section has an optional name, then it can be
   432   /// selected for reading by giving an optional name parameter to the
   432   /// selected for reading by giving an optional name parameter to the
   433   /// \c nodes(), \c arcs() or \c attributes() functions.
   433   /// \c nodes(), \c arcs() or \c attributes() functions.
   434   ///
   434   ///
   435   /// The \c useNodes() and \c useArcs() functions are used to tell the reader
   435   /// The \c useNodes() and \c useArcs() functions are used to tell the reader
   560   private:
   560   private:
   561 
   561 
   562     template <typename TDGR>
   562     template <typename TDGR>
   563     friend DigraphReader<TDGR> digraphReader(TDGR& digraph, std::istream& is);
   563     friend DigraphReader<TDGR> digraphReader(TDGR& digraph, std::istream& is);
   564     template <typename TDGR>
   564     template <typename TDGR>
   565     friend DigraphReader<TDGR> digraphReader(TDGR& digraph, 
   565     friend DigraphReader<TDGR> digraphReader(TDGR& digraph,
   566                                              const std::string& fn);
   566                                              const std::string& fn);
   567     template <typename TDGR>
   567     template <typename TDGR>
   568     friend DigraphReader<TDGR> digraphReader(TDGR& digraph, const char *fn);
   568     friend DigraphReader<TDGR> digraphReader(TDGR& digraph, const char *fn);
   569 
   569 
   570     DigraphReader(DigraphReader& other)
   570     DigraphReader(DigraphReader& other)
  1192     }
  1192     }
  1193 
  1193 
  1194     /// @}
  1194     /// @}
  1195 
  1195 
  1196   };
  1196   };
  1197   
  1197 
  1198   /// \ingroup lemon_io
  1198   /// \ingroup lemon_io
  1199   ///
  1199   ///
  1200   /// \brief Return a \ref DigraphReader class
  1200   /// \brief Return a \ref DigraphReader class
  1201   ///
  1201   ///
  1202   /// This function just returns a \ref DigraphReader class.
  1202   /// This function just returns a \ref DigraphReader class.
  1203   ///
  1203   ///
  1204   /// With this function a digraph can be read from an 
  1204   /// With this function a digraph can be read from an
  1205   /// \ref lgf-format "LGF" file or input stream with several maps and
  1205   /// \ref lgf-format "LGF" file or input stream with several maps and
  1206   /// attributes. For example, there is network flow problem on a
  1206   /// attributes. For example, there is network flow problem on a
  1207   /// digraph, i.e. a digraph with a \e capacity map on the arcs and
  1207   /// digraph, i.e. a digraph with a \e capacity map on the arcs and
  1208   /// \e source and \e target nodes. This digraph can be read with the
  1208   /// \e source and \e target nodes. This digraph can be read with the
  1209   /// following code:
  1209   /// following code:
  1254     return tmp;
  1254     return tmp;
  1255   }
  1255   }
  1256 
  1256 
  1257   template <typename GR>
  1257   template <typename GR>
  1258   class GraphReader;
  1258   class GraphReader;
  1259  
  1259 
  1260   template <typename TGR>
  1260   template <typename TGR>
  1261   GraphReader<TGR> graphReader(TGR& graph, std::istream& is = std::cin);
  1261   GraphReader<TGR> graphReader(TGR& graph, std::istream& is = std::cin);
  1262   template <typename TGR>
  1262   template <typename TGR>
  1263   GraphReader<TGR> graphReader(TGR& graph, const std::string& fn);
  1263   GraphReader<TGR> graphReader(TGR& graph, const std::string& fn);
  1264   template <typename TGR>
  1264   template <typename TGR>
  1391 
  1391 
  1392   private:
  1392   private:
  1393     template <typename TGR>
  1393     template <typename TGR>
  1394     friend GraphReader<TGR> graphReader(TGR& graph, std::istream& is);
  1394     friend GraphReader<TGR> graphReader(TGR& graph, std::istream& is);
  1395     template <typename TGR>
  1395     template <typename TGR>
  1396     friend GraphReader<TGR> graphReader(TGR& graph, const std::string& fn); 
  1396     friend GraphReader<TGR> graphReader(TGR& graph, const std::string& fn);
  1397     template <typename TGR>
  1397     template <typename TGR>
  1398     friend GraphReader<TGR> graphReader(TGR& graph, const char *fn);
  1398     friend GraphReader<TGR> graphReader(TGR& graph, const char *fn);
  1399 
  1399 
  1400     GraphReader(GraphReader& other)
  1400     GraphReader(GraphReader& other)
  1401       : _is(other._is), local_is(other.local_is), _graph(other._graph),
  1401       : _is(other._is), local_is(other.local_is), _graph(other._graph),
  2075 
  2075 
  2076   /// \ingroup lemon_io
  2076   /// \ingroup lemon_io
  2077   ///
  2077   ///
  2078   /// \brief Return a \ref GraphReader class
  2078   /// \brief Return a \ref GraphReader class
  2079   ///
  2079   ///
  2080   /// This function just returns a \ref GraphReader class. 
  2080   /// This function just returns a \ref GraphReader class.
  2081   ///
  2081   ///
  2082   /// With this function a graph can be read from an 
  2082   /// With this function a graph can be read from an
  2083   /// \ref lgf-format "LGF" file or input stream with several maps and
  2083   /// \ref lgf-format "LGF" file or input stream with several maps and
  2084   /// attributes. For example, there is weighted matching problem on a
  2084   /// attributes. For example, there is weighted matching problem on a
  2085   /// graph, i.e. a graph with a \e weight map on the edges. This
  2085   /// graph, i.e. a graph with a \e weight map on the edges. This
  2086   /// graph can be read with the following code:
  2086   /// graph can be read with the following code:
  2087   ///
  2087   ///
  2233     /// parameter. At the reading process, each line of the section
  2233     /// parameter. At the reading process, each line of the section
  2234     /// will be given to the functor object. However, the empty lines
  2234     /// will be given to the functor object. However, the empty lines
  2235     /// and the comment lines are filtered out, and the leading
  2235     /// and the comment lines are filtered out, and the leading
  2236     /// whitespaces are trimmed from each processed string.
  2236     /// whitespaces are trimmed from each processed string.
  2237     ///
  2237     ///
  2238     /// For example let's see a section, which contain several
  2238     /// For example, let's see a section, which contain several
  2239     /// integers, which should be inserted into a vector.
  2239     /// integers, which should be inserted into a vector.
  2240     ///\code
  2240     ///\code
  2241     ///  @numbers
  2241     ///  @numbers
  2242     ///  12 45 23
  2242     ///  12 45 23
  2243     ///  4
  2243     ///  4