src/include/skeletons/graph.h
changeset 503 769f31e9f7b0
parent 463 7f3ef3009dd3
child 515 a7eeb8af6b34
equal deleted inserted replaced
5:2f6d6eafac89 6:88071c15d3f4
     1 // -*- c++ -*-
     1 // -*- c++ -*-
     2 #ifndef HUGO_GRAPH_H
     2 #ifndef HUGO_SKELETON_GRAPH_H
     3 #define HUGO_GRAPH_H
     3 #define HUGO_SKELETON_GRAPH_H
     4 
     4 
     5 ///\file
     5 ///\file
     6 ///\brief Declaration of GraphSkeleton.
     6 ///\brief Declaration of GraphSkeleton.
     7 
     7 
     8 #include <invalid.h>
     8 #include <invalid.h>
    56       Node(Invalid) {}
    56       Node(Invalid) {}
    57       //Node(const Node &) {}
    57       //Node(const Node &) {}
    58 
    58 
    59       /// Two iterators are equal if and only if they point to the
    59       /// Two iterators are equal if and only if they point to the
    60       /// same object or both are invalid.
    60       /// same object or both are invalid.
    61       bool operator==(Node n) const { return true; }
    61       bool operator==(Node) const { return true; }
    62 
    62 
    63       /// \sa \ref operator==(Node n)
    63       /// \sa \ref operator==(Node n)
    64       ///
    64       ///
    65       bool operator!=(Node n) const { return true; }
    65       bool operator!=(Node) const { return true; }
    66 
    66 
    67       bool operator<(Node n) const { return true; }
    67       bool operator<(Node) const { return true; }
    68     };
    68     };
    69     
    69     
    70     /// This iterator goes through each node.
    70     /// This iterator goes through each node.
    71 
    71 
    72     /// This iterator goes through each node.
    72     /// This iterator goes through each node.
    88       NodeIt(Invalid) {}
    88       NodeIt(Invalid) {}
    89       /// Sets the iterator to the first node of \c G.
    89       /// Sets the iterator to the first node of \c G.
    90       NodeIt(const GraphSkeleton &G) {}
    90       NodeIt(const GraphSkeleton &G) {}
    91       /// @warning The default constructor sets the iterator
    91       /// @warning The default constructor sets the iterator
    92       /// to an undefined value.
    92       /// to an undefined value.
    93       NodeIt(const NodeIt &) {}
    93       NodeIt(const NodeIt &n) : Node(n) {}
    94     };
    94     };
    95     
    95     
    96     
    96     
    97     /// The base type of the edge iterators.
    97     /// The base type of the edge iterators.
    98     class Edge {
    98     class Edge {
   102       Edge() {}   //FIXME
   102       Edge() {}   //FIXME
   103       /// Initialize the iterator to be invalid
   103       /// Initialize the iterator to be invalid
   104       Edge(Invalid) {}
   104       Edge(Invalid) {}
   105       /// Two iterators are equal if and only if they point to the
   105       /// Two iterators are equal if and only if they point to the
   106       /// same object or both are invalid.
   106       /// same object or both are invalid.
   107       bool operator==(Edge n) const { return true; }
   107       bool operator==(Edge) const { return true; }
   108       bool operator!=(Edge n) const { return true; }
   108       bool operator!=(Edge) const { return true; }
   109       bool operator<(Edge n) const { return true; }
   109       bool operator<(Edge) const { return true; }
   110     };
   110     };
   111     
   111     
   112     /// This iterator goes trough the outgoing edges of a node.
   112     /// This iterator goes trough the outgoing edges of a node.
   113 
   113 
   114     /// This iterator goes trough the \e outgoing edges of a certain node
   114     /// This iterator goes trough the \e outgoing edges of a certain node
   185     /// \return the first node.
   185     /// \return the first node.
   186     ///
   186     ///
   187     NodeIt &first(NodeIt &i) const { return i;}
   187     NodeIt &first(NodeIt &i) const { return i;}
   188 
   188 
   189     /// The first incoming edge.
   189     /// The first incoming edge.
   190     InEdgeIt &first(InEdgeIt &i, Node n) const { return i;}
   190     InEdgeIt &first(InEdgeIt &i, Node) const { return i;}
   191     /// The first outgoing edge.
   191     /// The first outgoing edge.
   192     OutEdgeIt &first(OutEdgeIt &i, Node n) const { return i;}
   192     OutEdgeIt &first(OutEdgeIt &i, Node) const { return i;}
   193     //  SymEdgeIt &first(SymEdgeIt &, Node) const { return i;}
   193     //  SymEdgeIt &first(SymEdgeIt &, Node) const { return i;}
   194     /// The first edge of the Graph.
   194     /// The first edge of the Graph.
   195     EdgeIt &first(EdgeIt &i) const { return i;}
   195     EdgeIt &first(EdgeIt &i) const { return i;}
   196 
   196 
   197 //     Node getNext(Node) const {}
   197 //     Node getNext(Node) const {}
   256     ///Add a new edge to the graph.
   256     ///Add a new edge to the graph.
   257 
   257 
   258     ///Add a new edge to the graph with tail node \c tail
   258     ///Add a new edge to the graph with tail node \c tail
   259     ///and head node \c head.
   259     ///and head node \c head.
   260     ///\return the new edge.
   260     ///\return the new edge.
   261     Edge addEdge(Node tail, Node head) { return INVALID;}
   261     Edge addEdge(Node, Node) { return INVALID;}
   262     
   262     
   263     /// Resets the graph.
   263     /// Resets the graph.
   264 
   264 
   265     /// This function deletes all edges and nodes of the graph.
   265     /// This function deletes all edges and nodes of the graph.
   266     /// It also frees the memory allocated to store them.
   266     /// It also frees the memory allocated to store them.
   292 
   292 
   293       /// Sets the value of a node.
   293       /// Sets the value of a node.
   294 
   294 
   295       /// Sets the value associated with node \c i to the value \c t.
   295       /// Sets the value associated with node \c i to the value \c t.
   296       ///
   296       ///
   297       void set(Node i, T t) {}
   297       void set(Node, T) {}
   298       /// Gets the value of a node.
   298       // Gets the value of a node.
   299       T get(Node i) const {return *(T*)0;}  //FIXME: Is it necessary
   299       //T get(Node i) const {return *(T*)0;}  //FIXME: Is it necessary?
   300       T &operator[](Node i) {return *(T*)0;}
   300       T &operator[](Node) {return *(T*)0;}
   301       const T &operator[](Node i) const {return *(T*)0;}
   301       const T &operator[](Node) const {return *(T*)0;}
   302 
   302 
   303       /// Updates the map if the graph has been changed
   303       /// Updates the map if the graph has been changed
   304 
   304 
   305       /// \todo Do we need this?
   305       /// \todo Do we need this?
   306       ///
   306       ///
   324       typedef Edge KeyType;
   324       typedef Edge KeyType;
   325 
   325 
   326       EdgeMap(const GraphSkeleton &G) {}
   326       EdgeMap(const GraphSkeleton &G) {}
   327       EdgeMap(const GraphSkeleton &G, T t) {}
   327       EdgeMap(const GraphSkeleton &G, T t) {}
   328     
   328     
   329       void set(Edge i, T t) {}
   329       ///\todo It can copy between different types.
   330       T get(Edge i) const {return *(T*)0;}
   330       ///
   331       T &operator[](Edge i) {return *(T*)0;}
   331       template<typename TT> EdgeMap(const EdgeMap<TT> &m) {}
       
   332 
       
   333       void set(Edge, T) {}
       
   334       //T get(Edge) const {return *(T*)0;}
       
   335       T &operator[](Edge) {return *(T*)0;}
       
   336       const T &operator[](Edge) const {return *(T*)0;}
   332     
   337     
   333       void update() {}
   338       void update() {}
   334       void update(T a) {}   //FIXME: Is it necessary
   339       void update(T a) {}   //FIXME: Is it necessary
   335     };
   340     };
   336   };
   341   };
   389 //   enum NodeClass { A = 0, B = 1 };
   394 //   enum NodeClass { A = 0, B = 1 };
   390 //   NodeClass getClass(Node n) {}
   395 //   NodeClass getClass(Node n) {}
   391 
   396 
   392 // }
   397 // }
   393 
   398 
   394 #endif // HUGO_GRAPH_H
   399 #endif // HUGO_SKELETON_GRAPH_H