source: tspsg/src/globals.h @ e4ae9e95f7

0.1.3.145-beta1-symbian0.1.4.170-beta2-bb10appveyorimgbotreadme
Last change on this file since e4ae9e95f7 was e4ae9e95f7, checked in by Oleksii Serdiuk, 15 years ago

Back to double to maintain compatibility between platforms.

  • Property mode set to 100644
File size: 3.2 KB
RevLine 
[e0fcac5f2c]1/*!
2 * \file globals.h
[1757eb594b]3 * \author Copyright (C) 2007-2010 Lёppa <contacts[at]oleksii[dot]name>
[aecdf994f9]4 *
5 *  $Id$
6 *  $URL$
7 *
[e0fcac5f2c]8 * \brief Contains TSPSG global defines.
9 *
10 *  <b>TSPSG: TSP Solver and Generator</b>
11 *
[aecdf994f9]12 *  This file is part of TSPSG.
13 *
14 *  TSPSG is free software: you can redistribute it and/or modify
15 *  it under the terms of the GNU General Public License as published by
16 *  the Free Software Foundation, either version 3 of the License, or
17 *  (at your option) any later version.
18 *
19 *  TSPSG is distributed in the hope that it will be useful,
20 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 *  GNU General Public License for more details.
23 *
24 *  You should have received a copy of the GNU General Public License
25 *  along with TSPSG.  If not, see <http://www.gnu.org/licenses/>.
26 */
27
[993d5af6f6]28#ifndef GLOBALS_H
29#define GLOBALS_H
[aecdf994f9]30
[993d5af6f6]31// INCLUDES
32#include <QtCore>
33#include <QtGui>
34
[430bd7f7e9]35// Version info
36#include "version.h"
[c10297cf73]37// OS and ARCH detection
[993d5af6f6]38#include "os.h"
[1757eb594b]39// TSPSG Defaults
40#include "defaults.h"
[993d5af6f6]41
42// DEFINES
[bc1b8837b6]43//! Maximum available number of cities
[1fbf016a09]44#define MAX_NUM_CITIES 50
[bc1b8837b6]45//! Maximum allowed value for random generation limits
[2fb523720a]46#define MAX_RAND_VALUE 1000
47
48// Paths
[bc1b8837b6]49/*!
50 * \def PATH_I18N
51 * \brief Bath to internationalization files.
52 */
53/*!
54 * \def PATH_DOCS
55 * \brief Bath to documentation files.
56 */
[2fb523720a]57#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
58        #define PATH_I18N "/usr/share/tspsg/i18n"
59        #define PATH_DOCS "/usr/share/doc/tspsg"
60#else
61        #define PATH_I18N "i18n"
62        #define PATH_DOCS "help"
63#endif // Q_OS_LINUX
64
[85ad815b0b]65//! TSPSG Task file signature - letters \c TSPT
[993d5af6f6]66#define TSPT quint32(0x54535054)
[bc1b8837b6]67//! TSPSG Task file version
[993d5af6f6]68#define TSPT_VERSION quint8(1)
[bc1b8837b6]69//! TSPSG Task file metadata version
[993d5af6f6]70#define TSPT_META_VERSION quint8(1)
[bc1b8837b6]71//! TSPSG Task file metadata size in bytes (incl. version)
[993d5af6f6]72#define TSPT_META_SIZE 2
[85ad815b0b]73//! ZKomModRd Task file signature - letters \c ZK
[993d5af6f6]74#define ZKT quint16(0x5A4B)
[bc1b8837b6]75//! ZKomModRd Task file version
[993d5af6f6]76#define ZKT_VERSION quint8(1)
77
[85ad815b0b]78/*!
79 * \def INFINITY
80 * \brief This value means infinity :-)
81 *
82 *  Some libraries already have \c INFINITY defined.
83 *  We need to redefine it for the \c INFINITY to always have the same value.
84 */
[bc1b8837b6]85#ifdef INFINITY
86        #undef INFINITY
[5587b87fac]87#endif
[bc1b8837b6]88#define INFINITY 1.7E+308
89//! This string represents infinite value in the table
[430bd7f7e9]90#define INFSTR "---"
[5587b87fac]91
[f1fb54b9f7]92// FUNCTIONS
93/*!
[946f442ab0]94 * \brief Checks whether \a x contains an integer value.
95 * \param x A value to check.
96 * \return \c true if \a x countains an integer, oherwise \c false.
[f1fb54b9f7]97 */
[e4ae9e95f7]98inline bool isInteger(double x)
[f1fb54b9f7]99{
[e4ae9e95f7]100double i;
[f1fb54b9f7]101        return (modf(x, &i) == 0.0);
102}
103
[bc1b8837b6]104// Sanity checks
[2fb523720a]105// Check that default number of cities is sane (<= MAX_NUM_CITIES)
[aaf2113307]106#if DEF_NUM_CITIES > MAX_NUM_CITIES
107        #undef DEF_NUM_CITIES
108        #define DEF_NUM_CITIES MAX_NUM_CITIES
109#endif
[2fb523720a]110// Check that maximum for random generation is sane (<= MAX_RAND_VALUE)
111#if DEF_RAND_MAX > MAX_RAND_VALUE
112        #undef DEF_RAND_MAX
113        #define DEF_RAND_MAX MAX_RAND_VALUE
114#endif
115// Check that DEF_RAND_MIN <= DEF_RAND_MAX
116#if DEF_RAND_MIN > DEF_RAND_MAX
117        #undef DEF_RAND_MIN
118        #define DEF_RAND_MIN DEF_RAND_MAX
119#endif
[aaf2113307]120
[993d5af6f6]121#endif // GLOBALS_H
Note: See TracBrowser for help on using the repository browser.