pbori_defs.h
Go to the documentation of this file.
// -*- c++ -*-
//*****************************************************************************
//*****************************************************************************
#ifndef polybori_pbori_defs_h_
#define polybori_pbori_defs_h_
#include <cstddef>
#include <iostream>
#include <polybori/cudd/cudd.h>
#include "config.h"
#ifndef PBORI_UNIQUE_SLOTS
# define PBORI_UNIQUE_SLOTS CUDD_UNIQUE_SLOTS // initial size of subtables
#endif
#ifndef PBORI_CACHE_SLOTS
# define PBORI_CACHE_SLOTS CUDD_CACHE_SLOTS // default size of the cache
#endif
#ifndef PBORI_MAX_MEMORY
# define PBORI_MAX_MEMORY 0 // target maximum memory occupation
// if PBORI_MAX_MEMORY == 0 then
// guess based on the available memory
#endif
#ifdef __GNUC__
#ifndef PBORI_LIKELY
#define PBORI_LIKELY(expression) (__builtin_expect(!!(expression), 1))
#endif
#ifndef PBORI_UNLIKELY
#define PBORI_UNLIKELY(expression) (__builtin_expect(!!(expression), 0))
#endif
#else
#ifndef PBORI_LIKELY
#define PBORI_LIKELY(expression) (expression)
#endif
#ifndef PBORI_UNLIKELY
#define PBORI_UNLIKELY(expression) (expression)
#endif
#endif
#define PBORINAME polybori
#ifndef PBORI_NO_DEVELOPER
# define PBORI_DEVELOPER
#endif
#ifndef PBORI_NO_NAMESPACES
# define BEGIN_NAMESPACE_PBORI namespace PBORINAME {
# define END_NAMESPACE_PBORI } // end of namespace
# define USING_NAMESPACE_PBORI using namespace PBORINAME;
# define PBORI PBORINAME
# define USING_PBORI using PBORI
# define PBORI_BEGIN_NAMESPACE( sub_space ) namespace sub_space {
# define PBORI_END_NAMESPACE }
#else
# define BEGIN_NAMESPACE_PBORI
# define END_NAMESPACE_PBORI
# define USING_NAMESPACE_PBORI
# define PBORI
# define USING_PBORI
# define PBORI_BEGIN_NAMESPACE( sub_space )
# define PBORI_END_NAMESPACE
#endif // PBORI_NO_NAMESPACES
#ifdef PBORI_DEBUG_TRACE
# include <iostream>
# define PBORI_TRACE_FUNC(text) std::cerr << text << std::endl;
#else
# define PBORI_TRACE_FUNC(text)
#endif
// @todo force assertIon of PBORI_DEBUG
#if defined(PBORI_NDEBUG)
#define PBORI_ASSERT(arg) (static_cast<void>(0))
#else
#define PBORI_ASSERT(arg) assert(arg)
#endif
#ifndef PBORI_NO_STDSTREAMS
# include <iostream>
# define PBORI_OSTREAM std::ostream
#else
BEGIN_NAMESPACE_PBORI
struct PBORI_OSTREAM {};
template <class StreamedType>
PBORI_OSTREAM&
operator<<(PBORI_OSTREAM& dummy, const StreamedType&) {
return dummy;
};
END_NAMESPACE_PBORI
#endif // of #ifndef PBORI_NO_STDSTREAMS
BEGIN_NAMESPACE_PBORI
struct COrderEnums {
enum ordercodes {
lp,
dlex,
dp_asc,
block_dlex,
block_dp_asc
};
};
struct CErrorEnums {
enum errorcodes {
alright = 0,
failed,
no_ring,
invalid,
out_of_bounds,
io_error,
monomial_zero,
illegal_on_zero,
division_by_zero,
invalid_ite,
not_implemented,
matrix_size_exceeded,
last_error
};
};
struct CCompareEnums {
enum comparecodes {
less_than = -1,
equality = 0,
greater_than = +1,
less_or_equal_max = 0,
greater_or_equal_min = 0
};
enum { max_idx = CUDD_MAXINDEX };
};
struct CAuxTypes {
//-------------------------------------------------------------------------
// types for several purposes
//-------------------------------------------------------------------------
typedef bool bool_type;
typedef std::size_t size_type;
typedef int deg_type;
typedef int integer_type;
typedef int idx_type;
typedef std::size_t hash_type;
typedef unsigned int errornum_type;
typedef short int comp_type;
typedef int ordercode_type;
typedef const char* errortext_type;
typedef PBORI_OSTREAM ostream_type;
typedef const char* vartext_type;
typedef unsigned long large_size_type;
typedef std::size_t refcount_type;
};
class BooleSet;
class BoolePolyRing;
struct CTypes:
public COrderEnums, public CErrorEnums, public CCompareEnums,
public CAuxTypes {
//-------------------------------------------------------------------------
// types for treatment of decision diagrams
//-------------------------------------------------------------------------
typedef COrderEnums orderenums_type;
typedef CErrorEnums errorenums_type;
typedef CCompareEnums compenums_type;
typedef CAuxTypes auxtypes_type;
// typedef BooleSet dd_type;
static idx_type max_index() { return max_idx; }
};
END_NAMESPACE_PBORI
#ifdef PBORI_DEVELOPER
# define PBORI_NOT_IMPLEMENTED \
throw PBORI::PBoRiError(PBORI::CTypes::not_implemented);
#else
# define PBORI_NOT_IMPLEMENTED
#endif
// Set default addition method
#if defined(PBORI_ADD_BY_ITE) || defined(PBORI_ADD_BY_OR) \
|| defined(PBORI_ADD_BY_UNION) || defined(PBORI_ADD_BY_EXTRA_XOR) \
|| defined(PBORI_ADD_BY_XOR)
#else
# define PBORI_ADD_BY_XOR
#endif
// Set default union-xor method
#ifdef PBORI_ADD_BY_XOR
# define PBORI_LOWLEVEL_XOR
#endif
// Set default method for getting all used variables
#if defined(PBORI_USEDVARS_BY_IDX) || defined(PBORI_USEDVARS_BY_TRANSFORM) \
|| defined(PBORI_USEDVARS_HIGHLEVEL)|| defined(PBORI_USEDVARS_BY_SUPPORT)\
|| defined(PBORI_USEDVARS_EXTRA)
#else
# define PBORI_USEDVARS_BY_IDX
//PBORI_USEDVARS_EXTRA
#endif
#endif // of #ifndef polybori_pbori_defs_h_
polybori::CAuxTypes::errortext_type
const char * errortext_type
Type used to verbose error information.
Definition: pbori_defs.h:243
polybori::CErrorEnums::invalid_ite
Definition: pbori_defs.h:180
END_NAMESPACE_PBORI
#define END_NAMESPACE_PBORI
Finish project's namespace.
Definition: pbori_defs.h:77
polybori::COrderEnums::ordercodes
ordercodes
Codes For orderings.
Definition: pbori_defs.h:154
polybori::COrderEnums::block_dlex
Definition: pbori_defs.h:158
BEGIN_NAMESPACE_PBORI
#define BEGIN_NAMESPACE_PBORI
Start project's namespace.
Definition: pbori_defs.h:74
polybori::CTypes::max_index
static idx_type max_index()
Type of interface to binary decicion diagrams.
Definition: pbori_defs.h:290
polybori::CAuxTypes::deg_type
int deg_type
Type for polynomial degrees (ranges from -1 to maxint)
Definition: pbori_defs.h:222
polybori::COrderEnums
This struct contains type definitions and enumerations to be used for order codes.
Definition: pbori_defs.h:152
polybori::CAuxTypes::comp_type
short int comp_type
Type for comparisons.
Definition: pbori_defs.h:237
polybori::CErrorEnums::failed
Definition: pbori_defs.h:172
PBORI_OSTREAM
#define PBORI_OSTREAM
Get output stream type.
Definition: pbori_defs.h:125
polybori::BoolePolyRing
This class reinterprets decicion diagram managers as Boolean polynomial rings, adds an ordering and v...
Definition: BoolePolyRing.h:40
polybori::CAuxTypes
This struct contains auxiliary type definitions.
Definition: pbori_defs.h:210
polybori::CAuxTypes::ostream_type
std::ostream ostream_type
Type for out-stream.
Definition: pbori_defs.h:246
polybori::CErrorEnums::out_of_bounds
Definition: pbori_defs.h:175
polybori::COrderEnums::dlex
Definition: pbori_defs.h:156
polybori::CErrorEnums::not_implemented
Definition: pbori_defs.h:181
polybori::CAuxTypes::integer_type
int integer_type
Type for integer numbers.
Definition: pbori_defs.h:225
polybori::CAuxTypes::hash_type
std::size_t hash_type
Type for hashing.
Definition: pbori_defs.h:231
cudd.h
polybori::CErrorEnums::matrix_size_exceeded
Definition: pbori_defs.h:182
polybori::CErrorEnums::no_ring
Definition: pbori_defs.h:173
polybori::CAuxTypes::errornum_type
unsigned int errornum_type
Type used to store error codes.
Definition: pbori_defs.h:234
polybori::CAuxTypes::idx_type
int idx_type
Type for indices.
Definition: pbori_defs.h:228
polybori::CTypes::errorenums_type
CErrorEnums errorenums_type
Definition: pbori_defs.h:279
polybori::CErrorEnums
This struct contains type definitions and enumerations to be used for error codes.
Definition: pbori_defs.h:168
polybori::CErrorEnums::errorcodes
errorcodes
Error codes enumeration.
Definition: pbori_defs.h:170
polybori::COrderEnums::dp_asc
Definition: pbori_defs.h:157
polybori::CTypes::orderenums_type
COrderEnums orderenums_type
Definition: pbori_defs.h:278
polybori::CTypes::compenums_type
CCompareEnums compenums_type
Definition: pbori_defs.h:280
polybori::CCompareEnums::comparecodes
comparecodes
Comparision codes enumeration.
Definition: pbori_defs.h:195
polybori::block_dp_asc
Definition: embed.h:61
polybori::CErrorEnums::invalid
Definition: pbori_defs.h:174
polybori::CErrorEnums::io_error
Definition: pbori_defs.h:176
polybori::CAuxTypes::vartext_type
const char * vartext_type
Type for setting/getting names of variables.
Definition: pbori_defs.h:249
polybori::operator<<
CTypes::ostream_type & operator<<(CTypes::ostream_type &os, const BooleConstant &rhs)
Stream output operator.
Definition: BooleConstant.h:109
polybori::CAuxTypes::size_type
std::size_t size_type
Type for lengths, dimensions, etc.
Definition: pbori_defs.h:219
polybori::CAuxTypes::large_size_type
unsigned long large_size_type
large size_type (necessary?)
Definition: pbori_defs.h:252
polybori::CErrorEnums::illegal_on_zero
Definition: pbori_defs.h:178
polybori::CAuxTypes::refcount_type
std::size_t refcount_type
Type for counting references.
Definition: pbori_defs.h:255
polybori::BooleSet
Definition: BooleSet.h:57
polybori::CErrorEnums::division_by_zero
Definition: pbori_defs.h:179
polybori::COrderEnums::lp
Definition: pbori_defs.h:155
polybori::CAuxTypes::bool_type
bool bool_type
Type for standard true/false statements.
Definition: pbori_defs.h:216
polybori::CTypes
This struct contains type definitions to be used in library classes.
Definition: pbori_defs.h:269
polybori::CErrorEnums::monomial_zero
Definition: pbori_defs.h:177
polybori::CCompareEnums
This struct contains type definitions and enumerations to be used for comparisons.
Definition: pbori_defs.h:193
polybori::CAuxTypes::ordercode_type
int ordercode_type
Type for ordering codes.
Definition: pbori_defs.h:240
polybori::CTypes::auxtypes_type
CAuxTypes auxtypes_type
Definition: pbori_defs.h:281