src/test/path_test.cc
author marci
Mon, 20 Sep 2004 16:20:11 +0000
changeset 889 47bb9b8f5705
parent 831 b6ae3446098a
child 906 17f31d280385
permissions -rw-r--r--
EXAMPLE_PATH is set to the demo dir.
hegyi@820
     1
#include <string>
hegyi@820
     2
#include <iostream>
hegyi@820
     3
#include <hugo/skeletons/path.h>
hegyi@831
     4
#include <hugo/path.h>
hegyi@820
     5
#include <hugo/list_graph.h>
hegyi@820
     6
hegyi@820
     7
using namespace std;
hegyi@820
     8
using namespace hugo;
hegyi@820
     9
using namespace skeleton;
hegyi@820
    10
hegyi@831
    11
template<class Path> void checkCompilePath(Path &P) 
hegyi@831
    12
{
hegyi@831
    13
  typedef typename Path::EdgeIt EdgeIt;
hegyi@831
    14
  typedef typename Path::NodeIt NodeIt;
hegyi@831
    15
  typedef typename Path::GraphNode GraphNode;
hegyi@831
    16
  typedef typename Path::GraphEdge GraphEdge;
hegyi@831
    17
  //typedef typename Path::Builder Builder;
hegyi@831
    18
  //??? ha csinalok ilyet es siman Builderrel peldanyositok, akkor warningol. Talan friend miatt? De ki az?
hegyi@820
    19
hegyi@831
    20
  EdgeIt ei;
hegyi@831
    21
  NodeIt ni;
hegyi@831
    22
  GraphNode gn;
hegyi@831
    23
  GraphEdge ge;
hegyi@831
    24
hegyi@831
    25
  size_t st;
hegyi@831
    26
  bool b;
hegyi@831
    27
hegyi@831
    28
  //Path(const Graph &_G) {}      //the constructor has been already called
hegyi@831
    29
hegyi@831
    30
  st=P.length();                  //size_t length() const {return 0;}
hegyi@831
    31
  b=P.empty();                    //bool empty() const {}
hegyi@831
    32
  P.clear();                      //void clear() {}
hegyi@831
    33
hegyi@831
    34
  gn=P.head();                    //GraphNode/*It*/ head() const {return INVALID;}
hegyi@831
    35
  gn=P.tail();                    //GraphNode/*It*/ tail() const {return INVALID;}
hegyi@831
    36
hegyi@831
    37
  ei=P.first(ei);                 //It& first(It &i) const { return i=It(*this); }
hegyi@831
    38
hegyi@831
    39
  ni=P.head(ei);                  //NodeIt head(const EdgeIt& e) const {}
hegyi@831
    40
  ni=P.tail(ei);                  //NodeIt tail(const EdgeIt& e) const {}
hegyi@831
    41
hegyi@831
    42
hegyi@831
    43
  ListGraph lg;
hegyi@831
    44
  Path p(lg);
hegyi@831
    45
hegyi@831
    46
  EdgeIt i;	                  //EdgeIt() {}
hegyi@831
    47
  EdgeIt j(INVALID);	          //EdgeIt(Invalid) {}
hegyi@831
    48
  EdgeIt k(p);	                  //EdgeIt(const Path &_p) {}
hegyi@831
    49
hegyi@831
    50
  i=++j;	                  //EdgeIt& operator++() {}
hegyi@831
    51
  b=(i==j);	                  //bool operator==(const EdgeIt& e) const {return true;}
hegyi@831
    52
  b=(i!=j);	                  //bool operator!=(const EdgeIt& e) const {return true;}
hegyi@831
    53
hegyi@831
    54
hegyi@831
    55
  NodeIt l;                       //NodeIt() {}
hegyi@831
    56
  NodeIt m(INVALID);	          //NodeIt(Invalid) {}
hegyi@831
    57
  NodeIt n(p);	                  //NodeIt(const Path &_p) {}
hegyi@831
    58
hegyi@831
    59
  l=++m;                          //NodeIt& operator++() {}
hegyi@831
    60
  b=(m==n);                       //bool operator==(const NodeIt& e) const {}
hegyi@831
    61
  b=(m!=n);                   	  //bool operator!=(const NodeIt& e) const {}
hegyi@831
    62
hegyi@831
    63
  typename Path::Builder builder(p);     //Builder(Path &_P) : P(_P) {}
hegyi@831
    64
  builder.setStartNode(gn);     	 //void setStartNode(const GraphNode &) {}
hegyi@831
    65
  builder.pushFront(ge);	         //void pushFront(const GraphEdge& e) {}
hegyi@831
    66
  builder.pushBack(ge);	                 //void pushBack(const GraphEdge& e) {}
hegyi@831
    67
  builder.commit();	                 //void commit() {}
hegyi@831
    68
  builder.reserveFront(st);	         //void reserveFront(size_t r) {}
hegyi@831
    69
  builder.reserveBack(st);	         //void reserveBack(size_t r) {}
hegyi@831
    70
hegyi@820
    71
}
hegyi@820
    72
hegyi@831
    73
template void checkCompilePath< skeleton::Path<ListGraph> >(skeleton::Path<ListGraph> &);
hegyi@831
    74
template void checkCompilePath< DirPath<ListGraph> >(DirPath<ListGraph> &);
hegyi@831
    75
template void checkCompilePath< UndirPath<ListGraph> >(UndirPath<ListGraph> &);
hegyi@820
    76
hegyi@831
    77
int main() 
hegyi@831
    78
{
hegyi@820
    79
}