4#include <adiar/bdd/bdd_policy.h> 
    5#include <adiar/exception.h> 
    6#include <adiar/zdd/zdd_policy.h> 
    8#include <adiar/internal/assert.h> 
    9#include <adiar/internal/data_types/node.h> 
   10#include <adiar/internal/data_types/uid.h> 
   11#include <adiar/internal/io/node_file.h> 
   12#include <adiar/internal/io/node_ofstream.h> 
   13#include <adiar/internal/memory.h> 
   43  template <
typename dd_policy>
 
   52  template <
typename Policy>
 
   63     internal::node::uid_type uid;
 
 
  144  template <
typename Policy>
 
  153    using node_type = 
typename Policy::node_type;
 
  163    internal::node_ofstream nw;
 
  168    bool created_terminal;
 
  178    typename Policy::label_type current_label;
 
  183    typename Policy::id_type current_id;
 
  248      if (
low.builder_ref != builder_ref || 
high.builder_ref != builder_ref) {
 
  253      if (
low.uid.is_node() && 
low.uid.label() <= 
label) {
 
  257        throw invalid_argument(
"High child must point to a node with higher label");
 
  261      if (
label < current_label) {
 
  262        current_label = 
label;
 
  263        current_id    = Policy::max_id;
 
  270      const typename node_type::uid_type 
res_uid = Policy::reduction_rule(
n);
 
  273        created_terminal = 
true;
 
  274        terminal_val     = 
res_uid.value();
 
 
  397      created_terminal = 
true;
 
  400      return make_ptr(
typename node_type::pointer_type(
terminal_value));
 
 
  419    typename Policy::dd_type
 
  424      if (!nw.has_pushed()) {
 
  425        if (created_terminal) {
 
  426          nw.push(node_type(terminal_val));
 
  428          throw domain_error(
"There must be at least one node or terminal in the decision diagram");
 
  433      if (unref_nodes > 1) { 
throw domain_error(
"Decision diagram has more than one root"); }
 
  435      const typename Policy::dd_type 
res(nf);
 
 
  462      adiar_assert(!nw.is_open(), 
"`nw`'s attachment should be consistent with existence of `nf`");
 
  465      nf = internal::make_shared_levelized_file<node_type>();
 
  469      current_label    = Policy::max_label;
 
  470      current_id       = Policy::max_id;
 
  471      created_terminal = 
false;
 
  472      terminal_val     = 
false;
 
  493    make_ptr(
const typename node_type::pointer_type& 
p) 
noexcept 
 
The pointer type that builders use to identify the nodes they have constructed in a decision diagram.
Definition builder.h:54
 
builder_ptr()=default
Default construction for a pointer to null.
 
builder_ptr & operator=(const builder_ptr &bp)=default
Copy construction.
 
builder_ptr & operator=(builder_ptr &&bp)=default
Move construction.
 
builder_ptr(builder_ptr &&bp)=default
Move construction.
 
builder_ptr(const builder_ptr &bp)=default
Copy construction.
 
A builder for decision diagrams.
Definition builder.h:146
 
builder_ptr< Policy > add_node(const typename Policy::label_type label, const builder_ptr< Policy > &low, const bool high)
Add an internal node with a given label and its two children.
Definition builder.h:347
 
builder_ptr< Policy > add_node(const typename Policy::label_type label, const bool low, const bool high)
Add an internal node with a given label and its two children.
Definition builder.h:374
 
builder() noexcept
Constructor.
Definition builder.h:199
 
void clear() noexcept
Clear builder of all its current content, discarding all nodes and invalidating any pointers to them.
Definition builder.h:448
 
builder_ptr< Policy > add_node(typename Policy::label_type label, const builder_ptr< Policy > &low, const builder_ptr< Policy > &high)
Add an internal node with a given label and its two children.
Definition builder.h:241
 
~builder() noexcept
Destructor.
Definition builder.h:211
 
builder_ptr< Policy > add_node(bool terminal_value)
Add a terminal node with a given value.
Definition builder.h:393
 
builder_ptr< Policy > add_node(const typename Policy::label_type label, const bool low, const builder_ptr< Policy > &high)
Add an internal node with a given label and its two children.
Definition builder.h:319
 
Policy::dd_type build()
Builds the decision diagram with the added nodes. This also clears the builder.
Definition builder.h:420
 
consumer< ValueType > make_consumer(OutputIt &&iter)
Wrap an iterator into a consumer function.
Definition functional.h:71
 
Core types.
Definition adiar.h:40
 
std::domain_error domain_error
Inputs for which an operation is undefined.
Definition exception.h:38
 
std::invalid_argument invalid_argument
Inputs that are invalid.
Definition exception.h:33
 
std::shared_ptr< T > shared_ptr
Shared ownership of an object on the heap. This smart pointer essentially provides a (thread-safe) re...
Definition memory.h:52