Skip to content

Class star::LayerView

ClassList > star > LayerView

Lightweight view into a specific layer with inheritance from base. More...

  • #include <stards.h>

Public Attributes

Type Name
LayerMetadataAccessor meta

Public Functions

Type Name
LayerView (std::shared_ptr< StarDataset > base, const std::string & layer_name)
std::shared_ptr< StarDataset > base () const
Get parent dataset.
bool contains (const std::string & key) const
Check if key exists in this layer or base (with inheritance).
NDArray< T > get (const std::string & key)
Get array from this layer with inheritance.
std::vector< std::string > keys () const
Get all keys in this layer (local + inherited).
std::string name () const
Get layer name.
void put (const std::string & key, NDArray< T > && value)
Store array in this layer.

Detailed Description

LayerView provides the same API as StarDataset but operates on a specific layer. Keys not found in the layer automatically fall back to the base layer.

Example: auto ds = StarDataset::open("file.stards"); auto layer1 = ds->create_layer("band_0"); layer1->meta.put("wavelength", NDArray<double>({}, 450.5)); // Layer-specific auto inst = layer1->meta.get("instrument"); // Falls back to base

Public Attributes Documentation

variable meta

LayerMetadataAccessor star::LayerView::meta;

Public Functions Documentation

function LayerView

inline star::LayerView::LayerView (
    std::shared_ptr< StarDataset > base,
    const std::string & layer_name
) 

function base

Get parent dataset.

inline std::shared_ptr< StarDataset > star::LayerView::base () const

Returns:

Shared pointer to base StarDataset


function contains

Check if key exists in this layer or base (with inheritance).

inline bool star::LayerView::contains (
    const std::string & key
) const

Parameters:

  • key Key to check

Returns:

true if key exists in layer or base


function get

Get array from this layer with inheritance.

template<typename T>
NDArray < T > star::LayerView::get (
    const std::string & key
) 

Template parameters:

  • T Element type

Parameters:

  • key Key to retrieve

Returns:

NDArray with data from layer or base


function keys

Get all keys in this layer (local + inherited).

inline std::vector< std::string > star::LayerView::keys () const

Returns:

Vector of key names


function name

Get layer name.

inline std::string star::LayerView::name () const

Returns:

Layer name


function put

Store array in this layer.

template<typename T>
void star::LayerView::put (
    const std::string & key,
    NDArray < T > && value
) 

Template parameters:

  • T Element type

Parameters:

  • key Key to store
  • value Data to store


The documentation for this class was generated from the following file StarDS/include/stards.h