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