Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions entwine/builder/builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,29 @@ Builder::Builder(
, verbose(verbose)
{ }

Builder::Builder(Builder&& o) noexcept
: endpoints(std::move(o.endpoints))
, metadata(std::move(o.metadata))
, io(Io::create(metadata, endpoints))
, manifest(std::move(o.manifest))
, hierarchy(std::move(o.hierarchy))
, verbose(o.verbose)
{ }

Builder& Builder::operator=(Builder&& o) noexcept
{
if (this != &o)
{
endpoints = std::move(o.endpoints);
metadata = std::move(o.metadata);
manifest = std::move(o.manifest);
hierarchy = std::move(o.hierarchy);
verbose = o.verbose;
io = Io::create(metadata, endpoints);
}
return *this;
}

uint64_t Builder::run(
const Threads threads,
const uint64_t limit,
Expand Down
3 changes: 3 additions & 0 deletions entwine/builder/builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ struct Builder
Hierarchy hierarchy = Hierarchy(),
bool verbose = true);

Builder(Builder&&) noexcept;
Builder& operator=(Builder&&) noexcept;

uint64_t run(
Threads threads,
uint64_t limit = 0,
Expand Down
22 changes: 22 additions & 0 deletions test/unit/build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,28 @@ TEST(build, failedWrite)
ASSERT_ANY_THROW(builder::run(builder, config));
}

TEST(build, movedBuilderIoMetadata)
{
const json config = {
{ "input", test::dataPath() + "ellipsoid.laz" },
{ "output", outDir },
{ "force", true },
{ "verbose", false },
{ "progressInterval", 0 },
{ "span", 32 },
{ "hierarchyStep", 2 }
};
Builder builder = builder::create(config);
ASSERT_TRUE(contains(builder.metadata.schema, "X"));

Builder moved(std::move(builder));
EXPECT_EQ(&moved.io->metadata, &moved.metadata);
EXPECT_TRUE(contains(moved.io->metadata.schema, "X"));

const uint64_t count = builder::run(moved, config);
EXPECT_GT(count, 0u);
}

TEST(build, binary)
{
run({
Expand Down