1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 | 5 |
* Copyright (C) 2003-2009 |
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
7 | 7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES). |
8 | 8 |
* |
9 | 9 |
* Permission to use, modify and distribute this software is granted |
10 | 10 |
* provided that this copyright notice appears in all copies. For |
11 | 11 |
* precise terms see the accompanying LICENSE file. |
12 | 12 |
* |
13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
14 | 14 |
* express or implied, and with no claim as to its suitability for any |
15 | 15 |
* purpose. |
16 | 16 |
* |
17 | 17 |
*/ |
18 | 18 |
|
19 | 19 |
#ifndef LEMON_BITS_DEFAULT_MAP_H |
20 | 20 |
#define LEMON_BITS_DEFAULT_MAP_H |
21 | 21 |
|
22 |
#include <lemon/config.h> |
|
22 | 23 |
#include <lemon/bits/array_map.h> |
23 | 24 |
#include <lemon/bits/vector_map.h> |
24 | 25 |
//#include <lemon/bits/debug_map.h> |
25 | 26 |
|
26 | 27 |
//\ingroup graphbits |
27 | 28 |
//\file |
28 | 29 |
//\brief Graph maps that construct and destruct their elements dynamically. |
29 | 30 |
|
30 | 31 |
namespace lemon { |
31 | 32 |
|
32 | 33 |
|
33 | 34 |
//#ifndef LEMON_USE_DEBUG_MAP |
34 | 35 |
|
35 | 36 |
template <typename _Graph, typename _Item, typename _Value> |
36 | 37 |
struct DefaultMapSelector { |
37 | 38 |
typedef ArrayMap<_Graph, _Item, _Value> Map; |
38 | 39 |
}; |
39 | 40 |
|
40 | 41 |
// bool |
41 | 42 |
template <typename _Graph, typename _Item> |
42 | 43 |
struct DefaultMapSelector<_Graph, _Item, bool> { |
43 | 44 |
typedef VectorMap<_Graph, _Item, bool> Map; |
44 | 45 |
}; |
45 | 46 |
|
46 | 47 |
// char |
47 | 48 |
template <typename _Graph, typename _Item> |
48 | 49 |
struct DefaultMapSelector<_Graph, _Item, char> { |
49 | 50 |
typedef VectorMap<_Graph, _Item, char> Map; |
50 | 51 |
}; |
51 | 52 |
|
52 | 53 |
template <typename _Graph, typename _Item> |
53 | 54 |
struct DefaultMapSelector<_Graph, _Item, signed char> { |
54 | 55 |
typedef VectorMap<_Graph, _Item, signed char> Map; |
55 | 56 |
}; |
56 | 57 |
|
57 | 58 |
template <typename _Graph, typename _Item> |
58 | 59 |
struct DefaultMapSelector<_Graph, _Item, unsigned char> { |
59 | 60 |
typedef VectorMap<_Graph, _Item, unsigned char> Map; |
60 | 61 |
}; |
61 | 62 |
|
62 | 63 |
|
63 | 64 |
// int |
64 | 65 |
template <typename _Graph, typename _Item> |
65 | 66 |
struct DefaultMapSelector<_Graph, _Item, signed int> { |
66 | 67 |
typedef VectorMap<_Graph, _Item, signed int> Map; |
67 | 68 |
}; |
68 | 69 |
|
69 | 70 |
template <typename _Graph, typename _Item> |
1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 | 2 |
* |
3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
4 | 4 |
* |
5 | 5 |
* Copyright (C) 2003-2009 |
6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
7 | 7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES). |
8 | 8 |
* |
9 | 9 |
* Permission to use, modify and distribute this software is granted |
10 | 10 |
* provided that this copyright notice appears in all copies. For |
11 | 11 |
* precise terms see the accompanying LICENSE file. |
12 | 12 |
* |
13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
14 | 14 |
* express or implied, and with no claim as to its suitability for any |
15 | 15 |
* purpose. |
16 | 16 |
* |
17 | 17 |
*/ |
18 | 18 |
|
19 | 19 |
#ifndef LEMON_CORE_H |
20 | 20 |
#define LEMON_CORE_H |
21 | 21 |
|
22 | 22 |
#include <vector> |
23 | 23 |
#include <algorithm> |
24 | 24 |
|
25 |
#include <lemon/core.h> |
|
25 | 26 |
#include <lemon/bits/enable_if.h> |
26 | 27 |
#include <lemon/bits/traits.h> |
27 | 28 |
#include <lemon/assert.h> |
28 | 29 |
|
29 | 30 |
///\file |
30 | 31 |
///\brief LEMON core utilities. |
31 | 32 |
/// |
32 | 33 |
///This header file contains core utilities for LEMON. |
33 | 34 |
///It is automatically included by all graph types, therefore it usually |
34 | 35 |
///do not have to be included directly. |
35 | 36 |
|
36 | 37 |
namespace lemon { |
37 | 38 |
|
38 | 39 |
/// \brief Dummy type to make it easier to create invalid iterators. |
39 | 40 |
/// |
40 | 41 |
/// Dummy type to make it easier to create invalid iterators. |
41 | 42 |
/// See \ref INVALID for the usage. |
42 | 43 |
struct Invalid { |
43 | 44 |
public: |
44 | 45 |
bool operator==(Invalid) { return true; } |
45 | 46 |
bool operator!=(Invalid) { return false; } |
46 | 47 |
bool operator< (Invalid) { return false; } |
47 | 48 |
}; |
48 | 49 |
|
49 | 50 |
/// \brief Invalid iterators. |
50 | 51 |
/// |
51 | 52 |
/// \ref Invalid is a global type that converts to each iterator |
52 | 53 |
/// in such a way that the value of the target iterator will be invalid. |
53 | 54 |
#ifdef LEMON_ONLY_TEMPLATES |
54 | 55 |
const Invalid INVALID = Invalid(); |
55 | 56 |
#else |
56 | 57 |
extern const Invalid INVALID; |
57 | 58 |
#endif |
58 | 59 |
|
59 | 60 |
/// \addtogroup gutils |
60 | 61 |
/// @{ |
61 | 62 |
|
62 | 63 |
///Create convenience typedefs for the digraph types and iterators |
63 | 64 |
|
64 | 65 |
///This \c \#define creates convenient type definitions for the following |
65 | 66 |
///types of \c Digraph: \c Node, \c NodeIt, \c Arc, \c ArcIt, \c InArcIt, |
66 | 67 |
///\c OutArcIt, \c BoolNodeMap, \c IntNodeMap, \c DoubleNodeMap, |
67 | 68 |
///\c BoolArcMap, \c IntArcMap, \c DoubleArcMap. |
68 | 69 |
/// |
69 | 70 |
///\note If the graph type is a dependent type, ie. the graph type depend |
70 | 71 |
///on a template parameter, then use \c TEMPLATE_DIGRAPH_TYPEDEFS() |
71 | 72 |
///macro. |
72 | 73 |
#define DIGRAPH_TYPEDEFS(Digraph) \ |
0 comments (0 inline)