demo/reader_writer_demo.cc
changeset 1530 d99c3c84f797
parent 1528 1aa71600000c
child 1534 b86aad11f842
equal deleted inserted replaced
0:7211fd5a983d 1:334d97e67403
    13   try {
    13   try {
    14     std::string filename="sample.lgf";
    14     std::string filename="sample.lgf";
    15     GraphReader<SmartGraph> reader(filename,graph);
    15     GraphReader<SmartGraph> reader(filename,graph);
    16     SmartGraph::EdgeMap<int> cap(graph);
    16     SmartGraph::EdgeMap<int> cap(graph);
    17     reader.readEdgeMap("capacity",cap);
    17     reader.readEdgeMap("capacity",cap);
    18 //     reader.readNode("source",s).readNode("target",t)
       
    19 //       .readEdgeMap("capacity",cap).run();
       
    20     reader.run();
    18     reader.run();
    21 
    19 
    22     std::cout << "Hello! We have read a graph from file " << filename<< 
    20     std::cout << "Hello! We have read a graph from file " << filename<< 
    23       " and some maps on it: now we write this to the standard output!" << 
    21       " and some maps on it: now we write this to the standard output!" << 
    24       std::endl;
    22       std::endl;
    28     writer.writeEdgeMap("multiplicity", cap);
    26     writer.writeEdgeMap("multiplicity", cap);
    29 //     writer.writeNode("source", s);
    27 //     writer.writeNode("source", s);
    30 //     writer.writeNode("target", t);
    28 //     writer.writeNode("target", t);
    31     writer.run();
    29     writer.run();
    32      
    30      
    33 //     LemonReader reader(std::cin);
       
    34 
       
    35 //     NodeSetReader<SmartGraph> nodeset(reader, graph);
       
    36 //     SmartGraph::NodeMap<int> cost(graph);
       
    37 //     nodeset.readMap("cost", cost);
       
    38 //     SmartGraph::NodeMap<char> mmap(graph);
       
    39 //     nodeset.readMap("mmap", mmap);
       
    40 
       
    41 //     EdgeSetReader<SmartGraph> edgeset(reader, graph, nodeset);
       
    42 //     SmartGraph::EdgeMap<std::string> description(graph);
       
    43 //     edgeset.readMap<QuotedStringReader>("description", description);
       
    44 
       
    45 //     NodeReader<SmartGraph> nodes(reader, nodeset);
       
    46 //     SmartGraph::Node source;
       
    47 //     nodes.readNode("source", source);
       
    48 //     SmartGraph::Node target;
       
    49 //     nodes.readNode("target", target);
       
    50 
       
    51 //     AttributeReader<> attribute(reader, "gui");
       
    52 //     std::string author;
       
    53 //     attribute.readAttribute<LineReader>("author", author);
       
    54 //     int count;
       
    55 //     attribute.readAttribute("count", count);
       
    56 
       
    57 //     PrintReader print(reader);
       
    58 
       
    59 //     reader.run();
       
    60 
       
    61 
       
    62 //     for (SmartGraph::NodeIt it(graph); it != INVALID; ++it) {
       
    63 //       std::cout << cost[it] << ' ' << mmap[it] << std::endl;
       
    64 //     }
       
    65 
       
    66 //     for (SmartGraph::EdgeIt it(graph); it != INVALID; ++it) {
       
    67 //       std::cout << description[it] << std::endl;
       
    68 //     }
       
    69 
       
    70 //     std::cout << "author: " << author << std::endl;
       
    71 //     std::cout << "count: " << count << std::endl;
       
    72 
       
    73 //     std::cout << "source cost: " << cost[source] << std::endl;
       
    74 //     std::cout << "target cost: " << cost[target] << std::endl;
       
    75 
       
    76 //     std::cout.flush();
       
    77   } catch (DataFormatError& error) {
    31   } catch (DataFormatError& error) {
    78     std::cerr << error.what() << std::endl;
    32     std::cerr << error.what() << std::endl;
    79   }
    33   }
    80 
    34 
    81 
    35