alpar@906: /* -*- C++ -*- alpar@906: * alpar@1956: * This file is a part of LEMON, a generic C++ optimization library alpar@1956: * alpar@1956: * Copyright (C) 2003-2006 alpar@1956: * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport alpar@1956: * (Egervary Research Group on Combinatorial Optimization, EGRES). alpar@906: * alpar@906: * Permission to use, modify and distribute this software is granted alpar@906: * provided that this copyright notice appears in all copies. For alpar@906: * precise terms see the accompanying LICENSE file. alpar@906: * alpar@906: * This software is provided "AS IS" with no warranty of any kind, alpar@906: * express or implied, and with no claim as to its suitability for any alpar@906: * purpose. alpar@906: * alpar@906: */ alpar@906: deba@1999: #ifndef LEMON_BITS_DEFAULT_MAP_H deba@1999: #define LEMON_BITS_DEFAULT_MAP_H deba@822: deba@822: deba@1307: #include deba@1307: #include deba@822: deba@1996: ///\ingroup graphbits deba@822: ///\file deba@1999: ///\brief Graph maps that construct and destruct their elements dynamically. deba@822: alpar@921: namespace lemon { deba@1966: deba@1979: deba@1979: #ifndef _GLIBCXX_DEBUG deba@822: deba@1966: template deba@1966: struct DefaultMapSelector { deba@1966: typedef ArrayMap<_Graph, _Item, _Value> Map; deba@1966: }; deba@1966: deba@1966: #else deba@822: deba@1267: template klao@946: struct DefaultMapSelector { deba@1965: typedef VectorMap<_Graph, _Item, _Value> Map; klao@946: }; deba@822: deba@1966: #endif deba@1966: klao@946: // bool deba@1267: template deba@1267: struct DefaultMapSelector<_Graph, _Item, bool> { deba@980: typedef VectorMap<_Graph, _Item, bool> Map; klao@946: }; deba@822: klao@946: // char deba@1267: template deba@1267: struct DefaultMapSelector<_Graph, _Item, char> { deba@980: typedef VectorMap<_Graph, _Item, char> Map; klao@946: }; deba@822: deba@1267: template deba@1267: struct DefaultMapSelector<_Graph, _Item, signed char> { deba@980: typedef VectorMap<_Graph, _Item, signed char> Map; klao@946: }; deba@822: deba@1267: template deba@1267: struct DefaultMapSelector<_Graph, _Item, unsigned char> { deba@980: typedef VectorMap<_Graph, _Item, unsigned char> Map; klao@946: }; deba@822: deba@822: klao@946: // int deba@1267: template deba@1267: struct DefaultMapSelector<_Graph, _Item, signed int> { deba@980: typedef VectorMap<_Graph, _Item, signed int> Map; klao@946: }; deba@822: deba@1267: template deba@1267: struct DefaultMapSelector<_Graph, _Item, unsigned int> { deba@980: typedef VectorMap<_Graph, _Item, unsigned int> Map; klao@946: }; deba@822: deba@822: klao@946: // short deba@1267: template deba@1267: struct DefaultMapSelector<_Graph, _Item, signed short> { deba@980: typedef VectorMap<_Graph, _Item, signed short> Map; klao@946: }; deba@822: deba@1267: template deba@1267: struct DefaultMapSelector<_Graph, _Item, unsigned short> { deba@980: typedef VectorMap<_Graph, _Item, unsigned short> Map; klao@946: }; klao@946: klao@946: klao@946: // long deba@1267: template deba@1267: struct DefaultMapSelector<_Graph, _Item, signed long> { deba@980: typedef VectorMap<_Graph, _Item, signed long> Map; klao@946: }; klao@946: deba@1267: template deba@1267: struct DefaultMapSelector<_Graph, _Item, unsigned long> { deba@980: typedef VectorMap<_Graph, _Item, unsigned long> Map; klao@946: }; klao@946: deba@1965: deba@1965: #ifndef __STRICT_ANSI__ deba@1965: deba@1965: // long long deba@1965: template deba@1965: struct DefaultMapSelector<_Graph, _Item, signed long long> { deba@1965: typedef VectorMap<_Graph, _Item, signed long long> Map; deba@1965: }; deba@1965: deba@1965: template deba@1965: struct DefaultMapSelector<_Graph, _Item, unsigned long long> { deba@1965: typedef VectorMap<_Graph, _Item, unsigned long long> Map; deba@1965: }; deba@1965: deba@1965: #endif klao@946: klao@946: klao@946: // float deba@1267: template deba@1267: struct DefaultMapSelector<_Graph, _Item, float> { deba@980: typedef VectorMap<_Graph, _Item, float> Map; klao@946: }; klao@946: klao@946: klao@946: // double deba@1267: template deba@1267: struct DefaultMapSelector<_Graph, _Item, double> { deba@980: typedef VectorMap<_Graph, _Item, double> Map; klao@946: }; klao@946: klao@946: klao@946: // long double deba@1267: template deba@1267: struct DefaultMapSelector<_Graph, _Item, long double> { deba@980: typedef VectorMap<_Graph, _Item, long double> Map; klao@946: }; klao@946: klao@946: klao@946: // pointer deba@1267: template deba@1267: struct DefaultMapSelector<_Graph, _Item, _Ptr*> { deba@980: typedef VectorMap<_Graph, _Item, _Ptr*> Map; klao@946: }; klao@946: deba@1669: /// \e deba@1999: template deba@1267: class DefaultMap deba@1267: : public DefaultMapSelector<_Graph, _Item, _Value>::Map { klao@946: public: deba@1267: typedef typename DefaultMapSelector<_Graph, _Item, _Value>::Map Parent; deba@1267: typedef DefaultMap<_Graph, _Item, _Value> Map; klao@946: klao@946: typedef typename Parent::Graph Graph; alpar@987: typedef typename Parent::Value Value; klao@946: deba@1999: DefaultMap(const Graph& graph) : Parent(graph) {} deba@1999: DefaultMap(const Graph& graph, const Value& value) deba@1999: : Parent(graph, value) {} deba@1669: klao@946: }; klao@946: deba@822: } deba@822: deba@822: #endif