00001 // -*- c++ -*- 00002 //***************************************************************************** 00014 //***************************************************************************** 00015 00016 #ifndef polybori_BooleEnv_h_ 00017 #define polybori_BooleEnv_h_ 00018 00019 // load PolyBoRi settings 00020 # include <polybori/pbori_defs.h> 00021 00022 #include <polybori/BoolePolyRing.h> 00023 #include <vector> 00024 00025 // Obey stricter dependence of Sun Studio compiler 00026 // todo: resolve dependency 00027 #if defined(__SUNPRO_C) || defined(__SUNPRO_CC) 00028 # define PBORI_ENV_RING_NOTINLINED 00029 #endif 00030 00031 00032 BEGIN_NAMESPACE_PBORI 00033 00034 00035 class BoolePolyRing; 00036 //extern BoolePolyRing active_ring; 00037 class COrderingBase; 00038 00046 class BooleEnv: 00047 public CTypes::orderenums_type, public CTypes::compenums_type, 00048 public CTypes::auxtypes_type { 00049 00050 public: 00051 //------------------------------------------------------------------------- 00052 // types definitions 00053 //------------------------------------------------------------------------- 00054 00056 typedef BooleEnv self; 00057 00059 typedef CTypes::orderenums_type base; 00060 00062 00063 typedef CTypes::ordercode_type ordercode_type; 00064 typedef BoolePolyRing::dd_type dd_type; 00065 typedef BoolePolyRing::var_type var_type; 00066 typedef CTypes::vartext_type vartext_type; 00068 00070 typedef std::vector<idx_type> block_idx_type; 00071 00073 typedef block_idx_type::const_iterator block_iterator; 00074 00075 //------------------------------------------------------------------------- 00076 // constructors and destructor 00077 //------------------------------------------------------------------------- 00078 00080 using base::ordercodes; 00081 00082 // /// Access idx-th variable of the active ring 00083 // static var_type variable(idx_type idx); 00084 00085 // /// Get numerical code for current ordering 00086 // static ordercode_type getOrderCode(); 00087 00088 // /// Get numerical code for current base ordering 00089 // /// (the same for non-block orderings) 00090 // static ordercode_type getBaseOrderCode(); 00091 00092 // /// Get empty decision diagram 00093 // static dd_type zero(); 00094 00095 // /// Get decision diagram with all variables negated 00096 // static dd_type one(); 00097 00098 // /// Get number of ring variables the of active ring 00099 // static size_type nVariables(); 00100 00101 typedef BoolePolyRing ring_type; 00102 00103 typedef COrderingBase order_type; 00104 00105 // private: 00106 // #ifdef PBORI_ENV_RING_NOTINLINED 00107 // static ring_type& ring(); 00108 // #else 00109 // static ring_type& ring() { 00110 // static BooleEnv::ring_type active_ring(1000, CTypes::lp, false); 00111 00112 // return active_ring; 00113 // } 00114 // #endif 00115 // // static manager_type& manager(); 00116 // static order_type& ordering(); 00117 // public: 00118 00119 // /// Set name of variable with index idx 00120 // static void setVariableName(idx_type idx, vartext_type varname); 00121 00122 // /// Get name of variable with index idx 00123 // static vartext_type getVariableName(idx_type idx); 00124 00125 // /// @name interface for block orderings, if the vcurrent orderins is a block ordering 00126 // //@{ 00127 // /// Returns iterator over the indices, where the (next) block starts. 00128 // /// (The first one implicitely starts at zero.) 00129 // static block_iterator blockBegin(); 00130 00131 // /// Returns end marker of iteration 00132 // static block_iterator blockEnd(); 00133 00134 // /// Add index where the next block starts 00135 // static void appendBlock(idx_type idx); 00136 00137 // /// Reset block-related data 00138 // static void clearBlocks(); 00139 00140 // /// Index where the last blocks starts 00141 // static idx_type lastBlockStart(); 00142 // //@} 00143 00144 // /// Change order of current ring 00145 // static void changeOrdering(ordercode_type code); 00146 00147 // /// Print low-level information 00148 // static ostream_type& print(ostream_type&); 00149 00150 // /// Activate given ring 00151 // static void set(ring_type& theRing); 00152 }; 00153 00155 00156 00158 BooleEnv::block_iterator 00159 block_begin(const BooleEnv::ring_type& ring); 00160 00161 00163 BooleEnv::block_iterator 00164 block_end(const BooleEnv::ring_type& ring); 00165 00166 END_NAMESPACE_PBORI 00167 00168 #endif // of #ifndef polybori_BooleEnv_h_