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

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

+ Added SStep::next that indicates what branch was selected for the next step.
+ Added "Show solution graph" option.
+ New CTSPSolver::getTotalSteps() method that returns a total number of steps in the current solution.

  • Moved SCandidate declaration into SStep declaration.
  • Moved everything in tspsolver.h and tspsolver.cpp into TSPSolver namespace.
  • Force CopyAction? on file drop or it will be deleted after dropping in Windows if MoveAction? was selected.
  • Property svn:keywords set to Id URL
File size: 3.5 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 107 2010-04-25 14:36:27Z 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// TSPSolver
42#include "tspsolver.h"
43#ifdef Q_OS_WIN32
44        // Vista/7 Eyecandy
45        #include "qtwin.h"
46#endif // Q_OS_WIN32
47
48// DEFINES
49//! Maximum available number of cities
50#define MAX_NUM_CITIES 50
51//! Maximum allowed value for random generation limits
52#define MAX_RAND_VALUE 1000
53
54// Paths
55/*!
56 * \def PATH_L10N
57 * \brief Path to internationalization files.
58 */
59#ifndef PATH_L10N
60        #define PATH_L10N "l10n"
61#endif // PATH_L10N
62/*!
63 * \def PATH_DOCS
64 * \brief Bath to documentation files.
65 */
66#ifndef PATH_DOCS
67        #define PATH_DOCS "help"
68#endif // PATH_DOCS
69
70//! TSPSG Task file signature - letters \c TSPT
71#define TSPT quint32(0x54535054)
72//! TSPSG Task file version
73#define TSPT_VERSION quint8(1)
74//! TSPSG Task file metadata version
75#define TSPT_META_VERSION quint8(1)
76//! TSPSG Task file metadata size in bytes (incl. version)
77#define TSPT_META_SIZE 2
78//! ZKomModRd Task file signature - letters \c ZK
79#define ZKT quint16(0x5A4B)
80//! ZKomModRd Task file version
81#define ZKT_VERSION quint8(1)
82
83//! This string represents infinite value in the table
84#define INFSTR "---"
85
86// FUNCTIONS
87/*!
88 * \brief Checks whether \a x contains an integer value.
89 * \param x A value to check.
90 * \return \c true if \a x countains an integer, oherwise \c false.
91 */
92inline bool isInteger(double x)
93{
94double i;
95        return (modf(x, &i) == 0.0);
96}
97
98#ifdef Q_OS_WIN32
99/*!
100 * \brief Enables or disables a mask for the \a widget.
101 * \param widget A widget to toggle mask on.
102 * \param enable Set to \c true to enable mask or \c false to disable it.
103 *
104 *  This function is used to enable an outlined font effect for \c QLabel with a static text.
105 */
106void toggleStyle(QWidget *widget, bool enable);
107#endif // Q_OS_WIN32
108
109#if defined(Q_OS_WINCE_WM) || defined(Q_OS_SYMBIAN)
110        //! This is defined on handheld (e.g., Windows Mobile, Symbian) devices.
111        #define HANDHELD
112#endif
113
114// Sanity checks
115// Check that default number of cities is sane (<= MAX_NUM_CITIES)
116#if DEF_NUM_CITIES > MAX_NUM_CITIES
117        #undef DEF_NUM_CITIES
118        #define DEF_NUM_CITIES MAX_NUM_CITIES
119#endif
120// Check that maximum for random generation is sane (<= MAX_RAND_VALUE)
121#if DEF_RAND_MAX > MAX_RAND_VALUE
122        #undef DEF_RAND_MAX
123        #define DEF_RAND_MAX MAX_RAND_VALUE
124#endif
125// Check that DEF_RAND_MIN <= DEF_RAND_MAX
126#if DEF_RAND_MIN > DEF_RAND_MAX
127        #undef DEF_RAND_MIN
128        #define DEF_RAND_MIN DEF_RAND_MAX
129#endif
130
131#endif // GLOBALS_H
Note: See TracBrowser for help on using the repository browser.