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

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

+ Added precompiled header (PCH) file: should decrease project build time.

  • Improved installation and deployment rules in .pro file.
  • Improved translucency effect under Windows Vista/7.
  • Slightly modified qtwin.h to be included into the source documentation.
  • Regenerated source documentation.
  • Property svn:keywords set to Id URL
File size: 3.2 KB
Line 
1/*!
2 * \file globals.h
3 * \author Copyright &copy; 2007-2010 Lёppa <contacts[at]oleksii[dot]name>
4 *
5 *  $Id: globals.h 97 2010-03-02 23:55:23Z laleppa $
6 *  $URL: https://tspsg.svn.sourceforge.net/svnroot/tspsg/trunk/src/globals.h $
7 *
8 * \brief Contains TSPSG global defines.
9 *
10 *  <b>TSPSG: TSP Solver and Generator</b>
11 *
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
28#ifndef GLOBALS_H
29#define GLOBALS_H
30
31// INCLUDES
32#include <QtCore>
33#include <QtGui>
34
35// Version info
36#include "version.h"
37// OS and ARCH detection
38#include "os.h"
39// TSPSG Defaults
40#include "defaults.h"
41#ifdef Q_OS_WIN32
42        // Vista/7 Eyecandy
43        #include "qtwin.h"
44#endif // Q_OS_WIN32
45
46// DEFINES
47//! Maximum available number of cities
48#define MAX_NUM_CITIES 50
49//! Maximum allowed value for random generation limits
50#define MAX_RAND_VALUE 1000
51
52// Paths
53/*!
54 * \def PATH_L10N
55 * \brief Bath to internationalization files.
56 */
57#ifndef PATH_L10N
58        #define PATH_L10N "l10n"
59#endif // PATH_L10N
60/*!
61 * \def PATH_DOCS
62 * \brief Bath to documentation files.
63 */
64#ifndef PATH_DOCS
65        #define PATH_DOCS "help"
66#endif // PATH_DOCS
67
68//! TSPSG Task file signature - letters \c TSPT
69#define TSPT quint32(0x54535054)
70//! TSPSG Task file version
71#define TSPT_VERSION quint8(1)
72//! TSPSG Task file metadata version
73#define TSPT_META_VERSION quint8(1)
74//! TSPSG Task file metadata size in bytes (incl. version)
75#define TSPT_META_SIZE 2
76//! ZKomModRd Task file signature - letters \c ZK
77#define ZKT quint16(0x5A4B)
78//! ZKomModRd Task file version
79#define ZKT_VERSION quint8(1)
80
81/*!
82 * \def INFINITY
83 * \brief This value means infinity :-)
84 *
85 *  Some libraries already have \c INFINITY defined.
86 *  We need to redefine it for the \c INFINITY to always have the same value.
87 */
88#ifdef INFINITY
89        #undef INFINITY
90#endif
91#define INFINITY 1.7E+308
92//! This string represents infinite value in the table
93#define INFSTR "---"
94
95// FUNCTIONS
96/*!
97 * \brief Checks whether \a x contains an integer value.
98 * \param x A value to check.
99 * \return \c true if \a x countains an integer, oherwise \c false.
100 */
101inline bool isInteger(double x)
102{
103double i;
104        return (modf(x, &i) == 0.0);
105}
106
107// Sanity checks
108// Check that default number of cities is sane (<= MAX_NUM_CITIES)
109#if DEF_NUM_CITIES > MAX_NUM_CITIES
110        #undef DEF_NUM_CITIES
111        #define DEF_NUM_CITIES MAX_NUM_CITIES
112#endif
113// Check that maximum for random generation is sane (<= MAX_RAND_VALUE)
114#if DEF_RAND_MAX > MAX_RAND_VALUE
115        #undef DEF_RAND_MAX
116        #define DEF_RAND_MAX MAX_RAND_VALUE
117#endif
118// Check that DEF_RAND_MIN <= DEF_RAND_MAX
119#if DEF_RAND_MIN > DEF_RAND_MAX
120        #undef DEF_RAND_MIN
121        #define DEF_RAND_MIN DEF_RAND_MAX
122#endif
123
124#endif // GLOBALS_H
Note: See TracBrowser for help on using the repository browser.