Skip to main content

src/TransformsV2/core/TensorColumnBuilders.hpp

src/TransformsV2/core/TensorColumnBuilders.hpp

Builder layer that connects DataManager sources, TransformPipeline execution, and GatherResult gather+reduce patterns into ColumnProviderFn closures for LazyColumnTensorStorage. More…

Namespaces

Name
Neuralyzer
Neuralyzer::Transforms
Neuralyzer::Transforms::V2
Neuralyzer::TensorBuilders

Classes

Name
struct Neuralyzer::TensorBuilders::PipelineValueBindingRecipe
Row-aligned DataObject source used to populate one PipelineValueStore key.
struct Neuralyzer::TensorBuilders::ColumnRecipe
Describes how one tensor column is computed.

Detailed Description

Builder layer that connects DataManager sources, TransformPipeline execution, and GatherResult gather+reduce patterns into ColumnProviderFn closures for LazyColumnTensorStorage.

See:

The builders live in TransformsV2 (which depends on DataManager and GatherResult) so they can reference all source types. The resulting ColumnProviderFn closures are plain std::function<std::vector()> — they are injected into LazyColumnTensorStorage, which has no TransformsV2 dependency.

Source code

#ifndef NEURALYZER_V2_TENSOR_COLUMN_BUILDERS_HPP
#define NEURALYZER_V2_TENSOR_COLUMN_BUILDERS_HPP


#include "Tensors/InvalidationWiringFn.hpp"           // InvalidationWiringFn
#include "Tensors/storage/LazyColumnTensorStorage.hpp"// ColumnProviderFn, ColumnSource
#include "TimeFrame/TimeFrameIndex.hpp"               // TimeFrameIndex
#include "TransformsV2/PipelineValueStore/PipelineValueStore.hpp"

#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <vector>

class DataManager;
class DigitalIntervalSeries;

namespace Neuralyzer::Transforms::V2 {
class TransformPipeline;
class PipelineValueStore;
}// namespace Neuralyzer::Transforms::V2

namespace Neuralyzer::TensorBuilders {

// ============================================================================
// Interval Property Enum
// ============================================================================

enum class IntervalProperty : std::uint8_t {
    Start,  
    End,    
    Duration
};

// ============================================================================
// ColumnRecipe — JSON-serializable column specification
// ============================================================================

struct PipelineValueBindingRecipe {
    std::string source_key;

    std::string source_pipeline_json;

    std::string store_key;
};

struct ColumnRecipe {
    std::string column_name;

    std::string source_key;

    std::string pipeline_json;

    std::string row_pipeline_json;

    std::optional<IntervalProperty> interval_property;

    std::vector<PipelineValueBindingRecipe> pipeline_value_bindings;
};

// ============================================================================
// Builder Functions
// ============================================================================

ColumnProviderFn buildIntervalPropertyProvider(
        std::shared_ptr<DigitalIntervalSeries const> intervals,
        IntervalProperty property);

ColumnProviderFn buildAnalogSampleAtOffsetProvider(
        DataManager & dm,
        std::string const & source_key,
        std::vector<TimeFrameIndex> const & row_times,
        int64_t offset);

ColumnProviderFn buildPipelineColumnProvider(
        DataManager & dm,
        std::string const & source_key,
        std::vector<TimeFrameIndex> const & row_times,
        Neuralyzer::Transforms::V2::TransformPipeline pipeline);

ColumnProviderFn buildIntervalPipelineProvider(
        DataManager & dm,
        std::string const & source_key,
        std::shared_ptr<DigitalIntervalSeries const> intervals,
        Neuralyzer::Transforms::V2::TransformPipeline pipeline);

ColumnProviderFn buildIntervalPipelineProvider(
        DataManager & dm,
        std::string const & source_key,
        std::shared_ptr<DigitalIntervalSeries const> intervals,
        Neuralyzer::Transforms::V2::TransformPipeline pipeline,
        std::vector<Neuralyzer::Transforms::V2::PipelineValueStore> row_stores);

ColumnProviderFn buildProviderFromRecipe(
        DataManager & dm,
        ColumnRecipe const & recipe,
        std::vector<TimeFrameIndex> const & row_times,
        std::shared_ptr<DigitalIntervalSeries const> const & intervals);

// ============================================================================
// Invalidation Wiring
// ============================================================================

InvalidationWiringFn buildInvalidationWiringFn(
        DataManager & dm,
        std::vector<std::string> const & source_keys);

}// namespace Neuralyzer::TensorBuilders

#endif// NEURALYZER_V2_TENSOR_COLUMN_BUILDERS_HPP

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