COIN-OR::LEMON - Graph Library

Changeset 1492:0d58f0301923 in lemon-0.x for lemon/lemon_writer.h


Ignore:
Timestamp:
06/15/05 12:10:59 (15 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1973
Message:

Correcting concept checks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/lemon_writer.h

    r1476 r1492  
    5656      struct Constraints {
    5757        void constraints() {
    58           const Item item;
    5958          bool b = writer.isIdWriter();
    6059          ignore_unused_variable_warning(b);
     
    6362        _ItemIdWriter& writer;
    6463        std::ostream& os;
     64        const Item& item;
     65      };
     66
     67    };
     68
     69    template <typename Item>
     70    class ItemWriter {
     71    public:
     72
     73      void write(std::ostream&, const Item&) {}
     74     
     75      template <class _ItemWriter>
     76      struct Constraints {
     77        void constraints() {
     78          writer.write(os, item);
     79        }
     80        _ItemWriter& writer;
     81        std::ostream& os;
     82        const Item& item;
    6583      };
    6684
     
    353371    NodeSetWriter& writeNodeMap(std::string name, const Map& map,
    354372                            const Writer& writer = Writer()) {
    355       checkConcept<concept::WriteMap<Node, typename Map::Value>, Map>();
     373      checkConcept<concept::ReadMap<Node, typename Map::Value>, Map>();
     374      checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
    356375      writers.push_back(
    357376        make_pair(name, new MapWriter<Node, Map, Writer>(map, writer)));
     
    518537    EdgeSetWriter& writeEdgeMap(std::string name, const Map& map,
    519538                            const Writer& writer = Writer()) {
    520       checkConcept<concept::WriteMap<Edge, typename Map::Value>, Map>();
     539      checkConcept<concept::ReadMap<Edge, typename Map::Value>, Map>();
     540      checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
    521541      writers.push_back(
    522542        make_pair(name, new MapWriter<Edge, Map, Writer>(map, writer)));
     
    699719    UndirEdgeSetWriter& writeUndirEdgeMap(std::string name, const Map& map,
    700720                                          const Writer& writer = Writer()) {
    701       checkConcept<concept::WriteMap<UndirEdge, typename Map::Value>, Map>();
     721      checkConcept<concept::ReadMap<UndirEdge, typename Map::Value>, Map>();
     722      checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
    702723      writers.push_back(
    703724        make_pair(name, new MapWriter<UndirEdge, Map, Writer>(map, writer)));
     
    710731    template <typename Map>
    711732    UndirEdgeSetWriter& writeEdgeMap(std::string name, const Map& map) {
    712       checkConcept<concept::WriteMap<Edge, typename Map::Value>, Map>();
    713       writeUndirEdgeMap("+" + name, composeMap(forwardMap(graph), map));
    714       writeUndirEdgeMap("-" + name, composeMap(backwardMap(graph), map));
    715       return *this;
     733      return writeEdgeMap<typename Traits::
     734        template Writer<typename Map::Value>, Map>(name, map);
    716735    }
    717736
     
    722741    UndirEdgeSetWriter& writeEdgeMap(std::string name, const Map& map,
    723742                                     const Writer& writer = Writer()) {
    724       checkConcept<concept::WriteMap<Edge, typename Map::Value>, Map>();
     743      checkConcept<concept::ReadMap<Edge, typename Map::Value>, Map>();
     744      checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
    725745      writeUndirEdge("+" + name, composeMap(forwardMap(graph), map), writer);
    726746      writeUndirEdge("-" + name, composeMap(backwardMap(graph), map), writer);
     
    11611181                                    const Value& value,
    11621182                                    const Writer& writer = Writer()) {
     1183      checkConcept<_writer_bits::ItemWriter<Value>, Writer>();
    11631184      writers.push_back(make_pair(name, new ValueWriter<Value, Writer>
    11641185                               (value, writer)));
Note: See TracChangeset for help on using the changeset viewer.