COIN-OR::LEMON - Graph Library

Ticket #35: lgf_doc.patch

File lgf_doc.patch, 28.7 KB (added by Balazs Dezso, 17 years ago)
  • doc/groups.dox

    # HG changeset patch
    # User Balazs Dezso <deba@inf.elte.hu>
    # Date 1210797907 -7200
    # Node ID a765b4ecbcdbd5e8ac0fc55beecf585ebb481b15
    # Parent  5c3604513ed0256e35e5fd50c54cd0e37362397e
    Fixing token usage and documention is LGF IO
    
    diff -r 5c3604513ed0 -r a765b4ecbcdb doc/groups.dox
    a b  
    483483*/
    484484
    485485/**
    486 @defgroup section_io Section readers and writers
    487 @ingroup lemon_io
    488 \brief Section readers and writers for LEMON Input-Output.
    489 
    490 This group describes section reader and writer classes that can be
    491 attached to \ref LemonReader and \ref LemonWriter.
    492 */
    493 
    494 /**
    495 @defgroup item_io Item readers and writers
    496 @ingroup lemon_io
    497 \brief Item readers and writers for LEMON Input-Output.
    498 
    499 This group describes reader and writer classes for various data types
    500 (e.g. map or attribute values). These classes can be attached to
    501 \ref LemonReader and \ref LemonWriter.
    502 */
    503 
    504 /**
    505486@defgroup eps_io Postscript exporting
    506487@ingroup io_group
    507488\brief General \c EPS drawer and graph exporter
  • lemon/lgf_reader.h

    diff -r 5c3604513ed0 -r a765b4ecbcdb lemon/lgf_reader.h
    a b  
    268268      str = os.str();
    269269      return is;
    270270    }
    271 
    272     std::istream& readIdentifier(std::istream& is, std::string& str) {
    273       std::ostringstream os;
    274 
    275       char c;
    276       is >> std::ws;
    277      
    278       if (!is.get(c))
    279         return is;
    280 
    281       if (!isIdentifierFirstChar(c))
    282         throw DataFormatError("Wrong char in identifier");
    283      
    284       os << c;
    285      
    286       while (is.get(c) && !isWhiteSpace(c)) {
    287         if (!isIdentifierChar(c))
    288           throw DataFormatError("Wrong char in identifier");     
    289         os << c;
    290       }
    291       if (!is) is.clear();
    292      
    293       str = os.str();
    294       return is;
    295     }
    296271   
    297272  }
    298  
    299   /// \e
     273
     274  /// \ingroup lemon_io
     275  /// 
     276  /// \brief LGF reader for directed graphs
     277  ///
     278  /// The \e LGF (LEMON graph file) format is the default file format
     279  /// of the LEMON library. It is a text based, section oriented
     280  /// format, which defines some standard sections for storing graphs
     281  /// in text files. Each line with \c '#' first non-whitespace
     282  /// character is considered as a comment line. Each section starts with
     283  /// a header line, these lines starts with \c '@' character and the
     284  /// name of section type.  The standard sections are \c \@nodes, \c
     285  /// \@arcs and \c \@edges (these two names are completely equivalent)
     286  /// and \@attributes. Each header line may also have an optional
     287  /// name, which can be use to distinguish the sections of the same
     288  /// type.
     289  ///
     290  /// The \@nodes section describes a set of nodes and associated
     291  /// maps. The first is a header line consisting of the names of the
     292  /// maps, each of them is a plain or quoted token. A plain token is
     293  /// a sequence of non-whitespace characters, and a quoted token is a
     294  /// character sequence surrounded by double quotes, and the sequence
     295  /// may contain escape sequences. One of the maps must be called \c
     296  /// "label", which plays special role in the file.  Each following
     297  /// non-empty line until the next section describes a node in the
     298  /// graph. These lines contain the values of the node maps
     299  /// associated to the current node, each value is also plain or
     300  /// quoted token.
     301  ///
     302  /// The \c \@arcs section is very similar to the \c \@nodes section,
     303  /// it starts with a header line consists from the names of the arc
     304  /// maps, the \c "label" map is also necessary. The following lines
     305  /// contain the description of the arcs. The first two tokens are
     306  /// the source and the target node of the edge, then comes the map
     307  /// values. The source and target tokens must be node labels.
     308  ///
     309  /// The \c \@attributes section contains key-value pairs, each line
     310  /// starts with an attribute nome, and then an attribute value. Both
     311  /// of them are plain or quoted tokens, but the value could be also
     312  /// a node or an arc label.
     313  ///
     314  ///\code
     315  /// @nodes
     316  /// label   coordinates size    title
     317  /// 1       (10,20)     10      "First node"
     318  /// 2       (80,80)     8       "Second node"
     319  /// 3       (40,10)     10      "Third node"
     320  /// @arcs
     321  ///         capacity
     322  /// 1   2   16
     323  /// 1   3   12
     324  /// 2   3   18
     325  /// @attributes
     326  /// source 1
     327  /// target 3
     328  /// caption "LEMON test digraph"
     329  ///\endcode
     330  ///
     331  /// The writing method does a batch processing. The user creates a
     332  /// writer object, then several writing rules can be added to the
     333  /// writer, and eventually the writing is executed with the \c run()
     334  /// member function. A map writing rule can be added to the writer
     335  /// with the \c nodeMap() or \c arcMap() members. The optional
     336  /// converter parameter can be a standard functor, which converts an
     337  /// the value type of the map to std::string, if it is set, it
     338  /// determines how the the map's value type is written to the output
     339  /// stream. If the functor is not set, then a default conversion
     340  /// will be used. The \c attribute(), \c node() and \c arc() functions
     341  /// are used to add attribute writing rules.
     342  ///
     343  ///\code
     344  ///     DigraphWriter<Digraph>(std::cout, digraph).
     345  ///       nodeMap("coordinates", coord_map).
     346  ///       nodeMap("size", size).
     347  ///       nodeMap("title", title).
     348  ///       arcMap("capacity", cap_map).
     349  ///       node("source", src).
     350  ///       node("target", trg).
     351  ///       attribute("caption", caption).
     352  ///       run();
     353  ///\endcode
     354  ///
     355  /// By default the writer uses the first section in the file of the
     356  /// proper type. If a section has an optional name, then it can be
     357  /// selected to write with the \c nodes(), \c arcs() or \c attributes()
     358  /// functions.
     359  ///
     360  /// The \c useNodes() and \c useArcs() functions are used to specify
     361  /// that the nodes or arcs should not be constructed(added to the
     362  /// graph) during the reading, the argument of these functions is a
     363  /// node map or arc map determining the label map for the items. An
     364  /// application of these function is the multipass reading, which is
     365  /// important if two \e \@arcs sections should be read from the
     366  /// file. In this example the first phase reads the node set and one
     367  /// of the arc set, while the second phase will read the second arc
     368  /// set into an \e ArcSet class (\c SmartArcSet or \c ListArcSet),
     369  /// the previously read label node map should be given to the \c
     370  /// useNodes() functions. An other multipass application is reading
     371  /// paths into a node map or an arc map. It is impossible in
     372  /// single pass, because the arcs are not constructed when the node
     373  /// maps are read.
    300374  template <typename _Digraph>
    301375  class DigraphReader {
    302376  public:
     
    341415
    342416  public:
    343417
    344     /// \e
     418    /// \brief Constructor
     419    ///
     420    /// Construct a directed graph reader, which reads from the given
     421    /// input stream.
    345422    DigraphReader(std::istream& is, Digraph& digraph)
    346423      : _is(&is), local_is(false), _digraph(digraph),
    347424        _use_nodes(false), _use_arcs(false) {}
    348425
    349     /// \e
     426    /// \brief Constructor
     427    ///
     428    /// Construct a directed graph reader, which reads from the given
     429    /// file.
    350430    DigraphReader(const std::string& fn, Digraph& digraph)
    351431      : _is(new std::ifstream(fn.c_str())), local_is(true), _digraph(digraph),
    352432        _use_nodes(false), _use_arcs(false) {}
    353 
    354 
    355     /// \e
     433   
     434    /// \brief Constructor
     435    ///
     436    /// Construct a directed graph reader, which reads from the given
     437    /// file.
    356438    DigraphReader(const char* fn, Digraph& digraph)
    357439      : _is(new std::ifstream(fn)), local_is(true), _digraph(digraph),
    358440        _use_nodes(false), _use_arcs(false) {}
    359441
    360     /// \e
     442    /// \brief Copy constructor
     443    ///
     444    /// The copy constructor transfers all data from the other reader,
     445    /// therefore the copied reader will not be useable more.
    361446    DigraphReader(DigraphReader& other)
    362447      : _is(other._is), local_is(other.local_is), _digraph(other._digraph),
    363448        _use_nodes(other._use_nodes), _use_arcs(other._use_arcs) {
     
    377462      _attributes_caption = other._attributes_caption;
    378463    }
    379464
    380     /// \e
     465    /// \brief Destructor
    381466    ~DigraphReader() {
    382467      for (typename NodeMaps::iterator it = _node_maps.begin();
    383468           it != _node_maps.end(); ++it) {
     
    406491
    407492  public:
    408493
    409     /// \e
     494    /// \name Reading rules
     495    /// @{
     496   
     497    /// \brief Node map reading rule
     498    ///
     499    /// Add a node map reading rule to the reader.
    410500    template <typename Map>
    411501    DigraphReader& nodeMap(const std::string& caption, Map& map) {
    412502      checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
     
    416506      return *this;
    417507    }
    418508
    419     /// \e
     509    /// \brief Node map reading rule
     510    ///
     511    /// Add a node map reading rule with specialized converter to the
     512    /// reader.
    420513    template <typename Map, typename Converter>
    421514    DigraphReader& nodeMap(const std::string& caption, Map& map,
    422515                           const Converter& converter = Converter()) {
     
    427520      return *this;
    428521    }
    429522
    430     /// \e
     523    /// \brief Arc map reading rule
     524    ///
     525    /// Add an arc map reading rule to the reader.
    431526    template <typename Map>
    432527    DigraphReader& arcMap(const std::string& caption, Map& map) {
    433528      checkConcept<concepts::WriteMap<Arc, typename Map::Value>, Map>();
     
    437532      return *this;
    438533    }
    439534
    440     /// \e
     535    /// \brief Arc map reading rule
     536    ///
     537    /// Add an arc map reading rule with specialized converter to the
     538    /// reader.
    441539    template <typename Map, typename Converter>
    442540    DigraphReader& arcMap(const std::string& caption, Map& map,
    443541                          const Converter& converter = Converter()) {
     
    448546      return *this;
    449547    }
    450548
    451     /// \e
     549    /// \brief Attribute reading rule
     550    ///
     551    /// Add an attribute reading rule to the reader.
    452552    template <typename Value>
    453553    DigraphReader& attribute(const std::string& caption, Value& value) {
    454554      _reader_bits::ValueStorageBase* storage =
     
    457557      return *this;
    458558    }
    459559
    460     /// \e
     560    /// \brief Attribute reading rule
     561    ///
     562    /// Add an attribute reading rule with specialized converter to the
     563    /// reader.
    461564    template <typename Value, typename Converter>
    462565    DigraphReader& attribute(const std::string& caption, Value& value,
    463566                             const Converter& converter = Converter()) {
     
    467570      return *this;
    468571    }
    469572
    470     /// \e
     573    /// \brief Node reading rule
     574    ///
     575    /// Add a node reading rule to reader.
    471576    DigraphReader& node(const std::string& caption, Node& node) {
    472577      typedef _reader_bits::MapLookUpConverter<Node> Converter;
    473578      Converter converter(_node_index);
     
    477582      return *this;
    478583    }
    479584
    480     /// \e
     585    /// \brief Arc reading rule
     586    ///
     587    /// Add an arc reading rule to reader.
    481588    DigraphReader& arc(const std::string& caption, Arc& arc) {
    482589      typedef _reader_bits::MapLookUpConverter<Arc> Converter;
    483590      Converter converter(_arc_index);
     
    487594      return *this;
    488595    }
    489596
    490     /// \e
     597    /// @}
     598
     599    /// \name Select section by name
     600    /// @{
     601
     602    /// \brief Set \c \@nodes section to be read
     603    ///
     604    /// Set \c \@nodes section to be read
    491605    DigraphReader& nodes(const std::string& caption) {
    492606      _nodes_caption = caption;
    493607      return *this;
    494608    }
    495609
    496     /// \e
     610    /// \brief Set \c \@arcs section to be read
     611    ///
     612    /// Set \c \@arcs section to be read
    497613    DigraphReader& arcs(const std::string& caption) {
    498614      _arcs_caption = caption;
    499615      return *this;
    500616    }
    501617
    502     /// \e
     618    /// \brief Set \c \@attributes section to be read
     619    ///
     620    /// Set \c \@attributes section to be read
    503621    DigraphReader& attributes(const std::string& caption) {
    504622      _attributes_caption = caption;
    505623      return *this;
    506624    }
    507625
    508     /// \e
     626    /// @}
     627
     628    /// \name Using previously constructed node or arc set
     629    /// @{
     630
     631    /// \brief Use previously constructed node set
     632    ///
     633    /// Use previously constructed node set, and specify the node
     634    /// label map.
    509635    template <typename Map>
    510636    DigraphReader& useNodes(const Map& map) {
    511637      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
     
    518644      return *this;
    519645    }
    520646
    521     /// \e
     647    /// \brief Use previously constructed node set
     648    ///
     649    /// Use previously constructed node set, and specify the node
     650    /// label map and a functor which converts the label map values to
     651    /// std::string.
    522652    template <typename Map, typename Converter>
    523653    DigraphReader& useNodes(const Map& map,
    524654                            const Converter& converter = Converter()) {
     
    531661      return *this;
    532662    }
    533663
    534     /// \e
     664    /// \brief Use previously constructed arc set
     665    ///
     666    /// Use previously constructed arc set, and specify the arc
     667    /// label map.
    535668    template <typename Map>
    536669    DigraphReader& useArcs(const Map& map) {
    537670      checkConcept<concepts::ReadMap<Arc, typename Map::Value>, Map>();
     
    544677      return *this;
    545678    }
    546679
    547     /// \e
     680    /// \brief Use previously constructed arc set
     681    ///
     682    /// Use previously constructed arc set, and specify the arc
     683    /// label map and a functor which converts the label map values to
     684    /// std::string.
    548685    template <typename Map, typename Converter>
    549686    DigraphReader& useArcs(const Map& map,
    550687                            const Converter& converter = Converter()) {
     
    556693      }
    557694      return *this;
    558695    }
     696
     697    /// @}
    559698
    560699  private:
    561700
     
    597736       
    598737        std::string map;
    599738        int index = 0;
    600         while (_reader_bits::readIdentifier(line, map)) {
     739        while (_reader_bits::readToken(line, map)) {
    601740          if (maps.find(map) != maps.end()) {
    602741            std::ostringstream msg;
    603742            msg << "Multiple occurence of node map: " << map;
     
    680819       
    681820        std::string map;
    682821        int index = 0;
    683         while (_reader_bits::readIdentifier(line, map)) {
     822        while (_reader_bits::readToken(line, map)) {
    684823          if (maps.find(map) != maps.end()) {
    685824            std::ostringstream msg;
    686825            msg << "Multiple occurence of arc map: " << map;
     
    787926        line.putback(c);
    788927       
    789928        std::string attr, token;
    790         if (!_reader_bits::readIdentifier(line, attr))
     929        if (!_reader_bits::readToken(line, attr))
    791930          throw DataFormatError("Attribute name not found");
    792931        if (!_reader_bits::readToken(line, token))
    793932          throw DataFormatError("Attribute value not found");
     
    827966    }
    828967
    829968  public:
    830    
    831     /// \e
     969
     970    /// \name Execution of the reader   
     971    /// @{
     972
     973    /// \brief Start the batch processing
     974    ///
     975    /// This function starts the batch processing
    832976    void run() {
    833977     
    834978      LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
     
    846990          char c;
    847991          std::string section, caption;
    848992          line >> c;
    849           _reader_bits::readIdentifier(line, section);
    850           _reader_bits::readIdentifier(line, caption);
     993          _reader_bits::readToken(line, section);
     994          _reader_bits::readToken(line, caption);
    851995
    852996          if (line >> c)
    853997            throw DataFormatError("Extra character on the end of line");
     
    8911035      }
    8921036
    8931037    }
     1038
     1039    /// @}
    8941040   
    8951041  };
    8961042
     1043  /// \relates DigraphReader
    8971044  template <typename Digraph>
    8981045  DigraphReader<Digraph> digraphReader(std::istream& is, Digraph& digraph) {
    8991046    return DigraphReader<Digraph>(is, digraph);
    9001047  }
    9011048
     1049  /// \relates DigraphReader
    9021050  template <typename Digraph>
    9031051  DigraphReader<Digraph> digraphReader(const std::string& fn,
    9041052                                       Digraph& digraph) {
    9051053    return DigraphReader<Digraph>(fn, digraph);
    9061054  }
    9071055
     1056  /// \relates DigraphReader
    9081057  template <typename Digraph>
    9091058  DigraphReader<Digraph> digraphReader(const char* fn, Digraph& digraph) {
    9101059    return DigraphReader<Digraph>(fn, digraph);
  • lemon/lgf_writer.h

    diff -r 5c3604513ed0 -r a765b4ecbcdb lemon/lgf_writer.h
    a b  
    204204    }
    205205
    206206    bool requireEscape(const std::string& str) {
     207      if (str.empty() || str[0] == '@') return true;
    207208      std::istringstream is(str);
    208209      char c;
    209210      while (is.get(c)) {
     
    231232
    232233  }
    233234 
    234   /// \e
     235  /// \ingroup lemon_io
     236  /// 
     237  /// \brief LGF writer for directed graphs
     238  ///
     239  /// The \e LGF (LEMON graph file) format is the default file format
     240  /// of the LEMON library. It is a text based, section oriented
     241  /// format, which defines some standard sections for storing graphs
     242  /// in text files. Each line with \c '#' first non-whitespace
     243  /// character is considered as a comment line. Each section starts with
     244  /// a header line, these lines starts with \c '@' character and the
     245  /// name of section type.  The standard sections are \c \@nodes, \c
     246  /// \@arcs and \c \@edges (these two names are completely equivalent)
     247  /// and \@attributes. Each header line may also have an optional
     248  /// name, which can be use to distinguish the sections of the same
     249  /// type.
     250  ///
     251  /// The \@nodes section describes a set of nodes and associated
     252  /// maps. The first is a header line consisting of the names of the
     253  /// maps, each of them is a plain or quoted token. A plain token is
     254  /// a sequence of non-whitespace characters, and a quoted token is a
     255  /// character sequence surrounded by double quotes, and the sequence
     256  /// may contain escape sequences. One of the maps must be called \c
     257  /// "label", which plays special role in the file.  Each following
     258  /// non-empty line until the next section describes a node in the
     259  /// graph. These lines contain the values of the node maps
     260  /// associated to the current node, each value is also plain or
     261  /// quoted token.
     262  ///
     263  /// The \c \@arcs section is very similar to the \c \@nodes section,
     264  /// it starts with a header line consists from the names of the arc
     265  /// maps, the \c "label" map is also necessary. The following lines
     266  /// contain the description of the arcs. The first two tokens are
     267  /// the source and the target node of the edge, then comes the map
     268  /// values. The source and target tokens must be node labels.
     269  ///
     270  /// The \c \@attributes section contains key-value pairs, each line
     271  /// starts with an attribute nome, and then an attribute value. Both
     272  /// of them are plain or quoted tokens, but the value could be also
     273  /// a node or an arc label.
     274  ///
     275  ///\code
     276  /// @nodes
     277  /// label   coordinates size    title
     278  /// 1       (10,20)     10      "First node"
     279  /// 2       (80,80)     8       "Second node"
     280  /// 3       (40,10)     10      "Third node"
     281  /// @arcs
     282  ///         capacity
     283  /// 1   2   16
     284  /// 1   3   12
     285  /// 2   3   18
     286  /// @attributes
     287  /// source 1
     288  /// target 3
     289  /// caption "LEMON test digraph"
     290  ///\endcode
     291  ///
     292  /// The reading method does a batch processing. The user creates a
     293  /// writer object, then several reading rules can be added to the
     294  /// writer, and eventually the reading is executed with the \c run()
     295  /// member function. A map reading rule can be added to the writer
     296  /// with the \c nodeMap() or \c arcMap() members. The optional
     297  /// converter parameter can be a standard functor, which converts an
     298  /// std::string to the value type of the map, if it is set, it
     299  /// determines how the read string literal is converted to the map's
     300  /// value type. If the functor is not set, then a default conversion
     301  /// will be used. One map can be read in multiple map objects at the
     302  /// same time. The \c attribute(), \c node() and \c arc() functions
     303  /// are used to add attribute reading rules.
     304  ///
     305  ///\code
     306  ///     DigraphWriter<Digraph>(std::cin, digraph).
     307  ///       nodeMap("coordinates", coord_map).
     308  ///       arcMap("capacity", cap_map).
     309  ///       node("source", src).
     310  ///       node("target", trg).
     311  ///       attribute("caption", caption).
     312  ///       run();
     313  ///\endcode
     314  ///
     315  /// By default the writer does not write additional captions to the
     316  /// section, but they can added with the \c nodes(), \c arcs() or \c
     317  /// attributes() functions.
     318  ///
     319  /// The \c skipNodes() and \c skipArcs() functions forbid the
     320  /// writing of the sections. If two arc sections should write to the
     321  /// output, it can be made in two passes, the first pass writes the
     322  /// node section and the first arc section, then the second pass
     323  /// skips the node section and writes just the arc section to the
     324  /// stream. The output stream can be retrieved with the \c ostream()
     325  /// function, hence the second pass can append the output of the
     326  /// first pass.
    235327  template <typename _Digraph>
    236328  class DigraphWriter {
    237329  public:
     
    273365
    274366  public:
    275367
    276     /// \e
     368    /// \brief Constructor
     369    ///
     370    /// Construct a directed graph writer, which writes to the given
     371    /// output stream.
    277372    DigraphWriter(std::ostream& is, Digraph& digraph)
    278373      : _os(&is), local_os(false), _digraph(digraph),
    279374        _skip_nodes(false), _skip_arcs(false) {}
    280375
    281     /// \e
     376    /// \brief Constructor
     377    ///
     378    /// Construct a directed graph writer, which writes to the given
     379    /// output file.
    282380    DigraphWriter(const std::string& fn, Digraph& digraph)
    283381      : _os(new std::ofstream(fn.c_str())), local_os(true), _digraph(digraph),
    284382        _skip_nodes(false), _skip_arcs(false) {}
    285383
    286     /// \e
     384    /// \brief Constructor
     385    ///
     386    /// Construct a directed graph writer, which writes to the given
     387    /// output file.
    287388    DigraphWriter(const char* fn, Digraph& digraph)
    288389      : _os(new std::ofstream(fn)), local_os(true), _digraph(digraph),
    289390        _skip_nodes(false), _skip_arcs(false) {}
    290391
     392    /// \brief Copy constructor
     393    ///
     394    /// The copy constructor transfers all data from the other writer,
     395    /// therefore the copied writer will not be useable more.
    291396    DigraphWriter(DigraphWriter& other)
    292397      : _os(other._os), local_os(other.local_os), _digraph(other._digraph),
    293398        _skip_nodes(other._skip_nodes), _skip_arcs(other._skip_arcs) {
     
    307412      _attributes_caption = other._attributes_caption;
    308413    }
    309414
    310     /// \e
     415    /// \brief Destructor
    311416    ~DigraphWriter() {
    312417      for (typename NodeMaps::iterator it = _node_maps.begin();
    313418           it != _node_maps.end(); ++it) {
     
    335440
    336441  public:
    337442
    338     /// \e
     443    /// \name Writing rules
     444    /// @{
     445   
     446    /// \brief Node map reading rule
     447    ///
     448    /// Add a node map reading rule to the writer.
    339449    template <typename Map>
    340450    DigraphWriter& nodeMap(const std::string& caption, const Map& map) {
    341451      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
     
    345455      return *this;
    346456    }
    347457
    348     /// \e
     458    /// \brief Node map writing rule
     459    ///
     460    /// Add a node map writing rule with specialized converter to the
     461    /// writer.
    349462    template <typename Map, typename Converter>
    350463    DigraphWriter& nodeMap(const std::string& caption, const Map& map,
    351464                           const Converter& converter = Converter()) {
     
    356469      return *this;
    357470    }
    358471
    359     /// \e
     472    /// \brief Arc map writing rule
     473    ///
     474    /// Add an arc map writing rule to the writer.
    360475    template <typename Map>
    361476    DigraphWriter& arcMap(const std::string& caption, const Map& map) {
    362477      checkConcept<concepts::ReadMap<Arc, typename Map::Value>, Map>();
     
    366481      return *this;
    367482    }
    368483
    369     /// \e
     484    /// \brief Arc map writing rule
     485    ///
     486    /// Add an arc map writing rule with specialized converter to the
     487    /// writer.
    370488    template <typename Map, typename Converter>
    371489    DigraphWriter& arcMap(const std::string& caption, const Map& map,
    372490                          const Converter& converter = Converter()) {
     
    377495      return *this;
    378496    }
    379497
    380     /// \e
     498    /// \brief Attribute writing rule
     499    ///
     500    /// Add an attribute writing rule to the writer.
    381501    template <typename Value>
    382502    DigraphWriter& attribute(const std::string& caption, const Value& value) {
    383503      _writer_bits::ValueStorageBase* storage =
     
    386506      return *this;
    387507    }
    388508
    389     /// \e
     509    /// \brief Attribute writing rule
     510    ///
     511    /// Add an attribute writing rule with specialized converter to the
     512    /// writer.
    390513    template <typename Value, typename Converter>
    391514    DigraphWriter& attribute(const std::string& caption, const Value& value,
    392515                             const Converter& converter = Converter()) {
     
    396519      return *this;
    397520    }
    398521
    399     /// \e
     522    /// \brief Node writing rule
     523    ///
     524    /// Add a node writing rule to the writer.
    400525    DigraphWriter& node(const std::string& caption, const Node& node) {
    401526      typedef _writer_bits::MapLookUpConverter<Node> Converter;
    402527      Converter converter(_node_index);
     
    406531      return *this;
    407532    }
    408533
    409     /// \e
     534    /// \brief Arc writing rule
     535    ///
     536    /// Add an arc writing rule to writer.
    410537    DigraphWriter& arc(const std::string& caption, const Arc& arc) {
    411538      typedef _writer_bits::MapLookUpConverter<Arc> Converter;
    412539      Converter converter(_arc_index);
     
    416543      return *this;
    417544    }
    418545
    419     /// \e
     546    /// \name Select section by name
     547    /// @{
     548
     549    /// \brief Set \c \@nodes section to be read
     550    ///
     551    /// Set \c \@nodes section to be read
    420552    DigraphWriter& nodes(const std::string& caption) {
    421553      _nodes_caption = caption;
    422554      return *this;
    423555    }
    424556
    425     /// \e
     557    /// \brief Set \c \@arcs section to be read
     558    ///
     559    /// Set \c \@arcs section to be read
    426560    DigraphWriter& arcs(const std::string& caption) {
    427561      _arcs_caption = caption;
    428562      return *this;
    429563    }
    430564
    431     /// \e
     565    /// \brief Set \c \@attributes section to be read
     566    ///
     567    /// Set \c \@attributes section to be read
    432568    DigraphWriter& attributes(const std::string& caption) {
    433569      _attributes_caption = caption;
    434570      return *this;
    435571    }
    436572
     573    /// \name Skipping section
     574    /// @{
     575
     576    /// \brief Skip writing the node set
     577    ///
     578    /// The \c \@nodes section will be not written to the stream.
    437579    DigraphWriter& skipNodes() {
    438580      LEMON_ASSERT(!_skip_nodes, "Multiple usage of skipNodes() member");
    439581      return *this;
    440582    }
    441583
     584    /// \brief Skip writing arc set
     585    ///
     586    /// The \c \@arcs section will be not written to the stream.
    442587    DigraphWriter& skipArcs() {
    443588      LEMON_ASSERT(!_skip_arcs, "Multiple usage of skipArcs() member");
    444589      return *this;
    445590    }
     591
     592    /// @}
    446593
    447594  private:
    448595
     
    458605
    459606      *_os << "@nodes";
    460607      if (!_nodes_caption.empty()) {
    461         *_os << ' ' << _nodes_caption;
     608        _writer_bits::writeToken(*_os << ' ', _nodes_caption);
    462609      }
    463610      *_os << std::endl;
    464611
     
    467614      }
    468615      for (typename NodeMaps::iterator it = _node_maps.begin();
    469616           it != _node_maps.end(); ++it) {
    470         *_os << it->first << '\t';
     617        _writer_bits::writeToken(*_os, it->first) << '\t';
    471618      }
    472619      *_os << std::endl;
    473620
     
    518665
    519666      *_os << "@arcs";
    520667      if (!_arcs_caption.empty()) {
    521         *_os << ' ' << _arcs_caption;
     668        _writer_bits::writeToken(*_os << ' ', _arcs_caption);
    522669      }
    523670      *_os << std::endl;
    524671
     
    528675      }
    529676      for (typename ArcMaps::iterator it = _arc_maps.begin();
    530677           it != _arc_maps.end(); ++it) {
    531         *_os << it->first << '\t';
     678        _writer_bits::writeToken(*_os, it->first) << '\t';
    532679      }
    533680      *_os << std::endl;
    534681
     
    577724      if (_attributes.empty()) return;
    578725      *_os << "@attributes";
    579726      if (!_attributes_caption.empty()) {
    580         *_os << ' ' << _attributes_caption;
     727        _writer_bits::writeToken(*_os << ' ', _attributes_caption);
    581728      }
    582729      *_os << std::endl;
    583730      for (typename Attributes::iterator it = _attributes.begin();
    584731           it != _attributes.end(); ++it) {
    585         *_os << it->first << ' ';
     732        _writer_bits::writeToken(*_os, it->first) << ' ';
    586733        _writer_bits::writeToken(*_os, it->second->get());
    587734        *_os << std::endl;
    588735      }
     
    590737   
    591738  public:
    592739   
    593     /// \e
     740    /// \name Execution of the writer   
     741    /// @{
     742
     743    /// \brief Start the batch processing
     744    ///
     745    /// This function starts the batch processing
    594746    void run() {
    595747      if (!_skip_nodes) {
    596748        writeNodes();
     
    601753      writeAttributes();
    602754    }
    603755
    604     /// \e
    605     std::ostream& stream() {
     756    /// \brief Gives back the stream of the writer
     757    ///
     758    /// Gives back the stream of the writer
     759    std::ostream& ostream() {
    606760      return *_os;
    607761    }
     762
     763    /// @}
    608764  };
    609765
     766  /// \relates DigraphWriter
    610767  template <typename Digraph>
    611768  DigraphWriter<Digraph> digraphWriter(std::istream& is, Digraph& digraph) {
    612769    return DigraphWriter<Digraph>(is, digraph);
    613770  }
    614771
     772  /// \relates DigraphWriter
    615773  template <typename Digraph>
    616774  DigraphWriter<Digraph> digraphWriter(const std::string& fn,
    617775                                       Digraph& digraph) {
    618776    return DigraphWriter<Digraph>(fn, digraph);
    619777  }
    620778
     779  /// \relates DigraphWriter
    621780  template <typename Digraph>
    622781  DigraphWriter<Digraph> digraphWriter(const char* fn, Digraph& digraph) {
    623782    return DigraphWriter<Digraph>(fn, digraph);