Application adapters

std::vector<std::filesystem::path> snt::dip::run_adapter(const Environment &env, const Adapter &adapter, const std::filesystem::path &output_dir, const std::filesystem::path &snapshot = {})

Plan, validate, and write adapter outputs below output_dir. An existing destination is never overwritten. snapshot is an optional relative DIPH5 path below the same directory. Returns written paths in registration order.

std::vector<std::filesystem::path> snt::dip::run_adapter_project(const std::filesystem::path &project, const Adapter &adapter, const std::filesystem::path &output_dir, const std::filesystem::path &snapshot = {})

Parse a DIPfile and run the adapter on its evaluated environment.

std::vector<std::filesystem::path> snt::dip::run_adapter_snapshot(const std::filesystem::path &input, const Adapter &adapter, const std::filesystem::path &output_dir, const std::filesystem::path &snapshot = {})

Load a DIPH5 environment and run the adapter on its retained values and metadata.

class Adapter
#include <adapter.h>

Application-specific conversion of evaluated DIPL values to output files.

Public Functions

virtual ~Adapter() = default
virtual void plan(const Environment &env, AdapterContext &context) const = 0

Select values, validate them for the target application, and register its files.

class AdapterContext
#include <adapter.h>

Collects files requested by one adapter run. Paths are relative to the output directory.

Public Types

using StreamWriter = std::function<void(std::ostream&)>

Public Functions

void add_text(std::filesystem::path path, std::string content)

Register UTF-8 or other application-defined text without changing its contents.

void add_binary(std::filesystem::path path, std::vector<std::uint8_t> content)

Register raw bytes without encoding or newline conversion.

void add_stream(std::filesystem::path path, StreamWriter writer)

The writer is called once, after all output paths have been validated.