PolyBoRi
|
00001 // -*- c++ -*- 00002 //***************************************************************************** 00014 //***************************************************************************** 00015 00016 #ifndef CCuddCore_h 00017 #define CCuddCore_h 00018 00019 // include basic definitions 00020 #include "pbori_defs.h" 00021 00022 #include "CCuddInterface.h" 00023 #include "CVariableNames.h" 00024 00025 // get PolyBoRi routines and functionals 00026 #include "pbori_func.h" 00027 #include "pbori_traits.h" 00028 00029 // intrisive (shared) pointer functionality 00030 #include <boost/intrusive_ptr.hpp> 00031 00032 #include <vector> 00033 #include <boost/shared_ptr.hpp> 00034 00035 BEGIN_NAMESPACE_PBORI 00036 00037 class COrderingBase; 00038 00050 class CCuddCore: 00051 public CTypes::orderenums_type, public CAuxTypes { 00052 00053 public: 00054 00056 typedef CCuddCore self; 00057 00059 typedef CVariableNames variable_names_type; 00060 00062 typedef variable_names_type::const_reference const_varname_reference; 00063 00065 CCuddInterface m_mgr; 00066 00068 typedef COrderingBase order_type; 00069 00071 typedef boost::shared_ptr<order_type> order_ptr; 00072 00074 typedef order_type& order_reference; 00075 00077 typedef CTypes::ordercode_type ordercode_type; 00078 00080 refcount_type ref; 00081 00083 variable_names_type m_names; 00084 00085 00087 order_ptr pOrder; 00088 00089 00091 CCuddCore(size_type numVarsZ, const order_ptr& order): 00092 ref(0), m_names(numVarsZ), 00093 m_mgr(0, numVarsZ), pOrder(order) { 00094 00095 } 00096 00099 CCuddCore(const self& rhs): 00100 ref(0), m_mgr(rhs.m_mgr), m_names(rhs.m_names), pOrder(rhs.pOrder) { } 00101 00103 ~CCuddCore(){ } 00104 00106 void addRef(){ ++ref; } 00107 00109 refcount_type release() { 00110 return (--ref); 00111 } 00112 00113 void change_ordering(const order_ptr& newOrder) { 00114 pOrder = newOrder; 00115 } 00116 00117 }; 00118 00120 00121 00122 inline void 00123 intrusive_ptr_add_ref(CCuddCore* pCore){ 00124 pCore->addRef(); 00125 } 00126 00128 inline void 00129 intrusive_ptr_release(CCuddCore* pCore) { 00130 if (!(pCore->release())) { 00131 delete pCore; 00132 } 00133 } 00134 00135 00136 00138 00139 END_NAMESPACE_PBORI 00140 00141 #endif 00142 00143