lemon/lgf_writer.h
changeset 1013 f6f6896a4724
parent 599 f63e87b9748e
child 1024 b84e68af8248
equal deleted inserted replaced
32:55fd21a873b3 33:c9d004303b79
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     2  *
     2  *
     3  * This file is a part of LEMON, a generic C++ optimization library.
     3  * This file is a part of LEMON, a generic C++ optimization library.
     4  *
     4  *
     5  * Copyright (C) 2003-2009
     5  * Copyright (C) 2003-2010
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     8  *
     8  *
     9  * Permission to use, modify and distribute this software is granted
     9  * Permission to use, modify and distribute this software is granted
    10  * provided that this copyright notice appears in all copies. For
    10  * provided that this copyright notice appears in all copies. For
   349 
   349 
   350   template <typename DGR>
   350   template <typename DGR>
   351   class DigraphWriter;
   351   class DigraphWriter;
   352 
   352 
   353   template <typename TDGR>
   353   template <typename TDGR>
   354   DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, 
   354   DigraphWriter<TDGR> digraphWriter(const TDGR& digraph,
   355                                    std::ostream& os = std::cout);
   355                                    std::ostream& os = std::cout);
   356   template <typename TDGR>
   356   template <typename TDGR>
   357   DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, const std::string& fn);
   357   DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, const std::string& fn);
   358 
   358 
   359   template <typename TDGR>
   359   template <typename TDGR>
   502     }
   502     }
   503 
   503 
   504   private:
   504   private:
   505 
   505 
   506     template <typename TDGR>
   506     template <typename TDGR>
   507     friend DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, 
   507     friend DigraphWriter<TDGR> digraphWriter(const TDGR& digraph,
   508                                              std::ostream& os);
   508                                              std::ostream& os);
   509     template <typename TDGR>
   509     template <typename TDGR>
   510     friend DigraphWriter<TDGR> digraphWriter(const TDGR& digraph,
   510     friend DigraphWriter<TDGR> digraphWriter(const TDGR& digraph,
   511                                              const std::string& fn);
   511                                              const std::string& fn);
   512     template <typename TDGR>
   512     template <typename TDGR>
   915 
   915 
   916   /// \ingroup lemon_io
   916   /// \ingroup lemon_io
   917   ///
   917   ///
   918   /// \brief Return a \ref DigraphWriter class
   918   /// \brief Return a \ref DigraphWriter class
   919   ///
   919   ///
   920   /// This function just returns a \ref DigraphWriter class. 
   920   /// This function just returns a \ref DigraphWriter class.
   921   ///
   921   ///
   922   /// With this function a digraph can be write to a file or output
   922   /// With this function a digraph can be write to a file or output
   923   /// stream in \ref lgf-format "LGF" format with several maps and
   923   /// stream in \ref lgf-format "LGF" format with several maps and
   924   /// attributes. For example, with the following code a network flow
   924   /// attributes. For example, with the following code a network flow
   925   /// problem can be written to the standard output, i.e. a digraph
   925   /// problem can be written to the standard output, i.e. a digraph
   955   ///
   955   ///
   956   /// This function just returns a \ref DigraphWriter class.
   956   /// This function just returns a \ref DigraphWriter class.
   957   /// \relates DigraphWriter
   957   /// \relates DigraphWriter
   958   /// \sa digraphWriter(const TDGR& digraph, std::ostream& os)
   958   /// \sa digraphWriter(const TDGR& digraph, std::ostream& os)
   959   template <typename TDGR>
   959   template <typename TDGR>
   960   DigraphWriter<TDGR> digraphWriter(const TDGR& digraph, 
   960   DigraphWriter<TDGR> digraphWriter(const TDGR& digraph,
   961                                     const std::string& fn) {
   961                                     const std::string& fn) {
   962     DigraphWriter<TDGR> tmp(digraph, fn);
   962     DigraphWriter<TDGR> tmp(digraph, fn);
   963     return tmp;
   963     return tmp;
   964   }
   964   }
   965 
   965 
  1099   private:
  1099   private:
  1100 
  1100 
  1101     template <typename TGR>
  1101     template <typename TGR>
  1102     friend GraphWriter<TGR> graphWriter(const TGR& graph, std::ostream& os);
  1102     friend GraphWriter<TGR> graphWriter(const TGR& graph, std::ostream& os);
  1103     template <typename TGR>
  1103     template <typename TGR>
  1104     friend GraphWriter<TGR> graphWriter(const TGR& graph, 
  1104     friend GraphWriter<TGR> graphWriter(const TGR& graph,
  1105                                         const std::string& fn);
  1105                                         const std::string& fn);
  1106     template <typename TGR>
  1106     template <typename TGR>
  1107     friend GraphWriter<TGR> graphWriter(const TGR& graph, const char *fn);
  1107     friend GraphWriter<TGR> graphWriter(const TGR& graph, const char *fn);
  1108     
  1108 
  1109     GraphWriter(GraphWriter& other)
  1109     GraphWriter(GraphWriter& other)
  1110       : _os(other._os), local_os(other.local_os), _graph(other._graph),
  1110       : _os(other._os), local_os(other.local_os), _graph(other._graph),
  1111         _skip_nodes(other._skip_nodes), _skip_edges(other._skip_edges) {
  1111         _skip_nodes(other._skip_nodes), _skip_edges(other._skip_edges) {
  1112 
  1112 
  1113       other._os = 0;
  1113       other._os = 0;
  1554 
  1554 
  1555   /// \ingroup lemon_io
  1555   /// \ingroup lemon_io
  1556   ///
  1556   ///
  1557   /// \brief Return a \ref GraphWriter class
  1557   /// \brief Return a \ref GraphWriter class
  1558   ///
  1558   ///
  1559   /// This function just returns a \ref GraphWriter class. 
  1559   /// This function just returns a \ref GraphWriter class.
  1560   ///
  1560   ///
  1561   /// With this function a graph can be write to a file or output
  1561   /// With this function a graph can be write to a file or output
  1562   /// stream in \ref lgf-format "LGF" format with several maps and
  1562   /// stream in \ref lgf-format "LGF" format with several maps and
  1563   /// attributes. For example, with the following code a weighted
  1563   /// attributes. For example, with the following code a weighted
  1564   /// matching problem can be written to the standard output, i.e. a
  1564   /// matching problem can be written to the standard output, i.e. a