GatherResult
GatherResult
Container for collected views created by gather operations. More…
#include <GatherResult.hpp>
Public Types
| Name | |
|---|---|
| using std::shared_ptr< T > | value_type |
| using typename std::vector< value_type >::const_iterator | const_iterator |
| using typename std::vector< value_type >::size_type | size_type |
| using Neuralyzer::Gather::element_type_of_t< T > | element_type Element type yielded by view iteration (e.g., ClockTicksWithId for DigitalEventSeries). |
Public Functions
| Name | |
|---|---|
| GatherResult() =default Default constructor - creates an empty GatherResult. |
|
| const_iterator | begin() const Get iterator to the first view. |
| const_iterator | end() const Get iterator past the last view. |
| const_iterator | cbegin() const Get const iterator to the first view. |
| const_iterator | cend() const Get const iterator past the last view. |
| size_type | size() const Get the number of views. |
| bool | empty() const Check if the result is empty. |
| value_type const & | operator[](size_type i) const Access view at index. |
| value_type const & | at(size_type i) const Access view at index with bounds checking. |
| value_type const & | front() const Get the first view. |
| value_type const & | back() const Get the last view. |
| std::shared_ptr< T > | source() Get the source data that views were created from. |
| std::vector< TimeFrameInterval > const & | intervals() const Get the alignment intervals used to create views. |
| std::shared_ptr< DigitalIntervalSeries const > | windows() const Get the prepared gather-window series used to define rows. |
| std::shared_ptr< DigitalEventSeries const > | alignmentPoints() const Get the companion alignment-point event series. |
| TimeFrameInterval | intervalAt(size_type i) const Get the interval at a specific index (O(1) access). |
| ClockTicks | alignmentTimeAt(size_type i) const Get the alignment time for a specific trial (O(1) access). |
| auto | views() const Get all views as a ranges-compatible view. |
| template <typename F > auto |
transform(F && func) const |
| template <typename F > auto |
transformWithInterval(F && func) const |
| GatherResult | materialize() const Materialize all views into owning storage. |
| GatherResult | reorder(std::vector< size_type > const & indices) const |
| size_type | originalIndex(size_type reordered_idx) const Get the original trial index for a position in a reordered result. |
| bool | isReordered() const Check if this result has been reordered. |
| TimeFrameInterval | intervalAtReordered(size_type reordered_idx) const Get the interval for a position in a reordered result. |
| template GatherResult |
create(std::shared_ptr< U > source, std::shared_ptr< DigitalIntervalSeries const > windows, std::shared_ptr< DigitalEventSeries const > alignment_points =[nullptr]) Create GatherResult from source and alignment intervals (TimeFrameIndex version). |
| template GatherResult |
create(std::shared_ptr< U > source, std::shared_ptr< DigitalIntervalSeries const > windows, std::shared_ptr< DigitalEventSeries const > alignment_points =[nullptr]) Create GatherResult from source and alignment intervals (int64_t version). |
| template GatherResult |
create(std::shared_ptr< U > source, std::shared_ptr< DigitalIntervalSeries const > windows, std::shared_ptr< DigitalEventSeries const > alignment_points =[nullptr]) Create GatherResult using time range copies (for RaggedTimeSeries types). |
| GatherResult | fromRows(std::vector< value_type > rows, std::shared_ptr< DigitalIntervalSeries const > windows =[nullptr], std::shared_ptr< DigitalEventSeries const > alignment_points =[nullptr]) Create a GatherResult from already-created row DataObjects. |
| template <typename ParentT > GatherResult |
fromRowsLike(GatherResult< ParentT > const & parent, std::vector< value_type > rows) Create transformed rows while preserving metadata from another GatherResult. |
Detailed Description
template <typename T >
class GatherResult;Container for collected views created by gather operations.
Template Parameters:
- T The data type (e.g., DigitalEventSeries, AnalogTimeSeries)
GatherResult holds a collection of view-backed (or copied) data objects created by aligning a source to a set of intervals. It provides a range interface for iteration and convenience methods for analysis.
Public Types Documentation
using value_type
using GatherResult< T >::value_type = std::shared_ptr<T>;using const_iterator
using GatherResult< T >::const_iterator = typename std::vector<value_type>::const_iterator;using size_type
using GatherResult< T >::size_type = typename std::vector<value_type>::size_type;using element_type
using GatherResult< T >::element_type = Neuralyzer::Gather::element_type_of_t<T>;Element type yielded by view iteration (e.g., ClockTicksWithId for DigitalEventSeries).
Public Functions Documentation
function GatherResult
GatherResult() =defaultDefault constructor - creates an empty GatherResult.
function begin
inline const_iterator begin() constGet iterator to the first view.
function end
inline const_iterator end() constGet iterator past the last view.
function cbegin
inline const_iterator cbegin() constGet const iterator to the first view.
function cend
inline const_iterator cend() constGet const iterator past the last view.
function size
inline size_type size() constGet the number of views.
function empty
inline bool empty() constCheck if the result is empty.
function operator[]
inline value_type const & operator[](
size_type i
) constAccess view at index.
Parameters:
- i Index of the view to access
Return: Reference to the shared_ptr at index i
function at
inline value_type const & at(
size_type i
) constAccess view at index with bounds checking.
Parameters:
- i Index of the view to access
Exceptions:
- std::out_of_range if i >= size()
Return: Reference to the shared_ptr at index i
function front
inline value_type const & front() constGet the first view.
function back
inline value_type const & back() constGet the last view.
function source
inline std::shared_ptr< T > source()Get the source data that views were created from.
function intervals
inline std::vector< TimeFrameInterval > const & intervals() constGet the alignment intervals used to create views.
function windows
inline std::shared_ptr< DigitalIntervalSeries const > windows() constGet the prepared gather-window series used to define rows.
Return: Shared pointer to the original prepared windows, or nullptr for empty/default and legacy adapter-only results.
Postcondition: Return value is shared with the GatherResult and is never modified by it.
function alignmentPoints
inline std::shared_ptr< DigitalEventSeries const > alignmentPoints() constGet the companion alignment-point event series.
Return: Shared pointer to row-aligned alignment events, or nullptr when the gather has no companion alignment metadata.
Postcondition: If non-null, the series has the same row count as [windows()](/api_generated/Classes/classGatherResult.md#function-windows).
function intervalAt
inline TimeFrameInterval intervalAt(
size_type i
) constGet the interval at a specific index (O(1) access).
Parameters:
- i Index of the interval
Exceptions:
- std::out_of_range if i >= size()
Return: The Interval at index i
function alignmentTimeAt
inline ClockTicks alignmentTimeAt(
size_type i
) constGet the alignment time for a specific trial (O(1) access).
Parameters:
- i Index of the trial
Exceptions:
- std::out_of_range if i >= size()
Return: Alignment time for trial i as ClockTicks
Returns the time point used for alignment (t=0 reference) for the specified trial. This is the value that should be subtracted from event times to get trial-relative times.
Prepared-window gathers with companion alignment points return the companion event time. Gathers without companion alignment metadata return the source-query interval start as a fallback.
function views
inline auto views() constGet all views as a ranges-compatible view.
function transform
template <typename F >
inline auto transform(
F && func
) constfunction transformWithInterval
template <typename F >
inline auto transformWithInterval(
F && func
) constfunction materialize
inline GatherResult materialize() constMaterialize all views into owning storage.
Return: New GatherResult with materialized views and preserved trial metadata
If views are backed by view storage, this creates a new GatherResult where each element has owning storage (copies the data).
function reorder
inline GatherResult reorder(
std::vector< size_type > const & indices
) constfunction originalIndex
inline size_type originalIndex(
size_type reordered_idx
) constGet the original trial index for a position in a reordered result.
Parameters:
- reordered_idx Index in the reordered result
Return: Original trial index, or reordered_idx if not reordered
After reordering, this returns the original trial index for a given position in the reordered sequence.
function isReordered
inline bool isReordered() constCheck if this result has been reordered.
function intervalAtReordered
inline TimeFrameInterval intervalAtReordered(
size_type reordered_idx
) constGet the interval for a position in a reordered result.
Parameters:
- reordered_idx Index in the (possibly reordered) result
Return: The Interval for the original trial at this position
This is the interval from the original trial, not the reordered position. Use originalIndex() to map reordered position to original trial index.
function create
template <typename U =T>
static inline GatherResult create(
std::shared_ptr< U > source,
std::shared_ptr< DigitalIntervalSeries const > windows,
std::shared_ptr< DigitalEventSeries const > alignment_points =nullptr
)Create GatherResult from source and alignment intervals (TimeFrameIndex version).
Parameters:
- source Source data to create views from
- intervals Alignment intervals (each interval becomes one view)
Return: GatherResult containing views for each interval
Note: Requires T to satisfy ViewableDataType concept
Creates a view for each interval in the alignment series. Each view references the source data without copying.
function create
template <typename U =T>
static inline GatherResult create(
std::shared_ptr< U > source,
std::shared_ptr< DigitalIntervalSeries const > windows,
std::shared_ptr< DigitalEventSeries const > alignment_points =nullptr
)Create GatherResult from source and alignment intervals (int64_t version).
Parameters:
- source Source data to create views from
- intervals Alignment intervals (each interval becomes one view)
Return: GatherResult containing views for each interval
Overload for types that use int64_t in their createView signature (e.g., DigitalIntervalSeries).
function create
template <typename U =T>
static inline GatherResult create(
std::shared_ptr< U > source,
std::shared_ptr< DigitalIntervalSeries const > windows,
std::shared_ptr< DigitalEventSeries const > alignment_points =nullptr
)Create GatherResult using time range copies (for RaggedTimeSeries types).
Parameters:
- source Source data to create copies from
- intervals Alignment intervals (each interval becomes one copy)
Return: GatherResult containing copies for each interval
For types that don’t support zero-copy views, this creates owning copies of data within each interval range.
function fromRows
static inline GatherResult fromRows(
std::vector< value_type > rows,
std::shared_ptr< DigitalIntervalSeries const > windows =nullptr,
std::shared_ptr< DigitalEventSeries const > alignment_points =nullptr
)Create a GatherResult from already-created row DataObjects.
Parameters:
- rows Row-aligned DataObjects in display order
- windows Optional row-window metadata with the same row count
- alignment_points Optional row-aligned alignment events with the same row count
Return: GatherResult that owns row pointers and optional metadata
Precondition:
- Every row pointer must be non-null.
- If supplied,
windowsandalignment_pointsmust matchrowssize.
Postcondition: The returned result has no direct-gather source provenance.
function fromRowsLike
template <typename ParentT >
static inline GatherResult fromRowsLike(
GatherResult< ParentT > const & parent,
std::vector< value_type > rows
)Create transformed rows while preserving metadata from another GatherResult.
Parameters:
- parent GatherResult that supplies row metadata and ordering
- rows Row DataObjects aligned to the visible order of
parent
Template Parameters:
- ParentT Parent row DataObject type
Return: GatherResult with rows and parent row metadata
Precondition:
- Every row pointer must be non-null.
rowsmust have the same row count asparent.
Postcondition: The returned result has no direct-gather source provenance.
Updated on 2026-11-13 at 20:25:40 +0000