• 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

8.0
/src/DataManager/utils/TableView/interfaces/IMultiColumnComputer.h
1
#ifndef IMULTI_COLUMN_COMPUTER_H
2
#define IMULTI_COLUMN_COMPUTER_H
3

4
#include "utils/TableView/core/ExecutionPlan.h"
5
#include "utils/TableView/columns/IColumn.h"
6
#include "Entity/EntityTypes.hpp"
7

8
#include <cstddef>
9
#include <string>
10
#include <vector>
11

12
/**
13
 * @brief Templated interface for computing multiple output columns in one pass.
14
 *
15
 * A multi-column computer produces N outputs of the same element type T,
16
 * typically representing closely related measures that should be computed in a
17
 * single pass for performance.
18
 */
19
template <typename T>
20
class IMultiColumnComputer {
21
public:
22
    virtual ~IMultiColumnComputer() = default;
39✔
23

24
    // Make this class non-copyable and non-movable since it's a pure interface
25
    IMultiColumnComputer(IMultiColumnComputer const &) = delete;
26
    IMultiColumnComputer & operator=(IMultiColumnComputer const &) = delete;
27
    IMultiColumnComputer(IMultiColumnComputer &&) = delete;
28
    IMultiColumnComputer & operator=(IMultiColumnComputer &&) = delete;
29

30
    /**
31
     * @brief Computes all output columns for the provided plan in one batch.
32
     * @param plan The pre-computed execution plan for indexed/interval access.
33
     * @return A vector of outputs, one entry per output column; each is a full
34
     *         column vector of values of type T with size equal to the number
35
     *         of rows dictated by the plan.
36
     */
37
    [[nodiscard]] virtual auto computeBatch(ExecutionPlan const & plan) const -> std::vector<std::vector<T>> = 0;
38

39
    /**
40
     * @brief Names for each output (suffixes to be appended to a base name).
41
     * @return Vector of suffix strings; size determines the number of outputs.
42
     */
43
    [[nodiscard]] virtual auto getOutputNames() const -> std::vector<std::string> = 0;
44

45
    /**
46
     * @brief Declares dependencies on other columns.
47
     */
UNCOV
48
    [[nodiscard]] virtual auto getDependencies() const -> std::vector<std::string> { return {}; }
×
49

50
    /**
51
     * @brief Declares the required data source name for this computation.
52
     */
53
    [[nodiscard]] virtual auto getSourceDependency() const -> std::string = 0;
54

55
    /**
56
     * @brief Checks if this computer can provide EntityID information.
57
     * @return True if EntityIDs are available, false otherwise.
58
     */
UNCOV
59
    [[nodiscard]] virtual bool hasEntityIds() const { return false; }
×
60

UNCOV
61
    [[nodiscard]] virtual EntityIdStructure getEntityIdStructure() const { 
×
UNCOV
62
        return EntityIdStructure::None; 
×
63
    }
64

65
    /**
66
     * @brief Gets EntityIDs for each row in the computed columns.
67
     * 
68
     * This method returns EntityIDs that correspond to the data sources
69
     * used to compute each row's values. Since this is a multi-column computer,
70
     * all output columns from this computer will share the same EntityIDs.
71
     * 
72
     * For computers where each row comes from a single entity, this returns
73
     * one EntityID per row. For computers that aggregate data from multiple
74
     * entities, this returns the primary or representative EntityID.
75
     * 
76
     * @param plan The execution plan used for computation.
77
     * @return Vector of EntityIDs, one per row. Empty if not available.
78
     */
UNCOV
79
    [[nodiscard]] virtual ColumnEntityIds computeColumnEntityIds(ExecutionPlan const & plan) const {
×
80
        (void)plan; 
UNCOV
81
        return {}; 
×
82
    }
83

84
    /**
85
     * @brief Computes EntityIDs for a specific row.
86
     * 
87
     * This is a convenience method that works across all EntityID structures.
88
     * 
89
     * @param plan The execution plan used for computation.
90
     * @param row_index The row index to get EntityIDs for.
91
     * @return Vector of EntityIDs for the specified row. Empty if not available.
92
     */
UNCOV
93
    [[nodiscard]] virtual std::vector<EntityId> computeCellEntityIds(ExecutionPlan const & plan, size_t row_index) const {
×
UNCOV
94
        auto structure = getEntityIdStructure();
×
UNCOV
95
        if (structure == EntityIdStructure::None) {
×
UNCOV
96
            return {};
×
97
        }
98
        
UNCOV
99
        auto column_entities = computeColumnEntityIds(plan);
×
100
        
UNCOV
101
        switch (structure) {
×
UNCOV
102
            case EntityIdStructure::Simple: {
×
UNCOV
103
                auto& entities = std::get<std::vector<EntityId>>(column_entities);
×
UNCOV
104
                return (row_index < entities.size()) ? std::vector<EntityId>{entities[row_index]} : std::vector<EntityId>{};
×
105
            }
UNCOV
106
            case EntityIdStructure::Complex: {
×
UNCOV
107
                auto& entity_matrix = std::get<std::vector<std::vector<EntityId>>>(column_entities);
×
UNCOV
108
                return (row_index < entity_matrix.size()) ? entity_matrix[row_index] : std::vector<EntityId>{};
×
109
            }
UNCOV
110
            case EntityIdStructure::Shared:
×
111
                // Shared collections not typically used at computer level
UNCOV
112
                return {};
×
UNCOV
113
            case EntityIdStructure::None:
×
114
            default:
UNCOV
115
                return {};
×
116
        }
UNCOV
117
    }
×
118
    
119

120
protected:
121
    IMultiColumnComputer() = default;
39✔
122
};
123

124
#endif // IMULTI_COLUMN_COMPUTER_H
125

126

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