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

Last change on this file since 91 was 89, checked in by laleppa, 15 years ago

Back to double to maintain compatibility between platforms.

  • Property svn:keywords set to Id URL
File size: 3.2 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 89 2010-01-12 15:27:52Z 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"
[31]41
42// DEFINES
[64]43//! Maximum available number of cities
[78]44#define MAX_NUM_CITIES 50
[64]45//! Maximum allowed value for random generation limits
[57]46#define MAX_RAND_VALUE 1000
47
48// Paths
[64]49/*!
50 * \def PATH_I18N
51 * \brief Bath to internationalization files.
52 */
53/*!
54 * \def PATH_DOCS
55 * \brief Bath to documentation files.
56 */
[57]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
[66]65//! TSPSG Task file signature - letters \c TSPT
[31]66#define TSPT quint32(0x54535054)
[64]67//! TSPSG Task file version
[31]68#define TSPT_VERSION quint8(1)
[64]69//! TSPSG Task file metadata version
[31]70#define TSPT_META_VERSION quint8(1)
[64]71//! TSPSG Task file metadata size in bytes (incl. version)
[31]72#define TSPT_META_SIZE 2
[66]73//! ZKomModRd Task file signature - letters \c ZK
[31]74#define ZKT quint16(0x5A4B)
[64]75//! ZKomModRd Task file version
[31]76#define ZKT_VERSION quint8(1)
77
[66]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 */
[64]85#ifdef INFINITY
86        #undef INFINITY
[27]87#endif
[64]88#define INFINITY 1.7E+308
89//! This string represents infinite value in the table
[42]90#define INFSTR "---"
[27]91
[81]92// FUNCTIONS
93/*!
[82]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.
[81]97 */
[89]98inline bool isInteger(double x)
[81]99{
[89]100double i;
[81]101        return (modf(x, &i) == 0.0);
102}
103
[64]104// Sanity checks
[57]105// Check that default number of cities is sane (<= MAX_NUM_CITIES)
[50]106#if DEF_NUM_CITIES > MAX_NUM_CITIES
107        #undef DEF_NUM_CITIES
108        #define DEF_NUM_CITIES MAX_NUM_CITIES
109#endif
[57]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
[50]120
[31]121#endif // GLOBALS_H
Note: See TracBrowser for help on using the repository browser.