PineForge unreleased
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
pineforge::native_bar_views_v1 Namespace Reference

Data Structures

struct  NativeBarView
 Borrowed OHLCV span, exactly the layout specified in 2.2:347-348. More...
 
struct  NativeBarViews
 Explicit read context (RESOLVED V1, required changes 1-4). More...
 
struct  NativeInstrumentFeedReadView
 Effective feed data (DESIGN 2.2:354-375; RESOLVED V1). More...
 
struct  NativeInstrumentFeedView
 Borrowed instrument feed, exactly 2.2:349. More...
 
class  NativeLowerPathSource
 Four-operation source (DESIGN 2.2:350-351; 5:1237-1262, as amended). More...
 

Functions

NativeInstrumentFeedReadView native_instrument_feed_view (const NativeInstrumentFeed &owned, const NativeInstrumentFeedView *borrowed) noexcept
 Common accessor (DESIGN 2.2:355-375).
 
NativeRunSpecValidation normalize_native_run_spec (NativeRunSpec &spec, const NativeBarViews &views) noexcept
 Existing full validation and zero-fee normalization over effective data.
 
NativeRunSpecValidation validate_native_instrument_feeds (const std::vector< NativeInstrumentFeed > &feeds, const NativeBarViews &views) noexcept
 The same feed-only validation over effective data, retaining all existing refusal ordering and typed catches (DESIGN 2.2:361-363).
 
NativeRunSpecValidation validate_native_timeframe_subscriptions (const std::vector< NativeTimeframeSubscription > &subscriptions, const std::string &input_tf, bool timeframe_undetected, const std::optional< NativeAuxiliaryFeed > &auxiliary_feed, const std::vector< NativeInstrumentFeed > &instrument_feeds, const NativeBarViews &views) noexcept
 The same feeds-first, auxiliary-feed, then subscription judgement over effective data, also at both begin declarations (DESIGN 2.2:361-363).
 
std::uint64_t native_instrument_feeds_digest (const std::vector< NativeInstrumentFeed > &feeds, const NativeBarViews &views) noexcept
 Same count, metadata, ordered OHLCV/timestamp/close/columns fold and feed NaN canonicalization (DESIGN 2.2:364-375).
 
std::uint64_t native_run_spec_digest (const NativeRunSpec &spec, const NativeBarViews &views)
 Portable spec fold with an explicit context, sharing the existing fold and relative run base; never infer external storage through a registry.
 
std::uint64_t native_intrabar_path_digest (const IntrabarPath &path, const NativeLowerPathSource *source)
 Null delegates to the vector digest; nonnull replaces only lower count/ walk.
 

Function Documentation

◆ native_instrument_feed_view()

NativeInstrumentFeedReadView pineforge::native_bar_views_v1::native_instrument_feed_view ( const NativeInstrumentFeed & owned,
const NativeInstrumentFeedView * borrowed )
noexcept

Common accessor (DESIGN 2.2:355-375).

Always select a nonnull override, including a present-empty one; otherwise expose owned data and its actual close count. No padding/copying. The caller MUST pass its slot or nullptr explicitly: no default argument (required change 3).

◆ normalize_native_run_spec()

NativeRunSpecValidation pineforge::native_bar_views_v1::normalize_native_run_spec ( NativeRunSpec & spec,
const NativeBarViews & views )
noexcept

Existing full validation and zero-fee normalization over effective data.

At binding, table/spec count mismatch or nonempty null bars reports {InvalidInstrumentFeedBar, InstrumentFeedBars}; nonempty null closes reports {InvalidInstrumentFeedClose, InstrumentFeedClose}. A borrowed slot with nonempty owning bars/closes reports the corresponding bar/close pair. Existing key/timeframe/duplicate, bar value/order, close length/bounds and column checks keep their order and typed calendar/allocation catches. A source requires lower_tf metadata with empty owning lower bars; otherwise report {InvalidIntrabarPath, IntrabarTimeframe}. No new C failure code.

Also route the adapter's projection validation through this overload, using the context built from its store. The host stages after lending feed bytes and before projection (required change 5). Pending state is not read through the consumer's active query. Context-free v3 APIs stay unchanged.

Referenced by pineforge::source::PineExecutionAdapter::project().

◆ validate_native_instrument_feeds()

NativeRunSpecValidation pineforge::native_bar_views_v1::validate_native_instrument_feeds ( const std::vector< NativeInstrumentFeed > & feeds,
const NativeBarViews & views )
noexcept

The same feed-only validation over effective data, retaining all existing refusal ordering and typed catches (DESIGN 2.2:361-363).

◆ validate_native_timeframe_subscriptions()

NativeRunSpecValidation pineforge::native_bar_views_v1::validate_native_timeframe_subscriptions ( const std::vector< NativeTimeframeSubscription > & subscriptions,
const std::string & input_tf,
bool timeframe_undetected,
const std::optional< NativeAuxiliaryFeed > & auxiliary_feed,
const std::vector< NativeInstrumentFeed > & instrument_feeds,
const NativeBarViews & views )
noexcept

The same feeds-first, auxiliary-feed, then subscription judgement over effective data, also at both begin declarations (DESIGN 2.2:361-363).

◆ native_instrument_feeds_digest()

std::uint64_t pineforge::native_bar_views_v1::native_instrument_feeds_digest ( const std::vector< NativeInstrumentFeed > & feeds,
const NativeBarViews & views )
noexcept

Same count, metadata, ordered OHLCV/timestamp/close/columns fold and feed NaN canonicalization (DESIGN 2.2:364-375).

Valid live descriptors are a precondition; owned close lengths remain total, missing closes fold zero.

◆ native_run_spec_digest()

std::uint64_t pineforge::native_bar_views_v1::native_run_spec_digest ( const NativeRunSpec & spec,
const NativeBarViews & views )

Portable spec fold with an explicit context, sharing the existing fold and relative run base; never infer external storage through a registry.

May re-walk a source and propagate exceptions; never invent a failure hash. The one-argument v3 form remains the owned-value API.

DESIGN 5 timing amendment (required change 8): configure takes immutable feed/lower component digests eagerly after normalization succeeds and before its first member write. Lower-walk exceptions propagate unchanged; nothing is published, and they are NOT converted into validation refusals. Keep these components through combined-cache invalidation and detachment, so the noexcept continuation query never walks released input. The outer spec fold may stay lazy; standalone context overloads may walk and throw.

◆ native_intrabar_path_digest()

std::uint64_t pineforge::native_bar_views_v1::native_intrabar_path_digest ( const IntrabarPath & path,
const NativeLowerPathSource * source )

Null delegates to the vector digest; nonnull replaces only lower count/ walk.

Preserve variant/metadata and raw double bits (no NaN normalization), folding count before visitation. Unexpected visitor stop or count/visit mismatch is coded engine_invariant; operational failures propagate, never a sentinel digest. Configure-time handling is the eager rule above. Preflight still owns lower-bar validation and the INT_MAX refusal. Runtime segment-generation failures are coded run_options_rejected, option intrabar_path; allocation exceptions take the existing run-entry handler.