PolyBoRi
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
libpolybori
include
polybori
pbori_defs.h
Go to the documentation of this file.
1
// -*- c++ -*-
2
//*****************************************************************************
17
//*****************************************************************************
18
19
#ifndef polybori_pbori_defs_h_
20
#define polybori_pbori_defs_h_
21
22
#include <cstddef>
23
24
#include <iostream>
25
27
#include <
polybori/cudd/cudd.h
>
28
29
#include "config.h"
30
31
#ifndef PBORI_UNIQUE_SLOTS
32
# define PBORI_UNIQUE_SLOTS CUDD_UNIQUE_SLOTS // initial size of subtables
33
#endif
34
35
#ifndef PBORI_CACHE_SLOTS
36
# define PBORI_CACHE_SLOTS CUDD_CACHE_SLOTS // default size of the cache
37
#endif
38
39
#ifndef PBORI_MAX_MEMORY
40
# define PBORI_MAX_MEMORY 0 // target maximum memory occupation
41
// if PBORI_MAX_MEMORY == 0 then
42
// guess based on the available memory
43
#endif
44
45
47
#ifdef __GNUC__
48
#ifndef PBORI_LIKELY
49
#define PBORI_LIKELY(expression) (__builtin_expect(!!(expression), 1))
50
#endif
51
#ifndef PBORI_UNLIKELY
52
#define PBORI_UNLIKELY(expression) (__builtin_expect(!!(expression), 0))
53
#endif
54
#else
55
#ifndef PBORI_LIKELY
56
#define PBORI_LIKELY(expression) (expression)
57
#endif
58
#ifndef PBORI_UNLIKELY
59
#define PBORI_UNLIKELY(expression) (expression)
60
#endif
61
#endif
62
64
#define PBORINAME polybori
65
67
#ifndef PBORI_NO_DEVELOPER
68
# define PBORI_DEVELOPER
69
#endif
70
71
#ifndef PBORI_NO_NAMESPACES
72
74
# define BEGIN_NAMESPACE_PBORI namespace PBORINAME {
75
77
# define END_NAMESPACE_PBORI } // end of namespace
78
80
# define USING_NAMESPACE_PBORI using namespace PBORINAME;
81
83
# define PBORI PBORINAME
84
86
# define USING_PBORI using PBORI
87
89
# define PBORI_BEGIN_NAMESPACE( sub_space ) namespace sub_space {
90
92
# define PBORI_END_NAMESPACE }
93
94
#else
95
96
# define BEGIN_NAMESPACE_PBORI
97
# define END_NAMESPACE_PBORI
98
# define USING_NAMESPACE_PBORI
99
# define PBORI
100
# define USING_PBORI
101
# define PBORI_BEGIN_NAMESPACE( sub_space )
102
# define PBORI_END_NAMESPACE
103
104
#endif // PBORI_NO_NAMESPACES
105
107
#ifdef PBORI_DEBUG_TRACE
108
# include <iostream>
109
# define PBORI_TRACE_FUNC(text) std::cerr << text << std::endl;
110
#else
111
# define PBORI_TRACE_FUNC(text)
112
#endif
113
114
// @todo force assertIon of PBORI_DEBUG
115
#if defined(PBORI_NDEBUG)
116
#define PBORI_ASSERT(arg) (static_cast<void>(0))
117
#else
118
#define PBORI_ASSERT(arg) assert(arg)
119
#endif
120
122
#ifndef PBORI_NO_STDSTREAMS
123
124
# include <iostream>
125
# define PBORI_OSTREAM std::ostream
126
127
#else
128
129
BEGIN_NAMESPACE_PBORI
130
132
struct
PBORI_OSTREAM
{};
133
134
template
<
class
StreamedType>
135
PBORI_OSTREAM
&
136
operator<<
(
PBORI_OSTREAM
& dummy,
const
StreamedType&) {
137
return
dummy;
138
};
139
END_NAMESPACE_PBORI
140
141
#endif // of #ifndef PBORI_NO_STDSTREAMS
142
143
144
BEGIN_NAMESPACE_PBORI
145
146
152
struct
COrderEnums
{
154
enum
ordercodes
{
155
lp
,
156
dlex
,
157
dp_asc
,
158
block_dlex
,
159
block_dp_asc
160
};
161
};
162
168
struct
CErrorEnums
{
170
enum
errorcodes
{
171
alright = 0,
172
failed
,
173
no_ring
,
174
invalid
,
175
out_of_bounds
,
176
io_error
,
177
monomial_zero
,
178
illegal_on_zero
,
179
division_by_zero
,
180
invalid_ite
,
181
not_implemented
,
182
matrix_size_exceeded
,
183
184
last_error
185
};
186
};
187
193
struct
CCompareEnums
{
195
enum
comparecodes
{
196
less_than = -1,
197
equality = 0,
198
greater_than = +1,
199
less_or_equal_max = 0,
200
greater_or_equal_min = 0
201
};
202
203
enum
{ max_idx = CUDD_MAXINDEX };
204
};
205
210
struct
CAuxTypes
{
211
//-------------------------------------------------------------------------
212
// types for several purposes
213
//-------------------------------------------------------------------------
214
216
typedef
bool
bool_type
;
217
219
typedef
std::size_t
size_type
;
220
222
typedef
int
deg_type
;
223
225
typedef
int
integer_type
;
226
228
typedef
int
idx_type
;
229
231
typedef
std::size_t
hash_type
;
232
234
typedef
unsigned
int
errornum_type
;
235
237
typedef
short
int
comp_type
;
238
240
typedef
int
ordercode_type
;
241
243
typedef
const
char
*
errortext_type
;
244
246
typedef
PBORI_OSTREAM
ostream_type
;
247
249
typedef
const
char
*
vartext_type
;
250
252
typedef
unsigned
long
large_size_type
;
253
255
typedef
std::size_t
refcount_type
;
256
};
257
258
class
BooleSet
;
259
class
BoolePolyRing
;
260
269
struct
CTypes
:
270
public
COrderEnums
,
public
CErrorEnums
,
public
CCompareEnums
,
271
public
CAuxTypes
{
272
//-------------------------------------------------------------------------
273
// types for treatment of decision diagrams
274
//-------------------------------------------------------------------------
275
277
278
typedef
COrderEnums
orderenums_type
;
279
typedef
CErrorEnums
errorenums_type
;
280
typedef
CCompareEnums
compenums_type
;
281
typedef
CAuxTypes
auxtypes_type
;
283
284
286
// typedef BooleSet dd_type;
287
288
290
static
idx_type
max_index
() {
return
max_idx; }
291
};
292
293
END_NAMESPACE_PBORI
294
295
#ifdef PBORI_DEVELOPER
296
# define PBORI_NOT_IMPLEMENTED \
297
throw PBORI::PBoRiError(PBORI::CTypes::not_implemented);
298
#else
299
# define PBORI_NOT_IMPLEMENTED
300
#endif
301
302
// Set default addition method
303
#if defined(PBORI_ADD_BY_ITE) || defined(PBORI_ADD_BY_OR) \
304
|| defined(PBORI_ADD_BY_UNION) || defined(PBORI_ADD_BY_EXTRA_XOR) \
305
|| defined(PBORI_ADD_BY_XOR)
306
#else
307
# define PBORI_ADD_BY_XOR
308
#endif
309
310
311
// Set default union-xor method
312
#ifdef PBORI_ADD_BY_XOR
313
# define PBORI_LOWLEVEL_XOR
314
#endif
315
316
// Set default method for getting all used variables
317
#if defined(PBORI_USEDVARS_BY_IDX) || defined(PBORI_USEDVARS_BY_TRANSFORM) \
318
|| defined(PBORI_USEDVARS_HIGHLEVEL)|| defined(PBORI_USEDVARS_BY_SUPPORT)\
319
|| defined(PBORI_USEDVARS_EXTRA)
320
#else
321
# define PBORI_USEDVARS_BY_IDX
322
//PBORI_USEDVARS_EXTRA
323
#endif
324
325
326
#endif // of #ifndef polybori_pbori_defs_h_
Generated by
1.8.3.1