00001
00002
00014
00015
00016 #ifndef polybori_ring_CCuddCore_h
00017 #define polybori_ring_CCuddCore_h
00018
00019
00020 #include <polybori/pbori_defs.h>
00021
00022 #include "CCuddInterface.h"
00023 #include "CVariableNames.h"
00024
00025
00026 #include <polybori/routines/pbori_func.h>
00027 #include <polybori/common/traits.h>
00028
00029
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 public CWeakPtrFacade<CCuddCore> {
00053
00054 public:
00055
00057 typedef CCuddCore self;
00058
00060 typedef CVariableNames variable_names_type;
00061
00063 typedef variable_names_type::const_reference const_varname_reference;
00064
00066 CCuddInterface m_mgr;
00067
00069 typedef COrderingBase order_type;
00070
00072 typedef boost::shared_ptr<order_type> order_ptr;
00073
00075 typedef order_type& order_reference;
00076
00078 typedef CTypes::ordercode_type ordercode_type;
00079
00081 refcount_type ref;
00082
00084 variable_names_type m_names;
00085
00086
00088 order_ptr pOrder;
00089
00090
00092 CCuddCore(size_type numVarsZ, const order_ptr& order):
00093 m_mgr(0, numVarsZ), ref(0), m_names(numVarsZ),
00094 pOrder(order) { }
00095
00098 CCuddCore(const self& rhs):
00099 m_mgr(rhs.m_mgr), ref(0), m_names(rhs.m_names), pOrder(rhs.pOrder) { }
00100
00102 ~CCuddCore(){ }
00103
00105 void addRef(){ ++ref; }
00106
00108 refcount_type release() {
00109 return (--ref);
00110 }
00111
00112 void change_ordering(const order_ptr& newOrder) {
00113 pOrder = newOrder;
00114 }
00115
00116 };
00117
00119
00120
00121 inline void
00122 intrusive_ptr_add_ref(CCuddCore* pCore){
00123 pCore->addRef();
00124 }
00125
00127 inline void
00128 intrusive_ptr_release(CCuddCore* pCore) {
00129 if (!(pCore->release())) {
00130 delete pCore;
00131 }
00132 }
00133
00134
00135
00137
00138 END_NAMESPACE_PBORI
00139
00140 #endif
00141
00142