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

paulmthompson / WhiskerToolbox / 17920603410

22 Sep 2025 03:39PM UTC coverage: 71.97% (-0.05%) from 72.02%
17920603410

push

github

paulmthompson
all tests pass

277 of 288 new or added lines in 8 files covered. (96.18%)

520 existing lines in 35 files now uncovered.

40275 of 55961 relevant lines covered (71.97%)

1225.8 hits per line

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

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

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

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

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

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

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

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

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

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

56

UNCOV
57
    [[nodiscard]] virtual EntityIdStructure getEntityIdStructure() const {
×
UNCOV
58
        return EntityIdStructure::None;
×
59
    }
60

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

80
    /**
81
     * @brief Computes EntityIDs for a specific row.
82
     * 
83
     * This is a convenience method that works across all EntityID structures.
84
     * 
85
     * @param plan The execution plan used for computation.
86
     * @param row_index The row index to get EntityIDs for.
87
     * @return Vector of EntityIDs for the specified row. Empty if not available.
88
     */
UNCOV
89
    [[nodiscard]] virtual std::vector<EntityId> computeCellEntityIds(ExecutionPlan const & plan, size_t row_index) const {
×
UNCOV
90
        auto structure = getEntityIdStructure();
×
UNCOV
91
        if (structure == EntityIdStructure::None) {
×
UNCOV
92
            return {};
×
93
        }
94

95
        auto column_entities = computeColumnEntityIds(plan);
×
96

UNCOV
97
        switch (structure) {
×
UNCOV
98
            case EntityIdStructure::Simple: {
×
99
                auto & entities = std::get<std::vector<EntityId>>(column_entities);
×
UNCOV
100
                return (row_index < entities.size()) ? std::vector<EntityId>{entities[row_index]} : std::vector<EntityId>{};
×
101
            }
102
            case EntityIdStructure::Complex: {
×
103
                auto & entity_matrix = std::get<std::vector<std::vector<EntityId>>>(column_entities);
×
104
                return (row_index < entity_matrix.size()) ? entity_matrix[row_index] : std::vector<EntityId>{};
×
105
            }
106
            case EntityIdStructure::Shared:
×
107
                // Shared collections not typically used at computer level
108
                return {};
×
UNCOV
109
            case EntityIdStructure::None:
×
110
            default:
UNCOV
111
                return {};
×
112
        }
113
    }
×
114

115
protected:
116
    IMultiColumnComputer() = default;
38✔
117
};
118

119
#endif// IMULTI_COLUMN_COMPUTER_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