src/DataManager/utils/TableView/computers/EventInIntervalComputer.h
src/DataManager/utils/TableView/computers/EventInIntervalComputer.h
Classes
| Name | |
|---|---|
| class | EventInIntervalComputer Templated computer for processing events within time intervals. |
Types
| Name | |
|---|---|
| enum class std::uint8_t | EventOperation { Presence, Count, Gather, Gather_Center} Enumeration of operations that can be performed on events within intervals. |
Types Documentation
enum EventOperation
| Enumerator | Value | Description |
|---|---|---|
| Presence | Returns bool: true if any events exist in the interval. | |
| Count | Returns int: number of events in the interval. | |
| Gather | Returns std::vector |
|
| Gather_Center | Returns std::vector |
Enumeration of operations that can be performed on events within intervals.
Source code
#ifndef EVENT_IN_INTERVAL_COMPUTER_H
#define EVENT_IN_INTERVAL_COMPUTER_H
#include "utils/TableView/interfaces/IColumnComputer.h"
#include <cstdint>
#include <memory>
#include <span>
#include <string>
#include <vector>
class DigitalEventSeries;
class ExecutionPlan;
enum class EventOperation : std::uint8_t {
Presence,
Count,
Gather,
Gather_Center
};
template<typename T>
class EventInIntervalComputer : public IColumnComputer<T> {
public:
EventInIntervalComputer(std::shared_ptr<DigitalEventSeries> source,
EventOperation operation,
std::string sourceName)
: m_source(std::move(source)),
m_operation(operation),
m_sourceName(std::move(sourceName)) {}
[[nodiscard]] std::pair<std::vector<T>, ColumnEntityIds> compute(ExecutionPlan const & plan) const override;
[[nodiscard]] std::string getSourceDependency() const override {
return m_sourceName;
}
[[nodiscard]] EntityIdStructure getEntityIdStructure() const override {
return EntityIdStructure::Complex;
}
private:
std::shared_ptr<DigitalEventSeries> m_source;
EventOperation m_operation;
std::string m_sourceName;
[[nodiscard]] std::vector<TimeFrameIndex> findEventsInInterval(std::span<TimeFrameIndex const> events,
TimeFrameIndex startIdx,
TimeFrameIndex endIdx) const;
};
// Template specializations for different operation types
template<>
[[nodiscard]] std::pair<std::vector<bool>, ColumnEntityIds> EventInIntervalComputer<bool>::compute(ExecutionPlan const & plan) const;
template<>
[[nodiscard]] std::pair<std::vector<int>, ColumnEntityIds> EventInIntervalComputer<int>::compute(ExecutionPlan const & plan) const;
template<>
[[nodiscard]] std::pair<std::vector<std::vector<float>>, ColumnEntityIds> EventInIntervalComputer<std::vector<float>>::compute(ExecutionPlan const & plan) const;
#endif// EVENT_IN_INTERVAL_COMPUTER_HUpdated on 2026-11-13 at 20:25:43 +0000