17 #ifndef polybori_diagram_CApplyNodeFacade_h
18 #define polybori_diagram_CApplyNodeFacade_h
40 template <
class DiagramType,
class NodePtr>
55 bool operator==(
const diagram_type& rhs)
const {
61 bool operator!=(
const diagram_type& rhs)
const {
return !(*
this == rhs); }
68 throw std::runtime_error(
"Operands come from different manager.");
74 template <
class MgrType>
76 diagram_type
apply(node_ptr (*func)(MgrType, node_ptr))
const {
77 return diagram(func(get<MgrType>(), *
this));
81 template <
class MgrType>
82 diagram_type
apply(node_ptr (*func)(MgrType, node_ptr, node_ptr),
83 const diagram_type& rhs)
const {
84 checkSameManager(rhs);
85 return diagram(func(get<MgrType>(), *
this, rhs));
89 template <
class MgrType>
90 diagram_type
apply(node_ptr (*func)(MgrType, node_ptr, node_ptr, node_ptr),
91 const diagram_type& first,
const diagram_type& second)
const {
92 checkSameManager(first);
93 checkSameManager(second);
94 return diagram(func(get<MgrType>(), *
this, first, second));
98 template <
class MgrType,
class Type>
99 diagram_type
apply(node_ptr(*func)(MgrType, node_ptr, Type), Type value)
const {
100 return diagram(func(get<MgrType>(), *
this, value));
104 template <
class MgrType,
class ResultType>
105 ResultType
apply(ResultType(*func)(MgrType, node_ptr))
const {
106 return func(get<MgrType>(), *
this);
112 return diagram_type(my().ring(), node);
117 const diagram_type& my()
const {
118 return static_cast<const diagram_type&
>(*this);
122 template<
class MgrType>
123 MgrType
get()
const {
return my().getManager(); }
126 operator node_ptr()
const {
return my().getNode(); }
void checkSameManager(const diagram_type &other) const
Test, whether both operands.
Definition: CApplyNodeFacade.h:66
#define END_NAMESPACE_PBORI
Finish project's namespace.
Definition: pbori_defs.h:77
diagram_type apply(node_ptr(*func)(MgrType, node_ptr)) const
Unary function.
Definition: CApplyNodeFacade.h:76
#define BEGIN_NAMESPACE_PBORI
Start project's namespace.
Definition: pbori_defs.h:74
DiagramType diagram_type
Definition: CApplyNodeFacade.h:49
This template class defines a facade as a C++ interface for applying C-style functions to C-style str...
Definition: CApplyNodeFacade.h:41
bool operator!=(const diagram_type &rhs) const
Nonequality.
Definition: CApplyNodeFacade.h:61
BoolePolynomial::bool_type operator==(BoolePolynomial::bool_type lhs, const BoolePolynomial &rhs)
Equality check (with constant lhs)
Definition: BoolePolynomial.h:579
diagram_type diagram(node_ptr node) const
Get diagram of the same context.
Definition: CApplyNodeFacade.h:111
mgr_type * getManager() const
Get raw decision diagram manager.
Definition: CCuddDDFacade.h:256
diagram_type apply(node_ptr(*func)(MgrType, node_ptr, Type), Type value) const
Binary functions with non-diagram right-hand side.
Definition: CApplyNodeFacade.h:99
diagram_type apply(node_ptr(*func)(MgrType, node_ptr, node_ptr), const diagram_type &rhs) const
Binary function (two diagrams)
Definition: CApplyNodeFacade.h:82
diagram_type apply(node_ptr(*func)(MgrType, node_ptr, node_ptr, node_ptr), const diagram_type &first, const diagram_type &second) const
Ternary function (three diagrams)
Definition: CApplyNodeFacade.h:90
ResultType apply(ResultType(*func)(MgrType, node_ptr)) const
Unary functions with non-diagram result value.
Definition: CApplyNodeFacade.h:105
#define PBORI_UNLIKELY(expression)
Definition: pbori_defs.h:59
node_ptr getNode() const
Get raw node structure.
Definition: CCuddDDFacade.h:253
NodePtr node_ptr
Definition: CApplyNodeFacade.h:50