gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
Add long long checking to build systems (#230)
0 5 1
default
6 files changed with 17 insertions and 2 deletions:
↑ Collapse diff ↑
Ignore white space 268435456 line context
1
#cmakedefine HAVE_LONG_LONG 1
... ...
 No newline at end of file
Ignore white space 6 line context
1 1
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 2

	
3 3
IF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
4 4
  INCLUDE(${CMAKE_SOURCE_DIR}/cmake/version.cmake)
5 5
ELSE(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
6 6
  SET(PROJECT_NAME "LEMON")
7 7
  SET(PROJECT_VERSION "hg-tip" CACHE STRING "LEMON version string.")
8 8
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
9 9

	
10 10
PROJECT(${PROJECT_NAME})
11 11

	
12 12
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
13 13

	
14 14
INCLUDE(FindDoxygen)
15 15
INCLUDE(FindGhostscript)
16 16

	
17
INCLUDE(CheckTypeSize)
18
CHECK_TYPE_SIZE("long long" LONG_LONG)
19

	
17 20
ENABLE_TESTING()
18 21

	
19 22
ADD_SUBDIRECTORY(lemon)
20 23
ADD_SUBDIRECTORY(demo)
21 24
ADD_SUBDIRECTORY(doc)
22 25
ADD_SUBDIRECTORY(test)
23 26

	
24 27
IF(WIN32)
25 28
  SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
26 29
  SET(CPACK_PACKAGE_VENDOR "EGRES")
27 30
  SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
28 31
    "LEMON - Library of Efficient Models and Optimization in Networks")
29 32
  SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
30 33

	
31 34
  SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
32 35

	
33 36
  SET(CPACK_PACKAGE_INSTALL_DIRECTORY
34 37
    "${PROJECT_NAME} ${PROJECT_VERSION}")
35 38
  SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
36 39
    "${PROJECT_NAME} ${PROJECT_VERSION}")
37 40

	
38 41
  SET(CPACK_COMPONENTS_ALL headers library html_documentation)
39 42

	
40 43
  SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers")
41 44
  SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library")
42 45
  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation")
43 46

	
44 47
  SET(CPACK_COMPONENT_HEADERS_DESCRIPTION
45 48
    "C++ header files")
46 49
  SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION
47 50
    "DLL and import library")
48 51
  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION
49 52
    "Doxygen generated documentation")
50 53

	
51 54
  SET(CPACK_COMPONENT_HEADERS_DEPENDS library)
52 55

	
53 56
  SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
54 57
  SET(CPACK_COMPONENT_LIBRARY_GROUP "Development")
55 58
  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation")
56 59

	
57 60
  SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION
58 61
    "Components needed to develop software using LEMON")
59 62
  SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION
60 63
    "Documentation of LEMON")
61 64

	
62 65
  SET(CPACK_ALL_INSTALL_TYPES Full Developer)
63 66

	
64 67
  SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
65 68
  SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full)
66 69
  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full)
67 70

	
68 71
  SET(CPACK_GENERATOR "NSIS")
