PineForge HPO 1.11.0
Native hyperparameter optimization for PineForge strategies
Loading...
Searching...
No Matches
pineforge::hpo::DatasetView Struct Referencefinal

Immutable, non-copying range of bars retaining its Dataset owner. More...

#include <pineforge/hpo/dataset.hpp>

Public Member Functions

 DatasetView (std::shared_ptr< const Dataset > dataset)
 Constructs a view of the entire owner.
 
 DatasetView (std::shared_ptr< const Dataset > dataset, std::size_t first, std::size_t count)
 Constructs the range [first, first + count).
 
const pf_bar_t * data () const noexcept
 Returns owner->data() + begin, preserving the pointer even for an empty owner.
 
std::size_t size () const noexcept
 Returns the number of bars in this view.
 
bool empty () const noexcept
 Returns whether this view contains no bars.
 

Public Attributes

const std::shared_ptr< const Dataset > owner
 Keeps owned bars or the mapping and its descriptor alive.
 
const std::size_t begin
 First bar's index in owner.
 
const std::size_t length
 Number of bars in this view.
 

Detailed Description

Immutable, non-copying range of bars retaining its Dataset owner.

Bounds are checked once at construction without adding begin and length (so overflow cannot admit an invalid range). An explicit empty view is allowed, including at owner->size(); it is useful for range arithmetic but cannot be executed by TrialExecutor. A whole view preserves the owner's exact data pointer. Mapped-file verification belongs to the owner at the run boundary; constructing or reading a view never calls Dataset::verify_unchanged().

Definition at line 127 of file dataset.hpp.

Constructor & Destructor Documentation

◆ DatasetView() [1/2]

pineforge::hpo::DatasetView::DatasetView ( std::shared_ptr< const Dataset >  dataset)
explicit

Constructs a view of the entire owner.

Exceptions
std::invalid_argumentwith code hpo_dataset_invalid for a null owner.

◆ DatasetView() [2/2]

pineforge::hpo::DatasetView::DatasetView ( std::shared_ptr< const Dataset >  dataset,
std::size_t  first,
std::size_t  count 
)

Constructs the range [first, first + count).

Exceptions
std::invalid_argumentwith code hpo_dataset_invalid for a null owner or bounds outside that owner's bars.

Member Function Documentation

◆ data()

const pf_bar_t * pineforge::hpo::DatasetView::data ( ) const
noexcept

Returns owner->data() + begin, preserving the pointer even for an empty owner.

◆ empty()

bool pineforge::hpo::DatasetView::empty ( ) const
inlinenoexcept

Returns whether this view contains no bars.

Definition at line 149 of file dataset.hpp.

References length.

◆ size()

std::size_t pineforge::hpo::DatasetView::size ( ) const
inlinenoexcept

Returns the number of bars in this view.

Definition at line 147 of file dataset.hpp.

References length.

Member Data Documentation

◆ begin

const std::size_t pineforge::hpo::DatasetView::begin

First bar's index in owner.

Definition at line 140 of file dataset.hpp.

◆ length

const std::size_t pineforge::hpo::DatasetView::length

Number of bars in this view.

Definition at line 142 of file dataset.hpp.

Referenced by empty(), and size().

◆ owner

const std::shared_ptr<const Dataset> pineforge::hpo::DatasetView::owner

Keeps owned bars or the mapping and its descriptor alive.

Definition at line 138 of file dataset.hpp.

Referenced by pineforge::hpo::TrialExecutor::dataset().


The documentation for this struct was generated from the following file: