src/work/deba/map_defines.h
author alpar
Tue, 06 Jul 2004 11:28:20 +0000
changeset 696 48aa9ace1d7d
parent 674 7733d18de0e8
child 701 c03e073b8394
permissions -rw-r--r--
Example in the doc is corrected.
     1 // -*- c++ -*-
     2 #ifndef MAP_DEFINES_H
     3 #define MAP_DEFINES_H
     4 
     5 #define CREATE_EDGE_MAP_REGISTRY \
     6 typedef MapRegistry<Graph, Edge, EdgeIt> EdgeMapRegistry; \
     7 EdgeMapRegistry edge_maps;
     8 
     9 #define CREATE_NODE_MAP_REGISTRY \
    10 typedef MapRegistry<Graph, Node, NodeIt> NodeMapRegistry; \
    11 NodeMapRegistry node_maps;
    12 
    13 #define CREATE_MAP_REGISTRIES \
    14 CREATE_NODE_MAP_REGISTRY \
    15 CREATE_EDGE_MAP_REGISTRY
    16 
    17 #define CREATE_NODE_MAP_FACTORY(TemplateFactory) \
    18 typedef TemplateFactory<NodeMapRegistry> NodeMapFactory;
    19 
    20 #define CREATE_EDGE_MAP_FACTORY(TemplateFactory) \
    21 typedef TemplateFactory<EdgeMapRegistry> EdgeMapFactory;
    22 
    23 #define CREATE_MAP_FACTORIES(TemplateFactory) \
    24 CREATE_NODE_MAP_FACTORY(TemplateFactory) \
    25 CREATE_EDGE_MAP_FACTORY(TemplateFactory) 
    26 
    27 #define IMPORT_NODE_MAP(Factory) \
    28 template <typename V> \
    29 class NodeMap : public Factory::Map<V> { \
    30 public: \
    31 NodeMap() {} \
    32 NodeMap(Graph& g) : Factory::Map<V>(g, g.node_maps) {} \
    33 };
    34 
    35 #define IMPORT_EDGE_MAP(Factory) \
    36 template <typename V> \
    37 class EdgeMap : public Factory::Map<V> { \
    38 public: \
    39 EdgeMap() {} \
    40 EdgeMap(Graph& g) : Factory::Map<V>(g, g.edge_maps) {} \
    41 };
    42 
    43 #define CREATE_MAPS(TemplateFactory) \
    44 CREATE_MAP_FACTORIES(TemplateFactory) \
    45 IMPORT_NODE_MAP(NodeMapFactory) \
    46 IMPORT_EDGE_MAP(EdgeMapFactory)
    47 
    48 #endif