Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
Options.h
Go to the documentation of this file.
1/***************************************************************************************[Options.h]
2Copyright (c) 2008-2010, Niklas Sorensson
3
4Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
5associated documentation files (the "Software"), to deal in the Software without restriction,
6including without limitation the rights to use, copy, modify, merge, publish, distribute,
7sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
8furnished to do so, subject to the following conditions:
9
10The above copyright notice and this permission notice shall be included in all copies or
11substantial portions of the Software.
12
13THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
14NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
17OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18**************************************************************************************************/
19
20#pragma once
21
22#include <stdlib.h>
23#include <stdio.h>
24#include <math.h>
25#include <string.h>
26
30
31namespace Minisat {
32namespace Internal {
33
34//==================================================================================================
35// Range classes with specialization for floating types:
36
37
38struct IntRange {
39 int begin;
40 int end;
41 IntRange(int b, int e) : begin(b), end(e) {}
42};
43
45 double begin;
46 double end;
49 DoubleRange(double b, bool binc, double e, bool einc) : begin(b), end(e), begin_inclusive(binc), end_inclusive(einc) {}
50};
51
52
53//==================================================================================================
54// Double options:
55
56
58{
59 protected:
61 double value;
62
63 public:
64 DoubleOption(const char* d, double def = double(), DoubleRange r = DoubleRange(-HUGE_VAL, false, HUGE_VAL, false))
65 : range(r), value(def) {
66 }
67
68 operator double (void) const { return value; }
69 operator double& (void) { return value; }
70 DoubleOption& operator=(double x) { value = x; return *this; }
71};
72
73
74//==================================================================================================
75// Int options:
76
77
79{
80 protected:
83
84 public:
87
88 operator int32_t (void) const { return value; }
89 operator int32_t& (void) { return value; }
90 IntOption& operator= (int32_t x) { value = x; return *this; }
91};
92
93
94
95//==================================================================================================
96// Bool option:
97
98
100{
101 bool value;
102
103 public:
104 BoolOption(const char* d, bool v)
105 : value(v) {}
106
107 operator bool (void) const { return value; }
108 operator bool& (void) { return value; }
109 BoolOption& operator=(bool b) { value = b; return *this; }
110};
111
112//=================================================================================================
113} // namespace Internal
114} // namespace Minisat
#define INT32_MAX
Definition IntTypes.h:48
#define INT32_MIN
Definition IntTypes.h:45
BoolOption & operator=(bool b)
Definition Options.h:109
BoolOption(const char *d, bool v)
Definition Options.h:104
DoubleOption(const char *d, double def=double(), DoubleRange r=DoubleRange(-HUGE_VAL, false, HUGE_VAL, false))
Definition Options.h:64
DoubleOption & operator=(double x)
Definition Options.h:70
IntOption & operator=(int32_t x)
Definition Options.h:90
IntOption(const char *d, int32_t def=int32_t(), IntRange r=IntRange(INT32_MIN, INT32_MAX))
Definition Options.h:85
int r[]
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
DoubleRange(double b, bool binc, double e, bool einc)
Definition Options.h:49
IntRange(int b, int e)
Definition Options.h:41