Skip to main content

dl::DataBank

dl::DataBank

Named library for geometry sources and channel-encoded tensors. More…

#include <DataBank.hpp>

Public Functions

Name
DataBank()
DataBank(std::size_t max_entries)
bool contains(std::string_view id) const
Check whether an entry exists.
std::optional< DataBankEntry > get(std::string_view id) const
Get a copy of an entry.
std::optional< at::Tensor > getEncoded(std::string_view id) const
Get the channel-encoded tensor for an entry.
std::optional< EncodingSourceVariant > getSource(std::string_view id) const
Get the raw source for an entry.
bool putSource(std::string id, EncodingSourceVariant source, DataBankEntryMetadata metadata)
Store a raw source without encoding.
bool putEncoded(std::string id, at::Tensor encoded, DataBankEntryMetadata metadata, std::optional< EncodingSourceVariant > source =std::nullopt)
Store a channel-encoded tensor, optionally retaining the source.
bool encodeEntry(std::string_view id, TensorSlotDescriptor const & slot, EncoderVariant const & encoder_params)
Encode the stored source for an entry using slot metadata.
void remove(std::string_view id)
Remove a single entry.
void clear()
Remove all entries.
std::vector< std::string > ids() const
List all entry IDs.
std::size_t size() const
Number of stored entries.
std::size_t maxEntries() const
Maximum allowed entries.
std::vector< int64_t > encodedShape(std::string_view id) const
Tensor shape for preview, or empty if missing or not encoded.
std::pair< float, float > encodedRange(std::string_view id) const
Min/max of encoded tensor values, or {0,0} if missing.

Public Attributes

Name
std::size_t kDefaultMaxEntries

Detailed Description

class dl::DataBank;

Named library for geometry sources and channel-encoded tensors.

Entries are keyed by user-defined string IDs. Each entry may hold a raw source (Mask2D, points, image pixels, line) and/or a channel-encoded tensor with batch dimension 1.

Public Functions Documentation

function DataBank

DataBank()

function DataBank

explicit DataBank(
    std::size_t max_entries
)

function contains

bool contains(
    std::string_view id
) const

Check whether an entry exists.

function get

std::optional< DataBankEntry > get(
    std::string_view id
) const

Get a copy of an entry.

function getEncoded

std::optional< at::Tensor > getEncoded(
    std::string_view id
) const

Get the channel-encoded tensor for an entry.

function getSource

std::optional< EncodingSourceVariant > getSource(
    std::string_view id
) const

Get the raw source for an entry.

function putSource

bool putSource(
    std::string id,
    EncodingSourceVariant source,
    DataBankEntryMetadata metadata
)

Store a raw source without encoding.

Precondition: id must pass validateEntryId()

Postcondition: contains(id) is true and getSource(id) returns source

function putEncoded

bool putEncoded(
    std::string id,
    at::Tensor encoded,
    DataBankEntryMetadata metadata,
    std::optional< EncodingSourceVariant > source =std::nullopt
)

Store a channel-encoded tensor, optionally retaining the source.

Precondition:

function encodeEntry

bool encodeEntry(
    std::string_view id,
    TensorSlotDescriptor const & slot,
    EncoderVariant const & encoder_params
)

Encode the stored source for an entry using slot metadata.

Precondition: contains(id) and getSource(id) is engaged

Postcondition: getEncoded(id) is engaged on success

function remove

void remove(
    std::string_view id
)

Remove a single entry.

function clear

void clear()

Remove all entries.

function ids

std::vector< std::string > ids() const

List all entry IDs.

function size

std::size_t size() const

Number of stored entries.

function maxEntries

std::size_t maxEntries() const

Maximum allowed entries.

function encodedShape

std::vector< int64_t > encodedShape(
    std::string_view id
) const

Tensor shape for preview, or empty if missing or not encoded.

function encodedRange

std::pair< float, float > encodedRange(
    std::string_view id
) const

Min/max of encoded tensor values, or {0,0} if missing.

Public Attributes Documentation

variable kDefaultMaxEntries

static std::size_t kDefaultMaxEntries = 64;

Default maximum number of entries before put operations fail.


Updated on 2026-11-13 at 20:25:42 +0000