COIN-OR::LEMON - Graph Library

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/lgf_writer.h

    r190 r201  
    1919///\ingroup lemon_io
    2020///\file
    21 ///\brief Lemon Graph Format writer.
     21///\brief \ref lgf-format "Lemon Graph Format" writer.
    2222
    2323
     
    226226    };
    227227
    228     bool isWhiteSpace(char c) {
     228    inline bool isWhiteSpace(char c) {
    229229      return c == ' ' || c == '\t' || c == '\v' ||
    230230        c == '\n' || c == '\r' || c == '\f';
    231231    }
    232232
    233     bool isEscaped(char c) {
     233    inline bool isEscaped(char c) {
    234234      return c == '\\' || c == '\"' || c == '\'' ||
    235235        c == '\a' || c == '\b';
    236236    }
    237237
    238     static void writeEscape(std::ostream& os, char c) {
     238    inline static void writeEscape(std::ostream& os, char c) {
    239239      switch (c) {
    240240      case '\\':
     
    277277    }
    278278
    279     bool requireEscape(const std::string& str) {
     279    inline bool requireEscape(const std::string& str) {
    280280      if (str.empty() || str[0] == '@') return true;
    281281      std::istringstream is(str);
     
    289289    }
    290290   
    291     std::ostream& writeToken(std::ostream& os, const std::string& str) {
     291    inline std::ostream& writeToken(std::ostream& os, const std::string& str) {
    292292
    293293      if (requireEscape(str)) {
     
    323323  /// \ingroup lemon_io
    324324  /// 
    325   /// \brief LGF writer for directed graphs
     325  /// \brief \ref lgf-format "LGF" writer for directed graphs
    326326  ///
    327327  /// This utility writes an \ref lgf-format "LGF" file.
     
    333333  /// with the \c nodeMap() or \c arcMap() members. An optional
    334334  /// converter parameter can also be added as a standard functor
    335   /// converting from the value type of the map to std::string. If it
    336   /// is set, it will determine how the map's value type is written to
     335  /// converting from the value type of the map to \c std::string. If it
     336  /// is set, it will determine how the value type of the map is written to
    337337  /// the output stream. If the functor is not set, then a default
    338338  /// conversion will be used. The \c attribute(), \c node() and \c
     
    340340  ///
    341341  ///\code
    342   ///     DigraphWriter<Digraph>(std::cout, digraph).
    343   ///       nodeMap("coordinates", coord_map).
    344   ///       nodeMap("size", size).
    345   ///       nodeMap("title", title).
    346   ///       arcMap("capacity", cap_map).
    347   ///       node("source", src).
    348   ///       node("target", trg).
    349   ///       attribute("caption", caption).
    350   ///       run();
     342  /// DigraphWriter<Digraph>(std::cout, digraph).
     343  ///   nodeMap("coordinates", coord_map).
     344  ///   nodeMap("size", size).
     345  ///   nodeMap("title", title).
     346  ///   arcMap("capacity", cap_map).
     347  ///   node("source", src).
     348  ///   node("target", trg).
     349  ///   attribute("caption", caption).
     350  ///   run();
    351351  ///\endcode
    352352  ///
     
    487487    /// @{
    488488   
    489     /// \brief Node map reading rule
    490     ///
    491     /// Add a node map reading rule to the writer.
     489    /// \brief Node map writing rule
     490    ///
     491    /// Add a node map writing rule to the writer.
    492492    template <typename Map>
    493493    DigraphWriter& nodeMap(const std::string& caption, const Map& map) {
     
    587587    }
    588588
    589     /// \name Select section by name
     589    /// \name Section captions
    590590    /// @{
    591591
    592     /// \brief Set \c \@nodes section to be read
    593     ///
    594     /// Set \c \@nodes section to be read
     592    /// \brief Add an additional caption to the \c \@nodes section
     593    ///
     594    /// Add an additional caption to the \c \@nodes section.
    595595    DigraphWriter& nodes(const std::string& caption) {
    596596      _nodes_caption = caption;
     
    598598    }
    599599
    600     /// \brief Set \c \@arcs section to be read
    601     ///
    602     /// Set \c \@arcs section to be read
     600    /// \brief Add an additional caption to the \c \@arcs section
     601    ///
     602    /// Add an additional caption to the \c \@arcs section.
    603603    DigraphWriter& arcs(const std::string& caption) {
    604604      _arcs_caption = caption;
     
    606606    }
    607607
    608     /// \brief Set \c \@attributes section to be read
    609     ///
    610     /// Set \c \@attributes section to be read
     608    /// \brief Add an additional caption to the \c \@attributes section
     609    ///
     610    /// Add an additional caption to the \c \@attributes section.
    611611    DigraphWriter& attributes(const std::string& caption) {
    612612      _attributes_caption = caption;
     
    619619    /// \brief Skip writing the node set
    620620    ///
    621     /// The \c \@nodes section will be not written to the stream.
     621    /// The \c \@nodes section will not be written to the stream.
    622622    DigraphWriter& skipNodes() {
    623623      LEMON_ASSERT(!_skip_nodes, "Multiple usage of skipNodes() member");
     
    628628    /// \brief Skip writing arc set
    629629    ///
    630     /// The \c \@arcs section will be not written to the stream.
     630    /// The \c \@arcs section will not be written to the stream.
    631631    DigraphWriter& skipArcs() {
    632632      LEMON_ASSERT(!_skip_arcs, "Multiple usage of skipArcs() member");
     
    836836    /// \brief Start the batch processing
    837837    ///
    838     /// This function starts the batch processing
     838    /// This function starts the batch processing.
    839839    void run() {
    840840      if (!_skip_nodes) {
     
    851851    }
    852852
    853     /// \brief Gives back the stream of the writer
    854     ///
    855     /// Gives back the stream of the writer
     853    /// \brief Give back the stream of the writer
     854    ///
     855    /// Give back the stream of the writer.
    856856    std::ostream& ostream() {
    857857      return *_os;
     
    861861  };
    862862
     863  /// \brief Return a \ref DigraphWriter class
     864  ///
     865  /// This function just returns a \ref DigraphWriter class.
    863866  /// \relates DigraphWriter
    864867  template <typename Digraph>
     
    869872  }
    870873
     874  /// \brief Return a \ref DigraphWriter class
     875  ///
     876  /// This function just returns a \ref DigraphWriter class.
    871877  /// \relates DigraphWriter
    872878  template <typename Digraph>
     
    877883  }
    878884
     885  /// \brief Return a \ref DigraphWriter class
     886  ///
     887  /// This function just returns a \ref DigraphWriter class.
    879888  /// \relates DigraphWriter
    880889  template <typename Digraph>
     
    899908  /// \ingroup lemon_io
    900909  /// 
    901   /// \brief LGF writer for directed graphs
     910  /// \brief \ref lgf-format "LGF" writer for directed graphs
    902911  ///
    903912  /// This utility writes an \ref lgf-format "LGF" file.
     913  ///
     914  /// It can be used almost the same way as \c DigraphWriter.
     915  /// The only difference is that this class can handle edges and
     916  /// edge maps as well as arcs and arc maps.
     917  ///
     918  /// The arc maps are written into the file as two columns, the
     919  /// caption of the columns are the name of the map prefixed with \c
     920  /// '+' and \c '-'. The arcs are written into the \c \@attributes
     921  /// section as a \c '+' or a \c '-' prefix (depends on the direction
     922  /// of the arc) and the label of corresponding edge.
    904923  template <typename _Graph>
    905924  class GraphWriter {
     
    10241043    /// @{
    10251044   
    1026     /// \brief Node map reading rule
    1027     ///
    1028     /// Add a node map reading rule to the writer.
     1045    /// \brief Node map writing rule
     1046    ///
     1047    /// Add a node map writing rule to the writer.
    10291048    template <typename Map>
    10301049    GraphWriter& nodeMap(const std::string& caption, const Map& map) {
     
    11701189    }
    11711190
    1172     /// \name Select section by name
     1191    /// \name Section captions
    11731192    /// @{
    11741193
    1175     /// \brief Set \c \@nodes section to be read
    1176     ///
    1177     /// Set \c \@nodes section to be read
     1194    /// \brief Add an additional caption to the \c \@nodes section
     1195    ///
     1196    /// Add an additional caption to the \c \@nodes section.
    11781197    GraphWriter& nodes(const std::string& caption) {
    11791198      _nodes_caption = caption;
     
    11811200    }
    11821201
    1183     /// \brief Set \c \@edges section to be read
    1184     ///
    1185     /// Set \c \@edges section to be read
     1202    /// \brief Add an additional caption to the \c \@arcs section
     1203    ///
     1204    /// Add an additional caption to the \c \@arcs section.
    11861205    GraphWriter& edges(const std::string& caption) {
    11871206      _edges_caption = caption;
     
    11891208    }
    11901209
    1191     /// \brief Set \c \@attributes section to be read
    1192     ///
    1193     /// Set \c \@attributes section to be read
     1210    /// \brief Add an additional caption to the \c \@attributes section
     1211    ///
     1212    /// Add an additional caption to the \c \@attributes section.
    11941213    GraphWriter& attributes(const std::string& caption) {
    11951214      _attributes_caption = caption;
     
    12021221    /// \brief Skip writing the node set
    12031222    ///
    1204     /// The \c \@nodes section will be not written to the stream.
     1223    /// The \c \@nodes section will not be written to the stream.
    12051224    GraphWriter& skipNodes() {
    12061225      LEMON_ASSERT(!_skip_nodes, "Multiple usage of skipNodes() member");
     
    12111230    /// \brief Skip writing edge set
    12121231    ///
    1213     /// The \c \@edges section will be not written to the stream.
     1232    /// The \c \@edges section will not be written to the stream.
    12141233    GraphWriter& skipEdges() {
    12151234      LEMON_ASSERT(!_skip_edges, "Multiple usage of skipEdges() member");
     
    14191438    /// \brief Start the batch processing
    14201439    ///
    1421     /// This function starts the batch processing
     1440    /// This function starts the batch processing.
    14221441    void run() {
    14231442      if (!_skip_nodes) {
     
    14341453    }
    14351454
    1436     /// \brief Gives back the stream of the writer
    1437     ///
    1438     /// Gives back the stream of the writer
     1455    /// \brief Give back the stream of the writer
     1456    ///
     1457    /// Give back the stream of the writer
    14391458    std::ostream& ostream() {
    14401459      return *_os;
     
    14441463  };
    14451464
     1465  /// \brief Return a \ref GraphWriter class
     1466  ///
     1467  /// This function just returns a \ref GraphWriter class.
    14461468  /// \relates GraphWriter
    14471469  template <typename Graph>
     
    14511473  }
    14521474
     1475  /// \brief Return a \ref GraphWriter class
     1476  ///
     1477  /// This function just returns a \ref GraphWriter class.
    14531478  /// \relates GraphWriter
    14541479  template <typename Graph>
     
    14581483  }
    14591484
     1485  /// \brief Return a \ref GraphWriter class
     1486  ///
     1487  /// This function just returns a \ref GraphWriter class.
    14601488  /// \relates GraphWriter
    14611489  template <typename Graph>
Note: See TracChangeset for help on using the changeset viewer.