Skip to content

Commit

Permalink
Remove <adiar/file.h>
Browse files Browse the repository at this point in the history
The entire public API does not make use of Adiar's files (with the exception
of 'domain_get()' and one overload of 'domain_set(...)', both of which are
really only intended for an internal use-case anyway).
  • Loading branch information
SSoelvsten committed Oct 8, 2023
1 parent 1b44f6e commit e54d58f
Show file tree
Hide file tree
Showing 18 changed files with 357 additions and 412 deletions.
1 change: 0 additions & 1 deletion src/adiar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ set(HEADERS
domain.h
exception.h
exec_policy.h
file.h
functional.h
statistics.h
types.h
Expand Down
1 change: 0 additions & 1 deletion src/adiar/adiar.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <adiar/exception.h>
#include <adiar/exec_policy.h>
#include <adiar/functional.h>
#include <adiar/file.h> // <-- TODO: Remove!

////////////////////////////////////////////////////////////////////////////////
/// Global Domain
Expand Down
2 changes: 0 additions & 2 deletions src/adiar/bdd.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#include <adiar/functional.h>
#include <adiar/types.h>

#include <adiar/file.h> // <-- TODO: remove!

#include <adiar/bdd/bdd.h>
#include <adiar/zdd/zdd.h>

Expand Down
2 changes: 1 addition & 1 deletion src/adiar/bdd/bdd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ namespace adiar

__bdd bdd_from(const exec_policy &ep, const zdd &A)
{
const shared_file<bdd::label_type> dom = domain_get();
const internal::shared_file<bdd::label_type> dom = domain_get();
internal::file_stream<domain_var> ds(dom);

return bdd_from(ep, A, make_generator(ds));
Expand Down
11 changes: 5 additions & 6 deletions src/adiar/domain.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include "domain.h"

#include <adiar/internal/data_types/node.h>
#include <adiar/internal/io/file.h>
#include <adiar/internal/io/shared_file_ptr.h>
#include <adiar/internal/io/file_writer.h>

namespace adiar
{
Expand All @@ -13,7 +12,7 @@ namespace adiar

void domain_set(const domain_var varcount)
{
shared_file<domain_var> dom;
internal::shared_file<domain_var> dom;
{ // Garbage collect writer to free write-lock
internal::file_writer<domain_var> lw(dom);
for (domain_var v = 0; v < varcount; v++) { lw << v; }
Expand All @@ -23,7 +22,7 @@ namespace adiar

void domain_set(const generator<domain_var> &gen)
{
shared_file<domain_var> dom;
internal::shared_file<domain_var> dom;
{ // Garbage collect writer to free write-lock
internal::file_writer<domain_var> lw(dom);

Expand All @@ -34,7 +33,7 @@ namespace adiar
domain_set(dom);
}

void domain_set(const shared_file<domain_var> &dom)
void domain_set(const internal::shared_file<domain_var> &dom)
{
domain_ptr = dom;
}
Expand All @@ -49,7 +48,7 @@ namespace adiar
return domain_ptr ? true : false;
}

shared_file<domain_var> domain_get()
internal::shared_file<domain_var> domain_get()
{
if(!domain_isset()) {
throw domain_error("Domain must be set before it can be used");
Expand Down
8 changes: 5 additions & 3 deletions src/adiar/domain.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
////////////////////////////////////////////////////////////////////////////////

#include <adiar/exception.h>
#include <adiar/file.h> // <-- TODO: Replace with <adiar/internal/io/file.h>
#include <adiar/functional.h>

#include <adiar/internal/io/file.h>
#include <adiar/internal/io/shared_file_ptr.h>

// TODO: Make 'domain_var' independent of node type. Then remove this include.
#include <adiar/internal/data_types/node.h>

Expand Down Expand Up @@ -75,7 +77,7 @@ namespace adiar
///
/// \see domain_get()
//////////////////////////////////////////////////////////////////////////////
void domain_set(const shared_file<domain_var> &dom);
void domain_set(const internal::shared_file<domain_var> &dom);

//////////////////////////////////////////////////////////////////////////////
/// \brief Removes any globally shared domain variables (if any).
Expand All @@ -102,7 +104,7 @@ namespace adiar
///
/// \see domain_set(const shared_file<domain_var> &dom)
//////////////////////////////////////////////////////////////////////////////
shared_file<domain_var> domain_get();
internal::shared_file<domain_var> domain_get();

//////////////////////////////////////////////////////////////////////////////
/// \brief The size of the domain.
Expand Down
52 changes: 0 additions & 52 deletions src/adiar/file.h

This file was deleted.

6 changes: 3 additions & 3 deletions src/adiar/zdd/build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace adiar

zdd zdd_ithvar(const zdd::label_type var)
{
const shared_file<domain_var> dom = domain_get();
const internal::shared_file<domain_var> dom = domain_get();
internal::file_stream<domain_var, true> ds(dom);

return zdd_ithvar(var, make_generator(ds));
Expand Down Expand Up @@ -101,7 +101,7 @@ namespace adiar

zdd zdd_nithvar(const zdd::label_type var)
{
const shared_file<domain_var> dom = domain_get();
const internal::shared_file<domain_var> dom = domain_get();
internal::file_stream<domain_var, true> ds(dom);

return zdd_nithvar(var, make_generator(ds));
Expand Down Expand Up @@ -156,7 +156,7 @@ namespace adiar
return zdd_null();
}

const shared_file<domain_var> dom = domain_get();
const internal::shared_file<domain_var> dom = domain_get();
internal::file_stream<domain_var, true> ds(dom);

return zdd_powerset(make_generator(ds));
Expand Down
4 changes: 2 additions & 2 deletions src/adiar/zdd/complement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace adiar
}

static zdd on_terminal_input(const bool terminal_value, const zdd& /*dd*/,
const shared_file<zdd::label_type> &universe)
const internal::shared_file<zdd::label_type> &universe)
{
// TODO: remove
internal::file_stream<zdd::label_type, true> ls(universe);
Expand Down Expand Up @@ -118,7 +118,7 @@ namespace adiar

__zdd zdd_complement(const exec_policy &ep, const zdd &A)
{
const shared_file<zdd::label_type> dom = domain_get();
const internal::shared_file<zdd::label_type> dom = domain_get();
internal::file_stream<domain_var> ds(dom);

return zdd_complement(ep, A, make_generator(ds));
Expand Down
2 changes: 1 addition & 1 deletion src/adiar/zdd/zdd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ namespace adiar

__zdd zdd_from(const exec_policy &ep, const bdd &f)
{
const shared_file<zdd::label_type> dom = domain_get();
const internal::shared_file<zdd::label_type> dom = domain_get();
internal::file_stream<domain_var> ds(dom);

return zdd_from(ep, f, make_generator(ds));
Expand Down
4 changes: 2 additions & 2 deletions test/adiar/bdd/test_count.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ go_bandit([]() {
}

// Set domain to be empty
adiar::shared_file<bdd::label_type> empty_dom;
shared_file<bdd::label_type> empty_dom;
domain_set(empty_dom);

describe("bdd_nodecount", [&]() {
Expand Down Expand Up @@ -292,7 +292,7 @@ go_bandit([]() {
});

describe("bdd_satcount(f) [non-empty dom]", [&]() {
adiar::shared_file<bdd::label_type> dom;
shared_file<bdd::label_type> dom;
{
label_writer lw(dom);
lw << 0 << 1 << 2 << 3 << 4 << 5 << 6;
Expand Down
10 changes: 5 additions & 5 deletions test/adiar/internal/data_structures/test_level_merger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,14 @@ go_bandit([]() {

describe("level_merger<shared_file<label_type>, ...>", [&]() {
it("can use a single label_file", [&]() {
adiar::shared_file<ptr_uint64::label_type> f;
shared_file<ptr_uint64::label_type> f;

{ // Garbage collect the writers
label_writer w(f);
w << 0 << 2 << 3;
}

level_merger<adiar::shared_file<ptr_uint64::label_type>, std::less<>, 1> merger;
level_merger<shared_file<ptr_uint64::label_type>, std::less<>, 1> merger;

merger.hook({f});

Expand All @@ -316,8 +316,8 @@ go_bandit([]() {
});

it("can merge two label_files", [&]() {
adiar::shared_file<ptr_uint64::label_type> f1;
adiar::shared_file<ptr_uint64::label_type> f2;
shared_file<ptr_uint64::label_type> f1;
shared_file<ptr_uint64::label_type> f2;

{ // Garbage collect the writers
label_writer w1(f1);
Expand All @@ -327,7 +327,7 @@ go_bandit([]() {
w2 << 0 << 1 << 3;
}

level_merger<adiar::shared_file<ptr_uint64::label_type>, std::less<>, 2> merger;
level_merger<shared_file<ptr_uint64::label_type>, std::less<>, 2> merger;

merger.hook({f1, f2});

Expand Down
Loading

0 comments on commit e54d58f

Please sign in to comment.