File: abacusroot.h

package info (click to toggle)
tulip 4.8.0dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 179,264 kB
  • ctags: 64,517
  • sloc: cpp: 600,444; ansic: 36,311; makefile: 22,136; python: 1,304; sh: 946; yacc: 522; xml: 337; pascal: 157; php: 66; lex: 55
file content (115 lines) | stat: -rw-r--r-- 3,061 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
 * $Revision: 3386 $
 *
 * last checkin:
 *   $Author: gutwenger $
 *   $Date: 2013-04-10 14:00:02 +0200 (Wed, 10 Apr 2013) $
 ***************************************************************/

/*!\file
 * \author Matthias Elf
 *
 * \par License:
 * This file is part of ABACUS - A Branch And CUt System
 * Copyright (C) 1995 - 2003
 * University of Cologne, Germany
 *
 * \par
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * \par
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * \par
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * \see http://www.gnu.org/copyleft/gpl.html
 */

#ifndef ABA__ABACUSROOT_H
#define ABA__ABACUSROOT_H

#include <ogdf/basic/Logger.h>
#include <ogdf/basic/Array.h>
#include <ogdf/basic/ArrayBuffer.h>

#include <iomanip>
#include <sstream>

using std::ws;
using std::ostringstream;
using std::endl;
using std::flush;
using std::setw;

using ogdf::AlgorithmFailureException;
using ogdf::Logger;
using ogdf::Array;
using ogdf::ArrayBuffer;


// TODO: just a temporary fix
#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif


#define ABACUS_VERSION 301
#define ABACUS_VERSION_STRING "3.0.1/OGDF"

namespace abacus {

//! Base class of all other classes of ABACUS.
/**
 * This class is the base class of all other classes of ABACUS.
 * By embedding an enumeration and some useful functions in this class
 * we can avoid a global scope of these names.
 */
class AbacusRoot {
public:
	//! The destructor
	/**
	 * Is only implemented since it should be virtual in derived classes.
	 */
	virtual ~AbacusRoot() { }


	//! Converts a boolean variable to the strings \a "on" and \a "off".
	/**
	 * \param value The boolean variable being converted.
	 * \return \a "on" if \a value is \a true
	 * \return \a "off" otherwise
	 */
	static const char *onOff(bool value);

	//! Returns the absolute value of the fractional part of \a x.
	/**
	 * E.g., it holds \a fracPart(2.33) == 0.33 and \a fracPart(-1.77) == 0.77.
	 *
	 * \param x The value of which the fractional part is computed.
	 */
	static double fracPart(double x) {
		return (x >= 0.0) ? x-floor(x) : ceil(x)-x;
	}

	//! Converts the string \a str to a boolean value.
	/**
	 * This is only possible for the strings <tt>"true"</tt> and <tt>"false"</tt>.
	 */
	static bool ascii2bool(const string &str);

	//! Returns true if \a str ends with \a end, false otherwise.
	static bool endsWith(const string &str, const string &end);
};

} //namespace abacus

#endif  //AbacusRoot_H