source: tspsg-svn/trunk/src/globals.h @ 94

Last change on this file since 94 was 93, checked in by laleppa, 15 years ago

+ Preliminary Symbian support.

  • Property svn:keywords set to Id URL
File size: 3.3 KB
RevLine 
[67]1/*!
2 * \file globals.h
[87]3 * \author Copyright (C) 2007-2010 Lёppa <contacts[at]oleksii[dot]name>
[21]4 *
5 *  $Id: globals.h 93 2010-02-23 22:17:48Z laleppa $
6 *  $URL: https://tspsg.svn.sourceforge.net/svnroot/tspsg/trunk/src/globals.h $
7 *
[67]8 * \brief Contains TSPSG global defines.
9 *
10 *  <b>TSPSG: TSP Solver and Generator</b>
11 *
[21]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
[31]28#ifndef GLOBALS_H
29#define GLOBALS_H
[21]30
[31]31// INCLUDES
32#include <QtCore>
33#include <QtGui>
34
[42]35// Version info
36#include "version.h"
[54]37// OS and ARCH detection
[31]38#include "os.h"
[87]39// TSPSG Defaults
40#include "defaults.h"
[92]41// Vista/7 Eyecandy
42#include "qtwin.h"
[31]43
44// DEFINES
[64]45//! Maximum available number of cities
[78]46#define MAX_NUM_CITIES 50
[64]47//! Maximum allowed value for random generation limits
[57]48#define MAX_RAND_VALUE 1000
49
50// Paths
[64]51/*!
52 * \def PATH_I18N
53 * \brief Bath to internationalization files.
54 */
55/*!
56 * \def PATH_DOCS
57 * \brief Bath to documentation files.
58 */
[93]59#if defined(Q_OS_LINUX) || (defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN))
[57]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
[66]67//! TSPSG Task file signature - letters \c TSPT
[31]68#define TSPT quint32(0x54535054)
[64]69//! TSPSG Task file version
[31]70#define TSPT_VERSION quint8(1)
[64]71//! TSPSG Task file metadata version
[31]72#define TSPT_META_VERSION quint8(1)
[64]73//! TSPSG Task file metadata size in bytes (incl. version)
[31]74#define TSPT_META_SIZE 2
[66]75//! ZKomModRd Task file signature - letters \c ZK
[31]76#define ZKT quint16(0x5A4B)
[64]77//! ZKomModRd Task file version
[31]78#define ZKT_VERSION quint8(1)
79
[66]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 */
[64]87#ifdef INFINITY
88        #undef INFINITY
[27]89#endif
[64]90#define INFINITY 1.7E+308
91//! This string represents infinite value in the table
[42]92#define INFSTR "---"
[27]93
[81]94// FUNCTIONS
95/*!
[82]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.
[81]99 */
[89]100inline bool isInteger(double x)
[81]101{
[89]102double i;
[81]103        return (modf(x, &i) == 0.0);
104}
105
[64]106// Sanity checks
[57]107// Check that default number of cities is sane (<= MAX_NUM_CITIES)
[50]108#if DEF_NUM_CITIES > MAX_NUM_CITIES
109        #undef DEF_NUM_CITIES
110        #define DEF_NUM_CITIES MAX_NUM_CITIES
111#endif
[57]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
[50]122
[31]123#endif // GLOBALS_H
Note: See TracBrowser for help on using the repository browser.