source: tspsg/src/globals.h @ b2bf8e3b6b

0.1.3.145-beta1-symbian0.1.4.170-beta2-bb10appveyorimgbotreadme
Last change on this file since b2bf8e3b6b was 6beb157497, checked in by Oleksii Serdiuk, 14 years ago

+ Preliminary Symbian support.

  • Property mode set to 100644
File size: 3.3 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"
[11086c2def]41// Vista/7 Eyecandy
42#include "qtwin.h"
[993d5af6f6]43
44// DEFINES
[bc1b8837b6]45//! Maximum available number of cities
[1fbf016a09]46#define MAX_NUM_CITIES 50
[bc1b8837b6]47//! Maximum allowed value for random generation limits
[2fb523720a]48#define MAX_RAND_VALUE 1000
49
50// Paths
[bc1b8837b6]51/*!
52 * \def PATH_I18N
53 * \brief Bath to internationalization files.
54 */
55/*!
56 * \def PATH_DOCS
57 * \brief Bath to documentation files.
58 */
[6beb157497]59#if defined(Q_OS_LINUX) || (defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN))
[2fb523720a]60        #define PATH_I18N "/usr/share/tspsg/i18n"
61        #define PATH_DOCS "/usr/share/doc/tspsg"
62#else
63        #define PATH_I18N "i18n"
64        #define PATH_DOCS "help"
65#endif // Q_OS_LINUX
66
[85ad815b0b]67//! TSPSG Task file signature - letters \c TSPT
[993d5af6f6]68#define TSPT quint32(0x54535054)
[bc1b8837b6]69//! TSPSG Task file version
[993d5af6f6]70#define TSPT_VERSION quint8(1)
[bc1b8837b6]71//! TSPSG Task file metadata version
[993d5af6f6]72#define TSPT_META_VERSION quint8(1)
[bc1b8837b6]73//! TSPSG Task file metadata size in bytes (incl. version)
[993d5af6f6]74#define TSPT_META_SIZE 2
[85ad815b0b]75//! ZKomModRd Task file signature - letters \c ZK
[993d5af6f6]76#define ZKT quint16(0x5A4B)
[bc1b8837b6]77//! ZKomModRd Task file version
[993d5af6f6]78#define ZKT_VERSION quint8(1)
79
[85ad815b0b]80/*!
81 * \def INFINITY
82 * \brief This value means infinity :-)
83 *
84 *  Some libraries already have \c INFINITY defined.
85 *  We need to redefine it for the \c INFINITY to always have the same value.
86 */
[bc1b8837b6]87#ifdef INFINITY
88        #undef INFINITY
[5587b87fac]89#endif
[bc1b8837b6]90#define INFINITY 1.7E+308
91//! This string represents infinite value in the table
[430bd7f7e9]92#define INFSTR "---"
[5587b87fac]93
[f1fb54b9f7]94// FUNCTIONS
95/*!
[946f442ab0]96 * \brief Checks whether \a x contains an integer value.
97 * \param x A value to check.
98 * \return \c true if \a x countains an integer, oherwise \c false.
[f1fb54b9f7]99 */
[e4ae9e95f7]100inline bool isInteger(double x)
[f1fb54b9f7]101{
[e4ae9e95f7]102double i;
[f1fb54b9f7]103        return (modf(x, &i) == 0.0);
104}
105
[bc1b8837b6]106// Sanity checks
[2fb523720a]107// Check that default number of cities is sane (<= MAX_NUM_CITIES)
[aaf2113307]108#if DEF_NUM_CITIES > MAX_NUM_CITIES
109        #undef DEF_NUM_CITIES
110        #define DEF_NUM_CITIES MAX_NUM_CITIES
111#endif
[2fb523720a]112// Check that maximum for random generation is sane (<= MAX_RAND_VALUE)
113#if DEF_RAND_MAX > MAX_RAND_VALUE
114        #undef DEF_RAND_MAX
115        #define DEF_RAND_MAX MAX_RAND_VALUE
116#endif
117// Check that DEF_RAND_MIN <= DEF_RAND_MAX
118#if DEF_RAND_MIN > DEF_RAND_MAX
119        #undef DEF_RAND_MIN
120        #define DEF_RAND_MIN DEF_RAND_MAX
121#endif
[aaf2113307]122
[993d5af6f6]123#endif // GLOBALS_H
Note: See TracBrowser for help on using the repository browser.