• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

paulmthompson / WhiskerToolbox / 17846711083

19 Sep 2025 02:28AM UTC coverage: 72.02% (+0.08%) from 71.942%
17846711083

push

github

paulmthompson
event in interval computer works with entity ids

259 of 280 new or added lines in 6 files covered. (92.5%)

268 existing lines in 17 files now uncovered.

40247 of 55883 relevant lines covered (72.02%)

1227.29 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

18.18
/src/DataManager/utils/TableView/interfaces/IEventSource.h
1
#ifndef IEVENT_SOURCE_H
2
#define IEVENT_SOURCE_H
3

4
#include "TimeFrame/TimeFrame.hpp"
5
#include "Entity/EntityTypes.hpp"
6

7

8
#include <span>
9

10
/**
11
 * @brief Interface for data sources that consist of sorted event timestamps/indices.
12
 * 
13
 * This interface is designed for data that represents discrete events in time,
14
 * such as digital event series or spike trains. The events are assumed to be
15
 * sorted in ascending order.
16
 */
17
class IEventSource {
18
public:
19
    virtual ~IEventSource() = default;
69✔
20
    
21
    // Make this class non-copyable and non-movable since it's a pure interface
22
    IEventSource(const IEventSource&) = delete;
23
    IEventSource& operator=(const IEventSource&) = delete;
24
    IEventSource(IEventSource&&) = delete;
25
    IEventSource& operator=(IEventSource&&) = delete;
26

27
    /** 
28
     *@brief Gets the name of this data source.
29
     * 
30
     * This name is used for dependency tracking and ExecutionPlan caching
31
     * in the TableView system.
32
     * 
33
     * @return The name of the data source.
34
     */
35
    virtual auto getName() const -> std::string const & = 0;
36

37
    /**
38
     * @brief Gets the total number of events in the source.
39
     * @return The number of events.
40
     */
41
    virtual auto size() const -> size_t = 0;
42

43
    
44
    /**
45
     * @brief Gets the TimeFrame the data belongs to.
46
     * @return A shared pointer to the TimeFrame.
47
     */
48
    virtual std::shared_ptr<TimeFrame> getTimeFrame() const = 0;
49

50
    /**
51
     * @brief Gets the data within a specific time range.
52
     * 
53
     * This gets the data in the range [start, end] (inclusive) from the source timeframe
54
     * 
55
     * @param start The start index of the time range.
56
     * @param end The end index of the time range.
57
     * @param target_timeFrame The target time frame (from the caller) for the data.
58
     * @return A vector of floats representing the data in the specified range.
59
     */
60
    virtual std::vector<float> getDataInRange(TimeFrameIndex start,
61
                                              TimeFrameIndex end,
62
                                              TimeFrame const * target_timeFrame) = 0;
63

64
    /**
65
     * @brief Gets the data within a specific time range along with their original indices.
66
     * 
67
     * This method returns both the event values and their original indices in the source,
68
     * enabling proper EntityId mapping. Default implementation calls getDataInRange
69
     * and provides indices 0, 1, 2, ... which may not be correct.
70
     * 
71
     * @param start The start index of the time range.
72
     * @param end The end index of the time range.
73
     * @param target_timeFrame The target time frame (from the caller) for the data.
74
     * @return A vector of pairs (event_value, source_index) representing the data in the specified range.
75
     */
NEW
76
    virtual std::vector<std::pair<float, size_t>> getDataInRangeWithIndices(TimeFrameIndex start,
×
77
                                                                           TimeFrameIndex end,
78
                                                                           TimeFrame const * target_timeFrame) {
NEW
79
        auto data = getDataInRange(start, end, target_timeFrame);
×
NEW
80
        std::vector<std::pair<float, size_t>> result;
×
NEW
81
        result.reserve(data.size());
×
NEW
82
        for (size_t i = 0; i < data.size(); ++i) {
×
NEW
83
            result.emplace_back(data[i], i);  // Default fallback - may not be correct
×
84
        }
NEW
85
        return result;
×
NEW
86
    }
×
87

88
    /**
89
     * @brief Optional: get the EntityId for the k-th event in the source ordering.
90
     * Implementors that don't support EntityIds may return 0.
91
     */
92
    [[nodiscard]] virtual auto getEntityIdAt(size_t index) const -> EntityId { (void)index; return 0; }
×
93

94
protected:
95
    // Protected constructor to prevent direct instantiation
96
    IEventSource() = default;
69✔
97
};
98

99
#endif // IEVENT_SOURCE_H
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc