PolyBoRi
CCuddCore.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //*****************************************************************************
14 //*****************************************************************************
15 
16 #ifndef polybori_ring_CCuddCore_h
17 #define polybori_ring_CCuddCore_h
18 
19 // include basic definitions
20 #include <polybori/pbori_defs.h>
21 
22 #include "CCuddInterface.h"
23 #include "CVariableNames.h"
24 
25 // get PolyBoRi routines and functionals
27 #include <polybori/common/traits.h>
28 
29 // intrisive (shared) pointer functionality
30 #include <boost/intrusive_ptr.hpp>
31 
32 #include <vector>
33 #include <boost/shared_ptr.hpp>
34 
36 
37 class COrderingBase;
38 
50 class CCuddCore:
51  public CTypes::orderenums_type, public CAuxTypes,
52  public CWeakPtrFacade<CCuddCore> {
53 
54 public:
55 
57  typedef CCuddCore self;
58 
61 
64 
67 
70 
72  typedef boost::shared_ptr<order_type> order_ptr;
73 
76 
79 
81  refcount_type ref;
82 
85 
86 
89 
90 
92  CCuddCore(size_type numVarsZ, const order_ptr& order):
93  m_mgr(0, numVarsZ), ref(0), m_names(numVarsZ),
94  pOrder(order) { }
95 
98  CCuddCore(const self& rhs):
99  m_mgr(rhs.m_mgr), ref(0), m_names(rhs.m_names), pOrder(rhs.pOrder) { }
100 
103 
105  void addRef(){ ++ref; }
106 
108  refcount_type release() {
109  return (--ref);
110  }
111 
112  void change_ordering(const order_ptr& newOrder) {
113  pOrder = newOrder;
114  }
115 
116 };
117 
119 
120 
121 inline void
123  pCore->addRef();
124 }
125 
127 inline void
129  if (!(pCore->release())) {
130  delete pCore;
131  }
132 }
133 
134 
135 
137 
139 
140 #endif
141 
142