COIN-OR::LEMON - Graph Library

source: lemon-0.x/test/path_test.cc @ 2125:2f2cbe4e78a8

Last change on this file since 2125:2f2cbe4e78a8 was 1956:a055123339d5, checked in by Alpar Juttner, 19 years ago

Unified copyright notices

File size: 3.4 KB
RevLine 
[906]1/* -*- C++ -*-
2 *
[1956]3 * This file is a part of LEMON, a generic C++ optimization library
4 *
5 * Copyright (C) 2003-2006
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
[1359]7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
[906]8 *
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
12 *
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
15 * purpose.
16 *
17 */
18
[820]19#include <string>
20#include <iostream>
[959]21#include <lemon/concept/path.h>
[921]22#include <lemon/path.h>
23#include <lemon/list_graph.h>
[820]24
25using namespace std;
[921]26using namespace lemon;
[959]27using namespace lemon::concept;
[820]28
[831]29template<class Path> void checkCompilePath(Path &P)
30{
31  typedef typename Path::EdgeIt EdgeIt;
32  typedef typename Path::NodeIt NodeIt;
33  typedef typename Path::GraphNode GraphNode;
34  typedef typename Path::GraphEdge GraphEdge;
35  //typedef typename Path::Builder Builder;
36  //??? ha csinalok ilyet es siman Builderrel peldanyositok, akkor warningol. Talan friend miatt? De ki az?
[820]37
[831]38  EdgeIt ei;
39  NodeIt ni;
40  GraphNode gn;
41  GraphEdge ge;
42
43  size_t st;
44  bool b;
45
46  //Path(const Graph &_G) {}      //the constructor has been already called
47
48  st=P.length();                  //size_t length() const {return 0;}
49  b=P.empty();                    //bool empty() const {}
50  P.clear();                      //void clear() {}
51
[986]52  gn=P.target();                    //GraphNode/*It*/ target() const {return INVALID;}
53  gn=P.source();                    //GraphNode/*It*/ source() const {return INVALID;}
[831]54
55  ei=P.first(ei);                 //It& first(It &i) const { return i=It(*this); }
56
[986]57  ni=P.target(ei);                  //NodeIt target(const EdgeIt& e) const {}
58  ni=P.source(ei);                  //NodeIt source(const EdgeIt& e) const {}
[831]59
60
61  ListGraph lg;
62  Path p(lg);
63
64  EdgeIt i;                       //EdgeIt() {}
65  EdgeIt j(INVALID);              //EdgeIt(Invalid) {}
66  EdgeIt k(p);                    //EdgeIt(const Path &_p) {}
67
68  i=++j;                          //EdgeIt& operator++() {}
[990]69  ++k;
[831]70  b=(i==j);                       //bool operator==(const EdgeIt& e) const {return true;}
71  b=(i!=j);                       //bool operator!=(const EdgeIt& e) const {return true;}
72
73
74  NodeIt l;                       //NodeIt() {}
75  NodeIt m(INVALID);              //NodeIt(Invalid) {}
76  NodeIt n(p);                    //NodeIt(const Path &_p) {}
77
78  l=++m;                          //NodeIt& operator++() {}
79  b=(m==n);                       //bool operator==(const NodeIt& e) const {}
80  b=(m!=n);                       //bool operator!=(const NodeIt& e) const {}
81
82  typename Path::Builder builder(p);     //Builder(Path &_P) : P(_P) {}
83  builder.setStartNode(gn);              //void setStartNode(const GraphNode &) {}
84  builder.pushFront(ge);                 //void pushFront(const GraphEdge& e) {}
85  builder.pushBack(ge);                  //void pushBack(const GraphEdge& e) {}
86  builder.commit();                      //void commit() {}
87  builder.reserveFront(st);              //void reserveFront(size_t r) {}
88  builder.reserveBack(st);               //void reserveBack(size_t r) {}
89
[820]90}
91
[959]92template void checkCompilePath< concept::Path<ListGraph> >(concept::Path<ListGraph> &);
[831]93template void checkCompilePath< DirPath<ListGraph> >(DirPath<ListGraph> &);
[1909]94template void checkCompilePath< UPath<ListGraph> >(UPath<ListGraph> &);
[820]95
[831]96int main()
97{
[820]98}
Note: See TracBrowser for help on using the repository browser.