COIN-OR::LEMON - Graph Library

Changeset 2386:81b47fc5c444 in lemon-0.x for lemon/lemon_writer.h


Ignore:
Timestamp:
03/02/07 19:04:28 (13 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3217
Message:

Hard Warning checking

  • based on the remark of the ZIB user
  • we do not use -Winline
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/lemon_writer.h

    r2282 r2386  
    473473    /// Add a new node map writer command for the writer.
    474474    template <typename Map>
    475     NodeSetWriter& writeNodeMap(std::string name, const Map& map) {
     475    NodeSetWriter& writeNodeMap(std::string label, const Map& map) {
    476476      return writeNodeMap<typename Traits::
    477         template Writer<typename Map::Value>, Map>(name, map);
     477        template Writer<typename Map::Value>, Map>(label, map);
    478478    }
    479479
     
    481481    ///
    482482    /// Add a new node map writer command for the writer.
    483     template <typename Writer, typename Map>
    484     NodeSetWriter& writeNodeMap(std::string name, const Map& map,
    485                             const Writer& writer = Writer()) {
     483    template <typename ItemWriter, typename Map>
     484    NodeSetWriter& writeNodeMap(std::string label, const Map& map,
     485                            const ItemWriter& iw = ItemWriter()) {
    486486      checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
    487       checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
     487      checkConcept<_writer_bits::ItemWriter<typename Map::Value>,ItemWriter>();
    488488      writers.push_back(
    489         make_pair(name, new _writer_bits::
    490                   MapWriter<Node, Map, Writer>(map, writer)));
     489        make_pair(label, new _writer_bits::
     490                  MapWriter<Node, Map, ItemWriter>(map, iw)));
    491491      return *this;
    492492    }
     
    505505    /// Write the content of the section.
    506506    virtual void write(std::ostream& os) {
    507       for (int i = 0; i < (int)writers.size(); ++i) {
     507      for (int i = 0; i < int(writers.size()); ++i) {
    508508        if (writers[i].first == "label") {
    509509          labelMap = writers[i].second;
     
    529529        os << "label\t";
    530530      }
    531       for (int i = 0; i < (int)writers.size(); ++i) {
     531      for (int i = 0; i < int(writers.size()); ++i) {
    532532        os << writers[i].first << '\t';
    533533      }
     
    538538          os << graph.id(*it) << '\t';
    539539        }
    540         for (int i = 0; i < (int)writers.size(); ++i) {
     540        for (int i = 0; i < int(writers.size()); ++i) {
    541541          writers[i].second->write(os, *it);
    542542          os << '\t';
     
    662662    /// Add a new edge map writer command for the writer.
    663663    template <typename Map>
    664     EdgeSetWriter& writeEdgeMap(std::string name, const Map& map) {
     664    EdgeSetWriter& writeEdgeMap(std::string label, const Map& map) {
    665665      return writeEdgeMap<typename Traits::
    666         template Writer<typename Map::Value>, Map>(name, map);
     666        template Writer<typename Map::Value>, Map>(label, map);
    667667    }
    668668
     
    670670    ///
    671671    /// Add a new edge map writer command for the writer.
    672     template <typename Writer, typename Map>
    673     EdgeSetWriter& writeEdgeMap(std::string name, const Map& map,
    674                             const Writer& writer = Writer()) {
     672    template <typename ItemWriter, typename Map>
     673    EdgeSetWriter& writeEdgeMap(std::string label, const Map& map,
     674                            const ItemWriter& iw = ItemWriter()) {
    675675      checkConcept<concepts::ReadMap<Edge, typename Map::Value>, Map>();
    676       checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
     676      checkConcept<_writer_bits::ItemWriter<typename Map::Value>, ItemWriter>();
    677677      writers.push_back(
    678         make_pair(name, new _writer_bits::
    679                   MapWriter<Edge, Map, Writer>(map, writer)));
     678        make_pair(label, new _writer_bits::
     679                  MapWriter<Edge, Map, ItemWriter>(map, iw)));
    680680      return *this;
    681681    }
     
    697697        throw DataFormatError("Cannot find nodeset or label map");
    698698      }
    699       for (int i = 0; i < (int)writers.size(); ++i) {
     699      for (int i = 0; i < int(writers.size()); ++i) {
    700700        if (writers[i].first == "label") {
    701701          labelMap = writers[i].second;
     
    722722        os << "label\t";
    723723      }
    724       for (int i = 0; i < (int)writers.size(); ++i) {
     724      for (int i = 0; i < int(writers.size()); ++i) {
    725725        os << writers[i].first << '\t';
    726726      }
     
    735735          os << graph.id(*it) << '\t';
    736736        }
    737         for (int i = 0; i < (int)writers.size(); ++i) {
     737        for (int i = 0; i < int(writers.size()); ++i) {
    738738          writers[i].second->write(os, *it);
    739739          os << '\t';
     
    868868    /// Add a new undirected map writer command for the writer.
    869869    template <typename Map>
    870     UEdgeSetWriter& writeUEdgeMap(std::string name, const Map& map) {
     870    UEdgeSetWriter& writeUEdgeMap(std::string label, const Map& map) {
    871871      return writeUEdgeMap<typename Traits::
    872         template Writer<typename Map::Value>, Map>(name, map);
     872        template Writer<typename Map::Value>, Map>(label, map);
    873873    }
    874874
     
    876876    ///
    877877    /// Add a new undirected map writer command for the writer.
    878     template <typename Writer, typename Map>
    879     UEdgeSetWriter& writeUEdgeMap(std::string name, const Map& map,
    880                                   const Writer& writer = Writer()) {
     878    template <typename ItemWriter, typename Map>
     879    UEdgeSetWriter& writeUEdgeMap(std::string label, const Map& map,
     880                                  const ItemWriter& iw = ItemWriter()) {
    881881      checkConcept<concepts::ReadMap<UEdge, typename Map::Value>, Map>();
    882       checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
     882      checkConcept<_writer_bits::ItemWriter<typename Map::Value>, ItemWriter>();
    883883      writers.push_back(
    884         make_pair(name, new _writer_bits::
    885                   MapWriter<UEdge, Map, Writer>(map, writer)));
     884        make_pair(label, new _writer_bits::
     885                  MapWriter<UEdge, Map, ItemWriter>(map, iw)));
    886886      return *this;
    887887    }
     
    891891    /// Add a new directed map writer command for the writer.
    892892    template <typename Map>
    893     UEdgeSetWriter& writeEdgeMap(std::string name, const Map& map) {
     893    UEdgeSetWriter& writeEdgeMap(std::string label, const Map& map) {
    894894      return writeEdgeMap<typename Traits::
    895         template Writer<typename Map::Value>, Map>(name, map);
     895        template Writer<typename Map::Value>, Map>(label, map);
    896896    }
    897897
     
    899899    ///
    900900    /// Add a new directed map writer command for the writer.
    901     template <typename Writer, typename Map>
    902     UEdgeSetWriter& writeEdgeMap(std::string name, const Map& map,
    903                                  const Writer& writer = Writer()) {
     901    template <typename ItemWriter, typename Map>
     902    UEdgeSetWriter& writeEdgeMap(std::string label, const Map& map,
     903                                 const ItemWriter& iw = ItemWriter()) {
    904904      checkConcept<concepts::ReadMap<Edge, typename Map::Value>, Map>();
    905       checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
     905      checkConcept<_writer_bits::ItemWriter<typename Map::Value>, ItemWriter>();
    906906      writeUEdgeMap("+" + name,
    907                     _writer_bits::forwardComposeMap(graph, map), writer);
     907                    _writer_bits::forwardComposeMap(graph, map), iw);
    908908      writeUEdgeMap("-" + name,
    909                     _writer_bits::backwardComposeMap(graph, map), writer);
     909                    _writer_bits::backwardComposeMap(graph, map), iw);
    910910      return *this;
    911911    }
     
    927927        throw DataFormatError("Cannot find nodeset or label map");
    928928      }
    929       for (int i = 0; i < (int)writers.size(); ++i) {
     929      for (int i = 0; i < int(writers.size()); ++i) {
    930930        if (writers[i].first == "label") {
    931931          labelMap = writers[i].second;
     
    952952        os << "label\t";
    953953      }
    954       for (int i = 0; i < (int)writers.size(); ++i) {
     954      for (int i = 0; i < int(writers.size()); ++i) {
    955955        os << writers[i].first << '\t';
    956956      }
     
    965965          os << graph.id(*it) << '\t';
    966966        }
    967         for (int i = 0; i < (int)writers.size(); ++i) {
     967        for (int i = 0; i < int(writers.size()); ++i) {
    968968          writers[i].second->write(os, *it);
    969969          os << '\t';
     
    10811081    ///
    10821082    /// Add a node writer command for the NodeWriter.
    1083     void writeNode(const std::string& name, const Node& item) {
    1084       writers.push_back(make_pair(name, &item));
     1083    void writeNode(std::string label, const Node& item) {
     1084      writers.push_back(make_pair(label, &item));
    10851085    }
    10861086
     
    11011101        throw DataFormatError("Cannot find nodeset or label map");
    11021102      }
    1103       for (int i = 0; i < (int)writers.size(); ++i) {
     1103      for (int i = 0; i < int(writers.size()); ++i) {
    11041104        os << writers[i].first << ' ';
    11051105        labelWriter->write(os, *(writers[i].second));
     
    11651165    ///
    11661166    /// Add an edge writer command for the EdgeWriter.
    1167     void writeEdge(const std::string& name, const Edge& item) {
    1168       writers.push_back(make_pair(name, &item));
     1167    void writeEdge(std::string label, const Edge& item) {
     1168      writers.push_back(make_pair(label, &item));
    11691169    }
    11701170
     
    11851185        throw DataFormatError("Cannot find edgeset or label map");
    11861186      }
    1187       for (int i = 0; i < (int)writers.size(); ++i) {
     1187      for (int i = 0; i < int(writers.size()); ++i) {
    11881188        os << writers[i].first << ' ';
    11891189        labelWriter->write(os, *(writers[i].second));
     
    12571257    ///
    12581258    /// Add an edge writer command for the UEdgeWriter.
    1259     void writeEdge(const std::string& name, const Edge& item) {
    1260       edgeWriters.push_back(make_pair(name, &item));
     1259    void writeEdge(std::string label, const Edge& item) {
     1260      edgeWriters.push_back(make_pair(label, &item));
    12611261    }
    12621262
     
    12641264    ///
    12651265    /// Add an undirected edge writer command for the UEdgeWriter.
    1266     void writeUEdge(const std::string& name, const UEdge& item) {
    1267       uEdgeWriters.push_back(make_pair(name, &item));
     1266    void writeUEdge(std::string label, const UEdge& item) {
     1267      uEdgeWriters.push_back(make_pair(label, &item));
    12681268    }
    12691269
     
    12871287        throw DataFormatError("Cannot find undirected edgeset or label map");
    12881288      }
    1289       for (int i = 0; i < (int)uEdgeWriters.size(); ++i) {
     1289      for (int i = 0; i < int(uEdgeWriters.size()); ++i) {
    12901290        os << uEdgeWriters[i].first << ' ';
    12911291        uEdgeLabelWriter->write(os, *(uEdgeWriters[i].second));
    12921292        os << std::endl;
    12931293      }
    1294       for (int i = 0; i < (int)edgeWriters.size(); ++i) {
     1294      for (int i = 0; i < int(edgeWriters.size()); ++i) {
    12951295        os << edgeWriters[i].first << ' ';
    12961296        edgeLabelWriter->write(os, *(edgeWriters[i].second));
     
    13641364    /// Add an attribute writer command for the writer.
    13651365    template <typename Value>
    1366     AttributeWriter& writeAttribute(const std::string& name,
     1366    AttributeWriter& writeAttribute(std::string label,
    13671367                                    const Value& value) {
    13681368      return
     
    13731373    ///
    13741374    /// Add an attribute writer command for the writer.
    1375     template <typename Writer, typename Value>
    1376     AttributeWriter& writeAttribute(const std::string& name,
    1377                                     const Value& value,
    1378                                     const Writer& writer = Writer()) {
    1379       checkConcept<_writer_bits::ItemWriter<Value>, Writer>();
    1380       writers.push_back(make_pair(name, new _writer_bits::
    1381                                   ValueWriter<Value, Writer>(value, writer)));
     1375    template <typename ItemWriter, typename Value>
     1376    AttributeWriter& writeAttribute(std::string label, const Value& value,
     1377                                    const ItemWriter& iw = ItemWriter()) {
     1378      checkConcept<_writer_bits::ItemWriter<Value>, ItemWriter>();
     1379      writers.push_back(make_pair(label, new _writer_bits::
     1380                                  ValueWriter<Value, ItemWriter>(value, iw)));
    13821381      return *this;
    13831382    }
Note: See TracChangeset for help on using the changeset viewer.