COIN-OR::LEMON - Graph Library

Ignore:
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • .hgignore

    r298 r514  
    2323lemon/stamp-h2
    2424doc/Doxyfile
     25cmake/cmake.version
    2526.dirstamp
    2627.libs/*
  • CMakeLists.txt

    r503 r515  
    1414INCLUDE(FindDoxygen)
    1515INCLUDE(FindGhostscript)
     16
     17INCLUDE(CheckTypeSize)
     18CHECK_TYPE_SIZE("long long" LONG_LONG)
    1619
    1720ENABLE_TESTING()
  • configure.ac

    r503 r515  
    2424dnl Do compilation tests using the C++ compiler.
    2525AC_LANG([C++])
     26
     27dnl Check the existence of long long type.
     28AC_CHECK_TYPE(long long, [long_long_found=yes], [long_long_found=no])
     29if test x"$long_long_found" = x"yes"; then
     30  AC_DEFINE([HAVE_LONG_LONG], [1], [Define to 1 if you have long long.])
     31fi
    2632
    2733dnl Checks for programs.
     
    117123echo C++ compiles flags............ : $CXXFLAGS
    118124echo
     125echo Compiler supports long long... : $long_long_found
     126echo
    119127#echo GLPK support.................. : $lx_glpk_found
    120128#echo CPLEX support................. : $lx_cplex_found
  • lemon/bits/default_map.h

    r314 r515  
    9797
    9898
    99 #if defined __GNUC__ && !defined __STRICT_ANSI__
     99#if defined HAVE_LONG_LONG
    100100
    101101  // long long
  • lemon/bits/windows.cc

    r511 r513  
    2929#define NOMINMAX
    3030#endif
     31#ifdef UNICODE
     32#undef UNICODE
     33#endif
    3134#include <windows.h>
     35#ifdef LOCALE_INVARIANT
     36#define MY_LOCALE LOCALE_INVARIANT
     37#else
     38#define MY_LOCALE LOCALE_NEUTRAL
     39#endif
    3240#else
    3341#include <unistd.h>
     
    8896      SYSTEMTIME time;
    8997      GetSystemTime(&time);
    90 #if defined(_MSC_VER) && (_MSC_VER < 1500)
    91       LPWSTR buf1, buf2, buf3;
    92       if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
    93                         L"ddd MMM dd", buf1, 11) &&
    94           GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time,
    95                         L"HH':'mm':'ss", buf2, 9) &&
    96           GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
    97                         L"yyyy", buf3, 5)) {
     98      char buf1[11], buf2[9], buf3[5];
     99          if (GetDateFormat(MY_LOCALE, 0, &time,
     100                        ("ddd MMM dd"), buf1, 11) &&
     101          GetTimeFormat(MY_LOCALE, 0, &time,
     102                        ("HH':'mm':'ss"), buf2, 9) &&
     103          GetDateFormat(MY_LOCALE, 0, &time,
     104                        ("yyyy"), buf3, 5)) {
    98105        os << buf1 << ' ' << buf2 << ' ' << buf3;
    99106      }
    100 #else
    101       char buf1[11], buf2[9], buf3[5];
    102       if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
    103                         "ddd MMM dd", buf1, 11) &&
    104           GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time,
    105                         "HH':'mm':'ss", buf2, 9) &&
    106           GetDateFormat(LOCALE_USER_DEFAULT, 0, &time,
    107                         "yyyy", buf3, 5)) {
    108         os << buf1 << ' ' << buf2 << ' ' << buf3;
    109       }
    110 #endif
    111107      else os << "unknown";
    112108#else
  • lemon/config.h.in

    r1 r515  
    44/* Define to 1 if you have GLPK. */
    55#undef HAVE_GLPK
     6
     7/* Define to 1 if you have long long */
     8#undef HAVE_LONG_LONG
  • lemon/tolerance.h

    r280 r516  
    3939  ///as a result of a probably inexact computation.
    4040  ///
    41   ///This is an abstract class, it should be specialized for all
    42   ///numerical data types. These specialized classes like
     41  ///The general implementation is suitable only if the data type is exact,
     42  ///like the integer types, otherwise a specialized version must be
     43  ///implemented. These specialized classes like
    4344  ///Tolerance<double> may offer additional tuning parameters.
    4445  ///
     
    4647  ///\sa Tolerance<double>
    4748  ///\sa Tolerance<long double>
    48   ///\sa Tolerance<int>
    49   ///\sa Tolerance<long long int>
    50   ///\sa Tolerance<unsigned int>
    51   ///\sa Tolerance<unsigned long long int>
    5249
    5350  template<class T>
     
    6562
    6663    ///Returns \c true if \c a is \e surely strictly less than \c b
    67     static bool less(Value a,Value b) {return false;}
    68     ///Returns \c true if \c a is \e surely different from \c b
    69     static bool different(Value a,Value b) {return false;}
    70     ///Returns \c true if \c a is \e surely positive
    71     static bool positive(Value a) {return false;}
    72     ///Returns \c true if \c a is \e surely negative
    73     static bool negative(Value a) {return false;}
    74     ///Returns \c true if \c a is \e surely non-zero
    75     static bool nonZero(Value a) {return false;}
     64    static bool less(Value a,Value b) {return a<b;}
     65    ///Returns \c true if \c a is \e surely different from \c b
     66    static bool different(Value a,Value b) {return a!=b;}
     67    ///Returns \c true if \c a is \e surely positive
     68    static bool positive(Value a) {return static_cast<Value>(0) < a;}
     69    ///Returns \c true if \c a is \e surely negative
     70    static bool negative(Value a) {return a < static_cast<Value>(0);}
     71    ///Returns \c true if \c a is \e surely non-zero
     72    static bool nonZero(Value a) {return a != static_cast<Value>(0);}
    7673
    7774    ///@}
    7875
    7976    ///Returns the zero value.
    80     static Value zero() {return T();}
     77    static Value zero() {return static_cast<Value>(0);}
    8178
    8279    //   static bool finite(Value a) {}
     
    239236  };
    240237
    241   ///Integer specialization of Tolerance.
    242 
    243   ///Integer specialization of Tolerance.
    244   ///\sa Tolerance
    245   template<>
    246   class Tolerance<int>
    247   {
    248   public:
    249     ///\e
    250     typedef int Value;
    251 
    252     ///\name Comparisons
    253     ///See \ref lemon::Tolerance "Tolerance" for more details.
    254 
    255     ///@{
    256 
    257     ///Returns \c true if \c a is \e surely strictly less than \c b
    258     static bool less(Value a,Value b) { return a<b;}
    259     ///Returns \c true if \c a is \e surely different from \c b
    260     static bool different(Value a,Value b) { return a!=b; }
    261     ///Returns \c true if \c a is \e surely positive
    262     static bool positive(Value a) { return 0<a; }
    263     ///Returns \c true if \c a is \e surely negative
    264     static bool negative(Value a) { return 0>a; }
    265     ///Returns \c true if \c a is \e surely non-zero
    266     static bool nonZero(Value a) { return a!=0; }
    267 
    268     ///@}
    269 
    270     ///Returns zero
    271     static Value zero() {return 0;}
    272   };
    273 
    274   ///Unsigned integer specialization of Tolerance.
    275 
    276   ///Unsigned integer specialization of Tolerance.
    277   ///\sa Tolerance
    278   template<>
    279   class Tolerance<unsigned int>
    280   {
    281   public:
    282     ///\e
    283     typedef unsigned int Value;
    284 
    285     ///\name Comparisons
    286     ///See \ref lemon::Tolerance "Tolerance" for more details.
    287 
    288     ///@{
    289 
    290     ///Returns \c true if \c a is \e surely strictly less than \c b
    291     static bool less(Value a,Value b) { return a<b;}
    292     ///Returns \c true if \c a is \e surely different from \c b
    293     static bool different(Value a,Value b) { return a!=b; }
    294     ///Returns \c true if \c a is \e surely positive
    295     static bool positive(Value a) { return 0<a; }
    296     ///Returns \c true if \c a is \e surely negative
    297     static bool negative(Value) { return false; }
    298     ///Returns \c true if \c a is \e surely non-zero
    299     static bool nonZero(Value a) { return a!=0; }
    300 
    301     ///@}
    302 
    303     ///Returns zero
    304     static Value zero() {return 0;}
    305   };
    306 
    307 
    308   ///Long integer specialization of Tolerance.
    309 
    310   ///Long integer specialization of Tolerance.
    311   ///\sa Tolerance
    312   template<>
    313   class Tolerance<long int>
    314   {
    315   public:
    316     ///\e
    317     typedef long int Value;
    318 
    319     ///\name Comparisons
    320     ///See \ref lemon::Tolerance "Tolerance" for more details.
    321 
    322     ///@{
    323 
    324     ///Returns \c true if \c a is \e surely strictly less than \c b
    325     static bool less(Value a,Value b) { return a<b;}
    326     ///Returns \c true if \c a is \e surely different from \c b
    327     static bool different(Value a,Value b) { return a!=b; }
    328     ///Returns \c true if \c a is \e surely positive
    329     static bool positive(Value a) { return 0<a; }
    330     ///Returns \c true if \c a is \e surely negative
    331     static bool negative(Value a) { return 0>a; }
    332     ///Returns \c true if \c a is \e surely non-zero
    333     static bool nonZero(Value a) { return a!=0;}
    334 
    335     ///@}
    336 
    337     ///Returns zero
    338     static Value zero() {return 0;}
    339   };
    340 
    341   ///Unsigned long integer specialization of Tolerance.
    342 
    343   ///Unsigned long integer specialization of Tolerance.
    344   ///\sa Tolerance
    345   template<>
    346   class Tolerance<unsigned long int>
    347   {
    348   public:
    349     ///\e
    350     typedef unsigned long int Value;
    351 
    352     ///\name Comparisons
    353     ///See \ref lemon::Tolerance "Tolerance" for more details.
    354 
    355     ///@{
    356 
    357     ///Returns \c true if \c a is \e surely strictly less than \c b
    358     static bool less(Value a,Value b) { return a<b;}
    359     ///Returns \c true if \c a is \e surely different from \c b
    360     static bool different(Value a,Value b) { return a!=b; }
    361     ///Returns \c true if \c a is \e surely positive
    362     static bool positive(Value a) { return 0<a; }
    363     ///Returns \c true if \c a is \e surely negative
    364     static bool negative(Value) { return false; }
    365     ///Returns \c true if \c a is \e surely non-zero
    366     static bool nonZero(Value a) { return a!=0;}
    367 
    368     ///@}
    369 
    370     ///Returns zero
    371     static Value zero() {return 0;}
    372   };
    373 
    374 #if defined __GNUC__ && !defined __STRICT_ANSI__
    375 
    376   ///Long long integer specialization of Tolerance.
    377 
    378   ///Long long integer specialization of Tolerance.
    379   ///\warning This class (more exactly, type <tt>long long</tt>)
    380   ///is not ansi compatible.
    381   ///\sa Tolerance
    382   template<>
    383   class Tolerance<long long int>
    384   {
    385   public:
    386     ///\e
    387     typedef long long int Value;
    388 
    389     ///\name Comparisons
    390     ///See \ref lemon::Tolerance "Tolerance" for more details.
    391 
    392     ///@{
    393 
    394     ///Returns \c true if \c a is \e surely strictly less than \c b
    395     static bool less(Value a,Value b) { return a<b;}
    396     ///Returns \c true if \c a is \e surely different from \c b
    397     static bool different(Value a,Value b) { return a!=b; }
    398     ///Returns \c true if \c a is \e surely positive
    399     static bool positive(Value a) { return 0<a; }
    400     ///Returns \c true if \c a is \e surely negative
    401     static bool negative(Value a) { return 0>a; }
    402     ///Returns \c true if \c a is \e surely non-zero
    403     static bool nonZero(Value a) { return a!=0;}
    404 
    405     ///@}
    406 
    407     ///Returns zero
    408     static Value zero() {return 0;}
    409   };
    410 
    411   ///Unsigned long long integer specialization of Tolerance.
    412 
    413   ///Unsigned long long integer specialization of Tolerance.
    414   ///\warning This class (more exactly, type <tt>unsigned long long</tt>)
    415   ///is not ansi compatible.
    416   ///\sa Tolerance
    417   template<>
    418   class Tolerance<unsigned long long int>
    419   {
    420   public:
    421     ///\e
    422     typedef unsigned long long int Value;
    423 
    424     ///\name Comparisons
    425     ///See \ref lemon::Tolerance "Tolerance" for more details.
    426 
    427     ///@{
    428 
    429     ///Returns \c true if \c a is \e surely strictly less than \c b
    430     static bool less(Value a,Value b) { return a<b;}
    431     ///Returns \c true if \c a is \e surely different from \c b
    432     static bool different(Value a,Value b) { return a!=b; }
    433     ///Returns \c true if \c a is \e surely positive
    434     static bool positive(Value a) { return 0<a; }
    435     ///Returns \c true if \c a is \e surely negative
    436     static bool negative(Value) { return false; }
    437     ///Returns \c true if \c a is \e surely non-zero
    438     static bool nonZero(Value a) { return a!=0;}
    439 
    440     ///@}
    441 
    442     ///Returns zero
    443     static Value zero() {return 0;}
    444   };
    445 
    446 #endif
    447 
    448238  /// @}
    449239
Note: See TracChangeset for help on using the changeset viewer.