src/work/marci/leda/leda_graph_wrapper.h
changeset 646 bd7a69231cf8
parent 617 dc17013b0e52
child 650 588ff2ca55bd
equal deleted inserted replaced
6:9cf5966cf2d0 7:5abb0cc4b545
    38     LedaGraphWrapper(Graph& _l_graph) : l_graph(&_l_graph) { }
    38     LedaGraphWrapper(Graph& _l_graph) : l_graph(&_l_graph) { }
    39     LedaGraphWrapper(const LedaGraphWrapper &G) : l_graph(G.l_graph) { }
    39     LedaGraphWrapper(const LedaGraphWrapper &G) : l_graph(G.l_graph) { }
    40 
    40 
    41     template <typename T> class NodeMap;
    41     template <typename T> class NodeMap;
    42     template <typename T> class EdgeMap;
    42     template <typename T> class EdgeMap;
       
    43     template <typename T> class NodeMapWrapper;
       
    44     template <typename T> class EdgeMapWrapper;
    43 
    45 
    44     class Node;
    46     class Node;
    45     class NodeIt;
    47     class NodeIt;
    46     class Edge;
    48     class Edge;
    47     class EdgeIt;
    49     class EdgeIt;
   289 
   291 
   290       void update() { /*leda_stuff.init(leda_stuff.get_graph());*/ }
   292       void update() { /*leda_stuff.init(leda_stuff.get_graph());*/ }
   291       //void update(T a) { leda_stuff.init(leda_stuff.get_graph()/**(G.l_graph)*/, a); }   //FIXME: Is it necessary
   293       //void update(T a) { leda_stuff.init(leda_stuff.get_graph()/**(G.l_graph)*/, a); }   //FIXME: Is it necessary
   292     };
   294     };
   293 
   295 
       
   296 
       
   297     ///Read/write map from the nodes to type \c T.
       
   298     template<typename T> class NodeMapWrapper
       
   299     {
       
   300       leda_node_map<T>* leda_stuff;
       
   301     public:
       
   302       typedef T ValueType;
       
   303       typedef Node KeyType;
       
   304 
       
   305       NodeMapWrapper(leda_node_map<T>& _leda_stuff) : 
       
   306 	leda_stuff(&_leda_stuff) { }
       
   307       //NodeMap(leda_node_map& &G, T t) : leda_stuff(*(G.l_graph), t) {}
       
   308 
       
   309       void set(Node i, T t) { (*leda_stuff)[i.l_n]=t; }
       
   310       T get(Node i) const { return (*leda_stuff)[i.l_n]; }  //FIXME: Is it necessary
       
   311       T &operator[](Node i) { return (*leda_stuff)[i.l_n]; }
       
   312       const T &operator[](Node i) const { return (*leda_stuff)[i.l_n]; }
       
   313 
       
   314       void update() { /*leda_stuff.init(leda_stuff.get_graph());*/ }
       
   315       //void update(T a) { leda_stuff.init(leda_stuff.get_graph()/**(G.l_graph)*/, a); }   //FIXME: Is it necessary
       
   316     };
       
   317 
       
   318     ///Read/write map from the edges to type \c T.
       
   319     template<typename T> class EdgeMapWrapper
       
   320     {
       
   321       leda_edge_map<T>* leda_stuff;
       
   322     public:
       
   323       typedef T ValueType;
       
   324       typedef Edge KeyType;
       
   325 
       
   326       EdgeMapWrapper(leda_edge_map<T>& _leda_stuff) : 
       
   327 	leda_stuff(_leda_stuff) { }
       
   328       //EdgeMap(const LedaGraphWrapper &G, T t) : leda_stuff(*(G.l_graph), t) {}
       
   329 
       
   330       void set(Edge i, T t) { (*leda_stuff)[i.l_e]=t; }
       
   331       T get(Edge i) const { return (*leda_stuff)[i.l_e]; }  //FIXME: Is it necessary
       
   332       T &operator[](Edge i) { return (*leda_stuff)[i.l_e]; }
       
   333       const T &operator[](Edge i) const { return (*leda_stuff)[i.l_e]; }
       
   334 
       
   335       void update() { /*leda_stuff.init(leda_stuff.get_graph());*/ }
       
   336       //void update(T a) { leda_stuff.init(leda_stuff.get_graph()/**(G.l_graph)*/, a); }   //FIXME: Is it necessary
       
   337     };
       
   338 
   294   };
   339   };
   295 
   340 
   296 
   341 
   297   /// \brief LEDA graph template.
   342   /// \brief LEDA graph template.
   298   ///
   343   ///