69 72
  SET(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/cmake/nsis/lemon.ico")
70 73
  SET(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/cmake/nsis/uninstall.ico")
71 74
  #SET(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/cmake/nsis\\\\installer.bmp")
72 75
  SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico")
73 76
  SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}")
74 77
  SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu")
75 78
  SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu")
76 79
  SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu")
77 80
  SET(CPACK_NSIS_CREATE_ICONS_EXTRA "
78 81
    CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\doc\\\\index.html\\\"
79 82
    ")
80 83
  SET(CPACK_NSIS_DELETE_ICONS_EXTRA "
81 84
    !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
82 85
    Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\"
83 86
    ")
84 87

	
85 88
  INCLUDE(CPack)
86 89
ENDIF(WIN32)
Ignore white space 6 line context
1 1
dnl Process this file with autoconf to produce a configure script.
2 2

	
3 3
dnl Version information.
4 4
m4_define([lemon_version_number],
5 5
	[m4_normalize(esyscmd([echo ${LEMON_VERSION}]))])
6 6
dnl m4_define([lemon_version_number], [])
7 7
m4_define([lemon_hg_path], [m4_normalize(esyscmd([./scripts/chg-len.py]))])
8 8
m4_define([lemon_hg_revision], [m4_normalize(esyscmd([hg id -i]))])
9 9
m4_define([lemon_version], [ifelse(lemon_version_number(),
10 10
			   [],
11 11
			   [lemon_hg_path().lemon_hg_revision()],
12 12
			   [lemon_version_number()])])
13 13

	
14 14
AC_PREREQ([2.59])
15 15
AC_INIT([LEMON], [lemon_version()], [lemon-user@lemon.cs.elte.hu], [lemon])
16 16
AC_CONFIG_AUX_DIR([build-aux])
17 17
AC_CONFIG_MACRO_DIR([m4])
18 18
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects nostdinc])
19 19
AC_CONFIG_SRCDIR([lemon/list_graph.h])
20 20
AC_CONFIG_HEADERS([config.h lemon/config.h])
21 21

	
22 22
lx_cmdline_cxxflags_set=${CXXFLAGS+set}
23 23

	
24 24
dnl Do compilation tests using the C++ compiler.
25 25
AC_LANG([C++])
26 26

	
27
dnl Check the existence of long long type.
28
AC_CHECK_TYPE(long long, [long_long_found=yes], [long_long_found=no])
29
if test x"$long_long_found" = x"yes"; then
30
  AC_DEFINE([HAVE_LONG_LONG], [1], [Define to 1 if you have long long.])
31
fi
32

	
27 33
dnl Checks for programs.
28 34
AC_PROG_CXX
29 35
AC_PROG_CXXCPP
30 36
AC_PROG_INSTALL
31 37
AC_DISABLE_SHARED
32 38
AC_PROG_LIBTOOL
33 39

	
34 40
AC_CHECK_PROG([doxygen_found],[doxygen],[yes],[no])
35 41
AC_CHECK_PROG([gs_found],[gs],[yes],[no])
36 42

	
37 43
dnl Detect Intel compiler.
38 44
AC_MSG_CHECKING([whether we are using the Intel C++ compiler])
39 45
AC_COMPILE_IFELSE([#ifndef __INTEL_COMPILER
40 46
choke me
41 47
#endif], [ICC=[yes]], [ICC=[no]])
42 48
if test x"$ICC" = x"yes"; then
43 49
  AC_MSG_RESULT([yes])
44 50
else
45 51
  AC_MSG_RESULT([no])
46 52
fi
47 53

	
48 54
dnl Set custom compiler flags when using g++.
49 55
if test x"$lx_cmdline_cxxflags_set" != x"set" -a "$GXX" = yes -a "$ICC" = no; then
50 56
  CXXFLAGS="$CXXFLAGS -Wall -W -Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -Woverloaded-virtual -ansi -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas"
51 57
fi
52 58

	
53 59
dnl Checks for libraries.
54 60
#LX_CHECK_GLPK
55 61
#LX_CHECK_CPLEX
56 62
#LX_CHECK_SOPLEX
57 63

	
58 64
dnl Disable/enable building the demo programs.
59 65
AC_ARG_ENABLE([demo],
60 66
AS_HELP_STRING([--enable-demo], [build the demo programs])
61 67
AS_HELP_STRING([--disable-demo], [do not build the demo programs @<:@default@:>@]),
62 68
              [], [enable_demo=no])
63 69
AC_MSG_CHECKING([whether to build the demo programs])
64 70
if test x"$enable_demo" != x"no"; then
65 71
  AC_MSG_RESULT([yes])
66 72
else
67 73
  AC_MSG_RESULT([no])
68 74
fi
69 75
AM_CONDITIONAL([WANT_DEMO], [test x"$enable_demo" != x"no"])
70 76

	
71 77
dnl Disable/enable building the binary tools.
72 78
AC_ARG_ENABLE([tools],
73 79
AS_HELP_STRING([--enable-tools], [build additional tools @<:@default@:>@])
74 80
AS_HELP_STRING([--disable-tools], [do not build additional tools]),
75 81
              [], [enable_tools=yes])
76 82
AC_MSG_CHECKING([whether to build the additional tools])
77 83
if test x"$enable_tools" != x"no"; then
78 84
  AC_MSG_RESULT([yes])
79 85
else
80 86
  AC_MSG_RESULT([no])
81 87
fi
82 88
AM_CONDITIONAL([WANT_TOOLS], [test x"$enable_tools" != x"no"])
83 89

	
84 90
dnl Checks for header files.
85 91
AC_CHECK_HEADERS(limits.h sys/time.h sys/times.h unistd.h)
86 92

	
87 93
dnl Checks for typedefs, structures, and compiler characteristics.
88 94
AC_C_CONST
89 95
AC_C_INLINE
90 96
AC_TYPE_SIZE_T
91 97
AC_HEADER_TIME
92 98
AC_STRUCT_TM
93 99

	
94 100
dnl Checks for library functions.
95 101
AC_HEADER_STDC
96 102
AC_CHECK_FUNCS(gettimeofday times ctime_r)
97 103

	
98 104
dnl Add dependencies on files generated by configure.
99 105
AC_SUBST([CONFIG_STATUS_DEPENDENCIES],
100 106
  ['$(top_srcdir)/doc/Doxyfile.in $(top_srcdir)/lemon/lemon.pc.in $(top_srcdir)/cmake/version.cmake.in'])
101 107

	
102 108
AC_CONFIG_FILES([
103 109
Makefile
104 110
cmake/version.cmake
105 111
doc/Doxyfile
106 112
lemon/lemon.pc
107 113
])
108 114

	
109 115
AC_OUTPUT
110 116

	
111 117
echo
112 118
echo '****************************** SUMMARY ******************************'
113 119
echo
114 120
echo Package version............... : $PACKAGE-$VERSION
115 121
echo
116 122
echo C++ compiler.................. : $CXX
117 123
echo C++ compiles flags............ : $CXXFLAGS
118 124
echo
125
echo Compiler supports long long... : $long_long_found
126
echo
119 127
#echo GLPK support.................. : $lx_glpk_found
120 128
#echo CPLEX support................. : $lx_cplex_found
121 129
#echo SOPLEX support................ : $lx_soplex_found
122 130
#echo
123 131
echo Build demo programs........... : $enable_demo
124 132
echo Build additional tools........ : $enable_tools
125 133
echo
126 134
echo The packace will be installed in
127 135
echo -n '  '
128 136
echo $prefix.
129 137
echo
130 138
echo '*********************************************************************'
131 139

	
132 140
echo
133 141
echo Configure complete, now type \'make\' and then \'make install\'.
134 142
echo
Ignore white space 6 line context
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_BITS_DEFAULT_MAP_H
20 20
#define LEMON_BITS_DEFAULT_MAP_H
21 21

	
22 22
#include <lemon/bits/array_map.h>
23 23
#include <lemon/bits/vector_map.h>
24 24
//#include <lemon/bits/debug_map.h>
25 25

	
26 26
//\ingroup graphbits
27 27
//\file
28 28
//\brief Graph maps that construct and destruct their elements dynamically.
29 29

	
30 30
namespace lemon {
31 31

	
32 32

	
33 33
  //#ifndef LEMON_USE_DEBUG_MAP
34 34

	
35 35
  template <typename _Graph, typename _Item, typename _Value>
36 36
  struct DefaultMapSelector {
37 37
    typedef ArrayMap<_Graph, _Item, _Value> Map;
38 38
  };
39 39

	
40 40
  // bool
41 41
  template <typename _Graph, typename _Item>
42 42
  struct DefaultMapSelector<_Graph, _Item, bool> {
43 43
    typedef VectorMap<_Graph, _Item, bool> Map;
44 44
  };
45 45

	
46 46
  // char
47 47
  template <typename _Graph, typename _Item>
48 48
  struct DefaultMapSelector<_Graph, _Item, char> {
49 49
    typedef VectorMap<_Graph, _Item, char> Map;
50 50
  };
51 51

	
52 52
  template <typename _Graph, typename _Item>
53 53
  struct DefaultMapSelector<_Graph, _Item, signed char> {
54 54
    typedef VectorMap<_Graph, _Item, signed char> Map;
55 55
  };
56 56

	
57 57
  template <typename _Graph, typename _Item>
58 58
  struct DefaultMapSelector<_Graph, _Item, unsigned char> {
59 59
    typedef VectorMap<_Graph, _Item, unsigned char> Map;
60 60
  };
61 61

	
62 62

	
63 63
  // int
64 64
  template <typename _Graph, typename _Item>
65 65
  struct DefaultMapSelector<_Graph, _Item, signed int> {
66 66
    typedef VectorMap<_Graph, _Item, signed int> Map;
67 67
  };
68 68

	
69 69
  template <typename _Graph, typename _Item>
70 70
  struct DefaultMapSelector<_Graph, _Item, unsigned int> {
71 71
    typedef VectorMap<_Graph, _Item, unsigned int> Map;
72 72
  };
73 73

	
74 74

	
75 75
  // short
76 76
  template <typename _Graph, typename _Item>
77 77
  struct DefaultMapSelector<_Graph, _Item, signed short> {
78 78
    typedef VectorMap<_Graph, _Item, signed short> Map;
79 79
  };
80 80

	
81 81
  template <typename _Graph, typename _Item>
82 82
  struct DefaultMapSelector<_Graph, _Item, unsigned short> {
83 83
    typedef VectorMap<_Graph, _Item, unsigned short> Map;
84 84
  };
85 85

	
86 86

	
87 87
  // long
88 88
  template <typename _Graph, typename _Item>
89 89
  struct DefaultMapSelector<_Graph, _Item, signed long> {
90 90
    typedef VectorMap<_Graph, _Item, signed long> Map;
91 91
  };
92 92

	
93 93
  template <typename _Graph, typename _Item>
94 94
  struct DefaultMapSelector<_Graph, _Item, unsigned long> {
95 95
    typedef VectorMap<_Graph, _Item, unsigned long> Map;
96 96
  };
97 97

	
98 98

	
99
#if defined __GNUC__ && !defined __STRICT_ANSI__
99
#if defined HAVE_LONG_LONG
100 100

	
101 101
  // long long
102 102
  template <typename _Graph, typename _Item>
103 103
  struct DefaultMapSelector<_Graph, _Item, signed long long> {
104 104
    typedef VectorMap<_Graph, _Item, signed long long> Map;
105 105
  };
106 106

	
107 107
  template <typename _Graph, typename _Item>
108 108
  struct DefaultMapSelector<_Graph, _Item, unsigned long long> {
109 109
    typedef VectorMap<_Graph, _Item, unsigned long long> Map;
110 110
  };
111 111

	
112 112
#endif
113 113

	
114 114

	
115 115
  // float
116 116
  template <typename _Graph, typename _Item>
117 117
  struct DefaultMapSelector<_Graph, _Item, float> {
118 118
    typedef VectorMap<_Graph, _Item, float> Map;
119 119
  };
120 120

	
121 121

	
122 122
  // double
123 123
  template <typename _Graph, typename _Item>
124 124
  struct DefaultMapSelector<_Graph, _Item, double> {
125 125
    typedef VectorMap<_Graph, _Item,  double> Map;
126 126
  };
127 127

	
128 128

	
129 129
  // long double
130 130
  template <typename _Graph, typename _Item>
131 131
  struct DefaultMapSelector<_Graph, _Item, long double> {
132 132
    typedef VectorMap<_Graph, _Item, long double> Map;
133 133
  };
134 134

	
135 135

	
136 136
  // pointer
137 137
  template <typename _Graph, typename _Item, typename _Ptr>
138 138
  struct DefaultMapSelector<_Graph, _Item, _Ptr*> {
139 139
    typedef VectorMap<_Graph, _Item, _Ptr*> Map;
140 140
  };
141 141

	
142 142
// #else
143 143

	
144 144
//   template <typename _Graph, typename _Item, typename _Value>
145 145
//   struct DefaultMapSelector {
146 146
//     typedef DebugMap<_Graph, _Item, _Value> Map;
147 147
//   };
148 148

	
149 149
// #endif
150 150

	
151 151
  // DefaultMap class
152 152
  template <typename _Graph, typename _Item, typename _Value>
153 153
  class DefaultMap
154 154
    : public DefaultMapSelector<_Graph, _Item, _Value>::Map {
155 155
  public:
156 156
    typedef typename DefaultMapSelector<_Graph, _Item, _Value>::Map Parent;
157 157
    typedef DefaultMap<_Graph, _Item, _Value> Map;
158 158

	
159 159
    typedef typename Parent::Graph Graph;
160 160
    typedef typename Parent::Value Value;
161 161

	
162 162
    explicit DefaultMap(const Graph& graph) : Parent(graph) {}
163 163
    DefaultMap(const Graph& graph, const Value& value)
164 164
      : Parent(graph, value) {}
165 165

	
166 166
    DefaultMap& operator=(const DefaultMap& cmap) {
167 167
      return operator=<DefaultMap>(cmap);
168 168
    }
169 169

	
170 170
    template <typename CMap>
171 171
    DefaultMap& operator=(const CMap& cmap) {
172 172
      Parent::operator=(cmap);
173 173
      return *this;
174 174
    }
175 175

	
176 176
  };
177 177

	
178 178
}
179 179

	
180 180
#endif
Ignore white space 6 line context
1 1
/* Define to 1 if you have CPLEX. */
2 2
#undef HAVE_CPLEX
3 3

	
4 4
/* Define to 1 if you have GLPK. */
5 5
#undef HAVE_GLPK
6

	
7
/* Define to 1 if you have long long */
8
#undef HAVE_LONG_LONG
Ignore white space 6 line context
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_TOLERANCE_H
20 20
#define LEMON_TOLERANCE_H
21 21

	
22 22
///\ingroup misc
23 23
///\file
24 24
///\brief A basic tool to handle the anomalies of calculation with
25 25
///floating point numbers.
26 26
///
27 27

	
28 28
namespace lemon {
29 29

	
30 30
  /// \addtogroup misc
31 31
  /// @{
32 32

	
33 33
  ///\brief A class to provide a basic way to
34 34
  ///handle the comparison of numbers that are obtained
35 35
  ///as a result of a probably inexact computation.
36 36
  ///
37 37
  ///\ref Tolerance is a class to provide a basic way to
38 38
  ///handle the comparison of numbers that are obtained
39 39
  ///as a result of a probably inexact computation.
40 40
  ///
41 41
  ///This is an abstract class, it should be specialized for all
42 42
  ///numerical data types. These specialized classes like
43 43
  ///Tolerance<double> may offer additional tuning parameters.
44 44
  ///
45 45
  ///\sa Tolerance<float>
46 46
  ///\sa Tolerance<double>
47 47
  ///\sa Tolerance<long double>
48 48
  ///\sa Tolerance<int>
49 49
  ///\sa Tolerance<long long int>
50 50
  ///\sa Tolerance<unsigned int>
51 51
  ///\sa Tolerance<unsigned long long int>
52 52

	
53 53
  template<class T>
54 54
  class Tolerance
55 55
  {
56 56
  public:
57 57
    typedef T Value;
58 58

	
59 59
    ///\name Comparisons
60 60
    ///The concept is that these bool functions return \c true only if
61 61
    ///the related comparisons hold even if some numerical error appeared
62 62
    ///during the computations.
63 63

	
64 64
    ///@{
65 65

	
66 66
    ///Returns \c true if \c a is \e surely strictly less than \c b
67 67
    static bool less(Value a,Value b) {return false;}
68 68
    ///Returns \c true if \c a is \e surely different from \c b
69 69
    static bool different(Value a,Value b) {return false;}
70 70
    ///Returns \c true if \c a is \e surely positive
71 71
    static bool positive(Value a) {return false;}
72 72
    ///Returns \c true if \c a is \e surely negative
73 73
    static bool negative(Value a) {return false;}
74 74
    ///Returns \c true if \c a is \e surely non-zero
75 75
    static bool nonZero(Value a) {return false;}
76 76

	
77 77
    ///@}
78 78

	
79 79
    ///Returns the zero value.
80 80
    static Value zero() {return T();}
81 81

	
82 82
    //   static bool finite(Value a) {}
83 83
    //   static Value big() {}
84 84
    //   static Value negativeBig() {}
85 85
  };
86 86

	
87 87

	
88 88
  ///Float specialization of Tolerance.
89 89

	
90 90
  ///Float specialization of Tolerance.
91 91
  ///\sa Tolerance
92 92
  ///\relates Tolerance
93 93
  template<>
94 94
  class Tolerance<float>
95 95
  {
96 96
    static float def_epsilon;
97 97
    float _epsilon;
98 98
  public:
99 99
    ///\e
100 100
    typedef float Value;
101 101

	
102 102
    ///Constructor setting the epsilon tolerance to the default value.
103 103
    Tolerance() : _epsilon(def_epsilon) {}
104 104
    ///Constructor setting the epsilon tolerance to the given value.
105 105
    Tolerance(float e) : _epsilon(e) {}
106 106

	
107 107
    ///Returns the epsilon value.
108 108
    Value epsilon() const {return _epsilon;}
109 109
    ///Sets the epsilon value.
110 110
    void epsilon(Value e) {_epsilon=e;}
111 111

	
112 112
    ///Returns the default epsilon value.
113 113
    static Value defaultEpsilon() {return def_epsilon;}
114 114
    ///Sets the default epsilon value.
115 115
    static void defaultEpsilon(Value e) {def_epsilon=e;}
116 116

	
117 117
    ///\name Comparisons
118 118
    ///See \ref lemon::Tolerance "Tolerance" for more details.
119 119

	
120 120
    ///@{
121 121

	
122 122
    ///Returns \c true if \c a is \e surely strictly less than \c b
123 123
    bool less(Value a,Value b) const {return a+_epsilon<b;}
124 124
    ///Returns \c true if \c a is \e surely different from \c b
125 125
    bool different(Value a,Value b) const { return less(a,b)||less(b,a); }
126 126
    ///Returns \c true if \c a is \e surely positive
127 127
    bool positive(Value a) const { return _epsilon<a; }
128 128
    ///Returns \c true if \c a is \e surely negative
129 129
    bool negative(Value a) const { return -_epsilon>a; }
130 130
    ///Returns \c true if \c a is \e surely non-zero
131 131
    bool nonZero(Value a) const { return positive(a)||negative(a); }
132 132

	
133 133
    ///@}
134 134

	
135 135
    ///Returns zero
136 136
    static Value zero() {return 0;}
137 137
  };
138 138

	
139 139
  ///Double specialization of Tolerance.
140 140

	
141 141
  ///Double specialization of Tolerance.
142 142
  ///\sa Tolerance
143 143
  ///\relates Tolerance
144 144
  template<>
145 145
  class Tolerance<double>
146 146
  {
147 147
    static double def_epsilon;
148 148
    double _epsilon;
149 149
  public:
150 150
    ///\e
151 151
    typedef double Value;
152 152

	
153 153
    ///Constructor setting the epsilon tolerance to the default value.
154 154
    Tolerance() : _epsilon(def_epsilon) {}
155 155
    ///Constructor setting the epsilon tolerance to the given value.
156 156
    Tolerance(double e) : _epsilon(e) {}
157 157

	
158 158
    ///Returns the epsilon value.
159 159
    Value epsilon() const {return _epsilon;}
160 160
    ///Sets the epsilon value.
161 161
    void epsilon(Value e) {_epsilon=e;}
162 162

	
163 163
    ///Returns the default epsilon value.
164 164
    static Value defaultEpsilon() {return def_epsilon;}
165 165
    ///Sets the default epsilon value.
166 166
    static void defaultEpsilon(Value e) {def_epsilon=e;}
167 167

	
168 168
    ///\name Comparisons
169 169
    ///See \ref lemon::Tolerance "Tolerance" for more details.
170 170

	
171 171
    ///@{
172 172

	
173 173
    ///Returns \c true if \c a is \e surely strictly less than \c b
174 174
    bool less(Value a,Value b) const {return a+_epsilon<b;}
175 175
    ///Returns \c true if \c a is \e surely different from \c b
176 176
    bool different(Value a,Value b) const { return less(a,b)||less(b,a); }
177 177
    ///Returns \c true if \c a is \e surely positive
178 178
    bool positive(Value a) const { return _epsilon<a; }
179 179
    ///Returns \c true if \c a is \e surely negative
180 180
    bool negative(Value a) const { return -_epsilon>a; }
181 181
    ///Returns \c true if \c a is \e surely non-zero
182 182
    bool nonZero(Value a) const { return positive(a)||negative(a); }
183 183

	
184 184
    ///@}
185 185

	
186 186
    ///Returns zero
187 187
    static Value zero() {return 0;}
188 188
  };
189 189

	
190 190
  ///Long double specialization of Tolerance.
191 191

	
192 192
  ///Long double specialization of Tolerance.
193 193
  ///\sa Tolerance
194 194
  ///\relates Tolerance
195 195
  template<>
196 196
  class Tolerance<long double>
197 197
  {
198 198
    static long double def_epsilon;
199 199
    long double _epsilon;
200 200
  public:
201 201
    ///\e
202 202
    typedef long double Value;
203 203

	
204 204
    ///Constructor setting the epsilon tolerance to the default value.
205 205
    Tolerance() : _epsilon(def_epsilon) {}
206 206
    ///Constructor setting the epsilon tolerance to the given value.
207 207
    Tolerance(long double e) : _epsilon(e) {}
208 208

	
209 209
    ///Returns the epsilon value.
210 210
    Value epsilon() const {return _epsilon;}
211 211
    ///Sets the epsilon value.
212 212
    void epsilon(Value e) {_epsilon=e;}
213 213

	
214 214
    ///Returns the default epsilon value.
215 215
    static Value defaultEpsilon() {return def_epsilon;}
216 216
    ///Sets the default epsilon value.
217 217
    static void defaultEpsilon(Value e) {def_epsilon=e;}
218 218

	
219 219
    ///\name Comparisons
220 220
    ///See \ref lemon::Tolerance "Tolerance" for more details.
221 221

	
222 222
    ///@{
223 223

	
224 224
    ///Returns \c true if \c a is \e surely strictly less than \c b
225 225
    bool less(Value a,Value b) const {return a+_epsilon<b;}
226 226
    ///Returns \c true if \c a is \e surely different from \c b
227 227
    bool different(Value a,Value b) const { return less(a,b)||less(b,a); }
228 228
    ///Returns \c true if \c a is \e surely positive
229 229
    bool positive(Value a) const { return _epsilon<a; }
230 230
    ///Returns \c true if \c a is \e surely negative
231 231
    bool negative(Value a) const { return -_epsilon>a; }
232 232
    ///Returns \c true if \c a is \e surely non-zero
233 233
    bool nonZero(Value a) const { return positive(a)||negative(a); }
234 234

	
235 235
    ///@}
236 236

	
237 237
    ///Returns zero
238 238
    static Value zero() {return 0;}
239 239
  };
240 240

	
241 241
  ///Integer specialization of Tolerance.
242 242

	
243 243
  ///Integer specialization of Tolerance.
244 244
  ///\sa Tolerance
245 245
  template<>
246 246
  class Tolerance<int>
247 247
  {
248 248
  public:
249 249
    ///\e
250 250
    typedef int Value;
251 251

	
252 252
    ///\name Comparisons
253 253
    ///See \ref lemon::Tolerance "Tolerance" for more details.
254 254

	
255 255
    ///@{
256 256

	
257 257
    ///Returns \c true if \c a is \e surely strictly less than \c b
258 258
    static bool less(Value a,Value b) { return a<b;}
259 259
    ///Returns \c true if \c a is \e surely different from \c b
260 260
    static bool different(Value a,Value b) { return a!=b; }
261 261
    ///Returns \c true if \c a is \e surely positive
262 262
    static bool positive(Value a) { return 0<a; }
263 263
    ///Returns \c true if \c a is \e surely negative
264 264
    static bool negative(Value a) { return 0>a; }
265 265
    ///Returns \c true if \c a is \e surely non-zero
266 266
    static bool nonZero(Value a) { return a!=0; }
267 267

	
268 268
    ///@}
269 269

	
270 270
    ///Returns zero
271 271
    static Value zero() {return 0;}
272 272
  };
273 273

	
274 274
  ///Unsigned integer specialization of Tolerance.
275 275

	
276 276
  ///Unsigned integer specialization of Tolerance.
277 277
  ///\sa Tolerance
278 278
  template<>
279 279
  class Tolerance<unsigned int>
280 280
  {
281 281
  public:
282 282
    ///\e
283 283
    typedef unsigned int Value;
284 284

	
285 285
    ///\name Comparisons
286 286
    ///See \ref lemon::Tolerance "Tolerance" for more details.
287 287

	
288 288
    ///@{
289 289

	
290 290
    ///Returns \c true if \c a is \e surely strictly less than \c b
291 291
    static bool less(Value a,Value b) { return a<b;}
292 292
    ///Returns \c true if \c a is \e surely different from \c b
293 293
    static bool different(Value a,Value b) { return a!=b; }
294 294
    ///Returns \c true if \c a is \e surely positive
295 295
    static bool positive(Value a) { return 0<a; }
296 296
    ///Returns \c true if \c a is \e surely negative
297 297
    static bool negative(Value) { return false; }
298 298
    ///Returns \c true if \c a is \e surely non-zero
299 299
    static bool nonZero(Value a) { return a!=0; }
300 300

	
301 301
    ///@}
302 302

	
303 303
    ///Returns zero
304 304
    static Value zero() {return 0;}
305 305
  };
306 306

	
307 307

	
308 308
  ///Long integer specialization of Tolerance.
309 309

	
310 310
  ///Long integer specialization of Tolerance.
311 311
  ///\sa Tolerance
312 312
  template<>
313 313
  class Tolerance<long int>
314 314
  {
315 315
  public:
316 316
    ///\e
317 317
    typedef long int Value;
318 318

	
319 319
    ///\name Comparisons
320 320
    ///See \ref lemon::Tolerance "Tolerance" for more details.
321 321

	
322 322
    ///@{
323 323

	
324 324
    ///Returns \c true if \c a is \e surely strictly less than \c b
325 325
    static bool less(Value a,Value b) { return a<b;}
326 326
    ///Returns \c true if \c a is \e surely different from \c b
327 327
    static bool different(Value a,Value b) { return a!=b; }
328 328
    ///Returns \c true if \c a is \e surely positive
329 329
    static bool positive(Value a) { return 0<a; }
330 330
    ///Returns \c true if \c a is \e surely negative
331 331
    static bool negative(Value a) { return 0>a; }
332 332
    ///Returns \c true if \c a is \e surely non-zero
333 333
    static bool nonZero(Value a) { return a!=0;}
334 334

	
335 335
    ///@}
336 336

	
337 337
    ///Returns zero
338 338
    static Value zero() {return 0;}
339 339
  };
340 340

	
341 341
  ///Unsigned long integer specialization of Tolerance.
342 342

	
343 343
  ///Unsigned long integer specialization of Tolerance.
344 344
  ///\sa Tolerance
345 345
  template<>
346 346
  class Tolerance<unsigned long int>
347 347
  {
348 348
  public:
349 349
    ///\e
350 350
    typedef unsigned long int Value;
351 351

	
352 352
    ///\name Comparisons
353 353
    ///See \ref lemon::Tolerance "Tolerance" for more details.
354 354

	
355 355
    ///@{
356 356

	
357 357
    ///Returns \c true if \c a is \e surely strictly less than \c b
358 358
    static bool less(Value a,Value b) { return a<b;}
359 359
    ///Returns \c true if \c a is \e surely different from \c b
360 360
    static bool different(Value a,Value b) { return a!=b; }
361 361
    ///Returns \c true if \c a is \e surely positive
362 362
    static bool positive(Value a) { return 0<a; }
363 363
    ///Returns \c true if \c a is \e surely negative
364 364
    static bool negative(Value) { return false; }
365 365
    ///Returns \c true if \c a is \e surely non-zero
366 366
    static bool nonZero(Value a) { return a!=0;}
367 367

	
368 368
    ///@}
369 369

	
370 370
    ///Returns zero
371 371
    static Value zero() {return 0;}
372 372
  };
373 373

	
374
#if defined __GNUC__ && !defined __STRICT_ANSI__
374
#if HAVE_LONG_LONG 
375 375

	
376 376
  ///Long long integer specialization of Tolerance.
377 377

	
378 378
  ///Long long integer specialization of Tolerance.
379 379
  ///\warning This class (more exactly, type <tt>long long</tt>)
380 380
  ///is not ansi compatible.
381 381
  ///\sa Tolerance
382 382
  template<>
383 383
  class Tolerance<long long int>
384 384
  {
385 385
  public:
386 386
    ///\e
387 387
    typedef long long int Value;
388 388

	
389 389
    ///\name Comparisons
390 390
    ///See \ref lemon::Tolerance "Tolerance" for more details.
391 391

	
392 392
    ///@{
393 393

	
394 394
    ///Returns \c true if \c a is \e surely strictly less than \c b
395 395
    static bool less(Value a,Value b) { return a<b;}
396 396
    ///Returns \c true if \c a is \e surely different from \c b
397 397
    static bool different(Value a,Value b) { return a!=b; }
398 398
    ///Returns \c true if \c a is \e surely positive
399 399
    static bool positive(Value a) { return 0<a; }
400 400
    ///Returns \c true if \c a is \e surely negative
401 401
    static bool negative(Value a) { return 0>a; }
402 402
    ///Returns \c true if \c a is \e surely non-zero
403 403
    static bool nonZero(Value a) { return a!=0;}
404 404

	
405 405
    ///@}
406 406

	
407 407
    ///Returns zero
408 408
    static Value zero() {return 0;}
409 409
  };
410 410

	
411 411
  ///Unsigned long long integer specialization of Tolerance.
412 412

	
413 413
  ///Unsigned long long integer specialization of Tolerance.
414 414
  ///\warning This class (more exactly, type <tt>unsigned long long</tt>)
415 415
  ///is not ansi compatible.
416 416
  ///\sa Tolerance
417 417
  template<>
418 418
  class Tolerance<unsigned long long int>
419 419
  {
420 420
  public:
421 421
    ///\e
422 422
    typedef unsigned long long int Value;
423 423

	
424 424
    ///\name Comparisons
425 425
    ///See \ref lemon::Tolerance "Tolerance" for more details.
426 426

	
427 427
    ///@{
428 428

	
429 429
    ///Returns \c true if \c a is \e surely strictly less than \c b
430 430
    static bool less(Value a,Value b) { return a<b;}
431 431
    ///Returns \c true if \c a is \e surely different from \c b
432 432
    static bool different(Value a,Value b) { return a!=b; }
433 433
    ///Returns \c true if \c a is \e surely positive
434 434
    static bool positive(Value a) { return 0<a; }
435 435
    ///Returns \c true if \c a is \e surely negative
436 436
    static bool negative(Value) { return false; }
437 437
    ///Returns \c true if \c a is \e surely non-zero
438 438
    static bool nonZero(Value a) { return a!=0;}
439 439

	
440 440
    ///@}
441 441

	
442 442
    ///Returns zero
443 443
    static Value zero() {return 0;}
444 444
  };
445 445

	
446 446
#endif
447 447

	
448 448
  /// @}
449 449

	
450 450
} //namespace lemon
451 451

	
452 452
#endif //LEMON_TOLERANCE_H
0 comments (0 inline)