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 
75  typedef order_type& order_reference;
76 
79 
81  refcount_type ref;
82 
84  variable_names_type m_names;
85 
86 
88  order_ptr pOrder;
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 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 
#define END_NAMESPACE_PBORI
Finish project's namespace.
Definition: pbori_defs.h:77
vartext_type const_reference
Define type for outputing variable names.
Definition: CVariableNames.h:52
variable_names_type::const_reference const_varname_reference
Define type for getting names of variables.
Definition: CCuddCore.h:63
CCuddCore(size_type numVarsZ, const order_ptr &order)
Initialize raw decision diagram management.
Definition: CCuddCore.h:92
void addRef()
Increment reference count.
Definition: CCuddCore.h:105
#define BEGIN_NAMESPACE_PBORI
Start project's namespace.
Definition: pbori_defs.h:74
CVariableNames variable_names_type
Define type for storing names of variables.
Definition: CCuddCore.h:60
This struct contains type definitions and enumerations to be used for order codes.
Definition: pbori_defs.h:152
variable_names_type m_names
Stores names of variables.
Definition: CCuddCore.h:84
Definition: COrderingBase.h:43
This struct contains auxiliary type definitions.
Definition: pbori_defs.h:210
This class defines a C++ interface to CUDD's decicion diagram manager.
Definition: CCuddInterface.h:111
This class prepares the CUDD's raw decision diagram manager structure for the use with instrinsive po...
Definition: CCuddCore.h:50
void intrusive_ptr_release(pbori_DdManager *ptr)
Release current pointer by decrementing reference counting.
Definition: CCuddInterface.h:73
Definition: CVariableNames.h:30
order_type & order_reference
Reference for handling mterm orderings.
Definition: CCuddCore.h:75
refcount_type release()
Release this by decrementing reference counting.
Definition: CCuddCore.h:108
CCuddCore(const self &rhs)
Definition: CCuddCore.h:98
COrderingBase order_type
Type for handling mterm orderings.
Definition: CCuddCore.h:69
~CCuddCore()
Destructor.
Definition: CCuddCore.h:102
CTypes::ordercode_type ordercode_type
Enum for ordering codes.
Definition: CCuddCore.h:78
order_ptr pOrder
*Ordering of *this
Definition: CCuddCore.h:88
This class defines CWeakPtrFacade.
Definition: CWeakPtrFacade.h:36
void change_ordering(const order_ptr &newOrder)
Definition: CCuddCore.h:112
std::size_t size_type
Type for lengths, dimensions, etc.
Definition: pbori_defs.h:219
boost::shared_ptr< order_type > order_ptr
Smart pointer for handling mterm orderings.
Definition: CCuddCore.h:72
void intrusive_ptr_add_ref(pbori_DdManager *ptr)
Increment reference count.
Definition: CCuddInterface.h:67
refcount_type ref
Count instances pointing here.
Definition: CCuddCore.h:81
int ordercode_type
Type for ordering codes.
Definition: pbori_defs.h:240
CCuddInterface m_mgr
Current decision diagram management.
Definition: CCuddCore.h:66