src/work/marci_property_vector.hh
changeset 224 5bc1c83257f8
parent 19 3151a1026db9
equal deleted inserted replaced
1:4ece727d6e98 2:20c426618bbd
     1 #ifndef MARCI_PROPERTY_VECTOR_HH
     1 #ifndef MARCI_PROPERTY_VECTOR_HH
     2 #define MARCI_PROPERTY_VECTOR_HH
     2 #define MARCI_PROPERTY_VECTOR_HH
     3 
     3 
     4 #include <vector>
     4 #include <vector>
     5 
     5 
     6 namespace marci {
     6 namespace hugo {
     7 
     7 
     8   template <typename iterator>
     8   template <typename iterator>
     9   int number_of(iterator _it) { 
     9   int number_of(iterator _it) { 
    10     int i=0;
    10     int i=0;
    11     for( ; _it.valid(); ++_it) { ++i; } 
    11     for( ; _it.valid(); ++_it) { ++i; } 
    12     return i;
    12     return i;
    13   }
    13   }
    14   
    14   
    15   template <typename graph_type, typename T>
    15   template <typename graph_type, typename T>
    16   class node_property_vector {
    16   class node_property_vector {
    17     typedef typename list_graph::node_iterator node_iterator;
    17     typedef typename graph_type::node_iterator node_iterator;
    18     typedef typename list_graph::each_node_iterator each_node_iterator;
    18     typedef typename graph_type::each_node_iterator each_node_iterator;
    19     graph_type& G; 
    19     graph_type& G; 
    20     std::vector<T> container;
    20     std::vector<T> container;
    21   public:
    21   public:
    22     node_property_vector(graph_type& _G) : G(_G) {
    22     node_property_vector(graph_type& _G) : G(_G) {
    23       int i=0;
    23       int i=0;
    50     }
    50     }
    51     void put(edge_iterator eit, const T& a) { container[G.id(eit)]=a; }
    51     void put(edge_iterator eit, const T& a) { container[G.id(eit)]=a; }
    52     T get(edge_iterator eit) { return container[G.id(eit)]; }
    52     T get(edge_iterator eit) { return container[G.id(eit)]; }
    53   };
    53   };
    54 
    54 
    55 } // namespace marci
    55 } // namespace hugo
    56 
    56 
    57 #endif //MARCI_PROPERTY_VECTOR_HH
    57 #endif //MARCI_PROPERTY_VECTOR_HH