| 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-2008 |
| 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 | 25 |
#include <lemon/bits/enable_if.h> |
| 26 | 26 |
#include <lemon/bits/traits.h> |
| 27 | 27 |
|
| 28 | 28 |
///\file |
| 29 | 29 |
///\brief LEMON core utilities. |
| 30 |
/// |
|
| 31 |
///This header file contains core utilities for LEMON. |
|
| 32 |
///It is automatically included by all graph types, therefore it usually |
|
| 33 |
///do not have to be included directly. |
|
| 30 | 34 |
|
| 31 | 35 |
namespace lemon {
|
| 32 | 36 |
|
| 33 | 37 |
/// \brief Dummy type to make it easier to create invalid iterators. |
| 34 | 38 |
/// |
| 35 | 39 |
/// Dummy type to make it easier to create invalid iterators. |
| 36 | 40 |
/// See \ref INVALID for the usage. |
| 37 | 41 |
struct Invalid {
|
| 38 | 42 |
public: |
| 39 | 43 |
bool operator==(Invalid) { return true; }
|
| 40 | 44 |
bool operator!=(Invalid) { return false; }
|
| 41 | 45 |
bool operator< (Invalid) { return false; }
|
| 42 | 46 |
}; |
| 43 | 47 |
|
| 44 | 48 |
/// \brief Invalid iterators. |
| 45 | 49 |
/// |
| 46 | 50 |
/// \ref Invalid is a global type that converts to each iterator |
| 47 | 51 |
/// in such a way that the value of the target iterator will be invalid. |
| 48 | 52 |
#ifdef LEMON_ONLY_TEMPLATES |
| 49 | 53 |
const Invalid INVALID = Invalid(); |
| 50 | 54 |
#else |
| 51 | 55 |
extern const Invalid INVALID; |
| 52 | 56 |
#endif |
| 53 | 57 |
|
| 54 | 58 |
/// \addtogroup gutils |
| 55 | 59 |
/// @{
|
| 56 | 60 |
|
| 57 | 61 |
///Creates convenience typedefs for the digraph types and iterators |
| 58 | 62 |
|
| 59 | 63 |
///This \c \#define creates convenience typedefs for the following types |
| 60 | 64 |
///of \c Digraph: \c Node, \c NodeIt, \c Arc, \c ArcIt, \c InArcIt, |
| 61 | 65 |
///\c OutArcIt, \c BoolNodeMap, \c IntNodeMap, \c DoubleNodeMap, |
| 62 | 66 |
///\c BoolArcMap, \c IntArcMap, \c DoubleArcMap. |
| 63 | 67 |
/// |
| 64 | 68 |
///\note If the graph type is a dependent type, ie. the graph type depend |
| 65 | 69 |
///on a template parameter, then use \c TEMPLATE_DIGRAPH_TYPEDEFS() |
| 66 | 70 |
///macro. |
| 67 | 71 |
#define DIGRAPH_TYPEDEFS(Digraph) \ |
| 68 | 72 |
typedef Digraph::Node Node; \ |
| 69 | 73 |
typedef Digraph::NodeIt NodeIt; \ |
| 70 | 74 |
typedef Digraph::Arc Arc; \ |
| 71 | 75 |
typedef Digraph::ArcIt ArcIt; \ |
| 72 | 76 |
typedef Digraph::InArcIt InArcIt; \ |
| 73 | 77 |
typedef Digraph::OutArcIt OutArcIt; \ |
| 74 | 78 |
typedef Digraph::NodeMap<bool> BoolNodeMap; \ |
| 75 | 79 |
typedef Digraph::NodeMap<int> IntNodeMap; \ |
| 76 | 80 |
typedef Digraph::NodeMap<double> DoubleNodeMap; \ |
| 77 | 81 |
typedef Digraph::ArcMap<bool> BoolArcMap; \ |
0 comments (0 inline)