COIN-OR::LEMON - Graph Library

Changeset 701:c03e073b8394 in lemon-0.x for src/work/deba/map_defines.h


Ignore:
Timestamp:
07/14/04 12:06:27 (18 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@952
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/deba/map_defines.h

    r676 r701  
    33#define MAP_DEFINES_H
    44
     5/** Creates the EdgeMapRegistry type an declare a mutable instance
     6 *  named edge_maps.
     7 */
    58#define CREATE_EDGE_MAP_REGISTRY \
    69typedef MapRegistry<Graph, Edge, EdgeIt> EdgeMapRegistry; \
    7 EdgeMapRegistry edge_maps;
     10mutable EdgeMapRegistry edge_maps;
    811
     12/** Creates the NodeMapRegistry type an declare a mutable instance
     13 *  named node_maps.
     14 */
    915#define CREATE_NODE_MAP_REGISTRY \
    1016typedef MapRegistry<Graph, Node, NodeIt> NodeMapRegistry; \
    11 NodeMapRegistry node_maps;
     17mutable NodeMapRegistry node_maps;
    1218
     19/** Creates both map registries.
     20 */
    1321#define CREATE_MAP_REGISTRIES \
    1422CREATE_NODE_MAP_REGISTRY \
    1523CREATE_EDGE_MAP_REGISTRY
    1624
     25/** Creates a map a concrete factory type from a template map
     26 *  factory to use as node map factory.
     27 */
    1728#define CREATE_NODE_MAP_FACTORY(TemplateFactory) \
    1829typedef TemplateFactory<NodeMapRegistry> NodeMapFactory;
    1930
     31/** Creates a map a concrete factory type from a template map
     32 *  factory to use as edge map factory.
     33 */
    2034#define CREATE_EDGE_MAP_FACTORY(TemplateFactory) \
    2135typedef TemplateFactory<EdgeMapRegistry> EdgeMapFactory;
    2236
     37/** Creates both map factories.
     38 */
    2339#define CREATE_MAP_FACTORIES(TemplateFactory) \
    2440CREATE_NODE_MAP_FACTORY(TemplateFactory) \
    2541CREATE_EDGE_MAP_FACTORY(TemplateFactory)
    2642
     43/** Import a map from a concrete map factory. The import method is
     44 *  an overloading of the map type.
     45 *  The reason to use these macro is that the c++ does not support
     46 *  the template typedefs. If a future release of the c++
     47 *  supports this feature it should be fixed.
     48 */
    2749#define IMPORT_NODE_MAP(Factory) \
    2850template <typename V> \
     
    3052public: \
    3153NodeMap() {} \
    32 NodeMap(Graph& g) : Factory::Map<V>(g, g.node_maps) {} \
     54NodeMap(const Graph& g) : Factory::Map<V>(&g, &(g.node_maps)) {} \
     55NodeMap(const Graph& g, const V& v) : Factory::Map<V>(g, g.node_maps, v) {} \
     56NodeMap(const NodeMap& copy) : Factory::Map<V>(copy) {} \
     57template <typename CMap> NodeMap(const CMap& copy) : Factory::Map<V>(copy) {} \
     58NodeMap& operator=(const NodeMap& copy) { \
     59  this->Factory::Map<V>::operator=(copy); \
     60  return *this; \
     61} \
     62template <typename CMap>NodeMap& operator=(const CMap& copy) { \
     63  this->Factory::Map<V>::operator=<CMap>(copy); \
     64  return *this; \
     65} \
    3366};
    3467
     68/** Import a map from a concrete map factory. The import method is
     69 *  an overloading of the map type.
     70 *  The reason to use these macro is that the c++ does not support
     71 *  the template typedefs. If a future release of the c++
     72 *  supports this feature it should be fixed.
     73 */
    3574#define IMPORT_EDGE_MAP(Factory) \
    3675template <typename V> \
     
    3877public: \
    3978EdgeMap() {} \
    40 EdgeMap(Graph& g) : Factory::Map<V>(g, g.edge_maps) {} \
     79EdgeMap(const Graph& g) : Factory::Map<V>(g, g.edge_maps) {} \
     80EdgeMap(const Graph& g, const V& v) : Factory::Map<V>(g, g.node_maps, v) {} \
     81EdgeMap(const EdgeMap& copy) : Factory::Map<V>(copy) {} \
     82template <typename CMap> EdgeMap(const CMap& copy) : Factory::Map<V>(copy) {} \
     83EdgeMap& operator=(const EdgeMap& copy) { \
     84  this->Factory::Map<V>::operator=(copy); \
     85  return *this; \
     86} \
     87template <typename CMap>EdgeMap& operator=(const CMap& copy) { \
     88  this->Factory::Map<V>::operator=<CMap>(copy); \
     89  return *this; \
     90} \
    4191};
    4292
     93/** This macro creates both map factories and imports both maps.
     94 */
    4395#define CREATE_MAPS(TemplateFactory) \
    4496CREATE_MAP_FACTORIES(TemplateFactory) \
Note: See TracChangeset for help on using the changeset viewer.