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

paulmthompson / WhiskerToolbox / 18076144203

28 Sep 2025 03:15PM UTC coverage: 70.31% (+0.2%) from 70.089%
18076144203

push

github

paulmthompson
clean up horrific try catch block for csv export and replace with variant

20 of 61 new or added lines in 1 file covered. (32.79%)

92 existing lines in 4 files now uncovered.

44222 of 62896 relevant lines covered (70.31%)

1124.71 hits per line

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

70.79
/src/DataManager/utils/TableView/ComputerRegistry.cpp
1
#include "ComputerRegistry.hpp"
2

3
#include "Lines/Line_Data.hpp"
4
#include "Points/Point_Data.hpp"
5
#include "adapters/LineDataAdapter.h"
6
#include "adapters/PointComponentAdapter.h"
7
#include "computers/AnalogSliceGathererComputer.h"
8
#include "computers/AnalogTimestampOffsetsMultiComputer.h"
9
#include "computers/EventInIntervalComputer.h"
10
#include "computers/IntervalOverlapComputer.h"
11
#include "computers/IntervalPropertyComputer.h"
12
#include "computers/IntervalReductionComputer.h"
13
#include "computers/LineLengthComputer.h"
14
#include "computers/LineSamplingMultiComputer.h"
15
#include "computers/LineTimestampComputer.h"
16
#include "computers/TimestampInIntervalComputer.h"
17
#include "computers/TimestampValueComputer.h"
18
#include "interfaces/IEventSource.h"
19
#include "interfaces/ILineSource.h"
20

21
#include <iostream>
22
#include <optional>
23
#include <set>
24
#include <sstream>
25

26
IParameterDescriptor::IParameterDescriptor() = default;
2,391✔
27

28
IParameterDescriptor::~IParameterDescriptor() = default;
2,391✔
29

30
ComputerParameterInfo::ComputerParameterInfo()
×
31
    : name(),
×
32
      description(),
×
33
      type(typeid(void)),
×
34
      isRequired(false),
×
UNCOV
35
      defaultValue() {}
×
36

37
ComputerParameterInfo::ComputerParameterInfo(std::string name_, std::string description_, std::type_index type_, bool required, std::string defaultValue_)
×
38
    : name(std::move(name_)),
×
39
      description(std::move(description_)),
×
40
      type(type_),
×
41
      isRequired(required),
×
UNCOV
42
      defaultValue(std::move(defaultValue_)) {}
×
43

UNCOV
44
ComputerParameterInfo::~ComputerParameterInfo() = default;
×
45

46
ComputerRegistry::ComputerRegistry() {
356✔
47
    //std::cout << "Initializing Computer Registry..." << std::endl;
48

49
    registerBuiltInComputers();
356✔
50
    registerBuiltInAdapters();
356✔
51

52
    computeComputerMappings();
356✔
53
    computeAdapterMappings();
356✔
54

55
    /*
56
    std::cout << "Computer Registry Initialized with " 
57
              << all_computers_.size() << " computers and " 
58
              << all_adapters_.size() << " adapters." << std::endl;
59
    */
60
}
356✔
61

62
std::vector<ComputerInfo> ComputerRegistry::getAvailableComputers(
519✔
63
        RowSelectorType rowSelectorType,
64
        DataSourceVariant const & dataSource) const {
65

66
    auto sourceTypeIndex = getSourceTypeIndex(dataSource);
519✔
67
    auto key = std::make_pair(rowSelectorType, sourceTypeIndex);
519✔
68

69
    auto it = selector_source_to_computers_.find(key);
519✔
70
    if (it != selector_source_to_computers_.end()) {
519✔
71
        std::vector<ComputerInfo> result;
519✔
72
        result.reserve(it->second.size());
519✔
73

74
        for (auto const * computerInfo: it->second) {
3,300✔
75
            result.push_back(*computerInfo);
2,781✔
76
        }
77

78
        return result;
519✔
79
    }
519✔
80

UNCOV
81
    return {};// No computers available for this combination
×
82
}
83

84
std::vector<AdapterInfo> ComputerRegistry::getAvailableAdapters(std::type_index dataType) const {
×
85
    auto it = input_type_to_adapters_.find(dataType);
×
86
    if (it != input_type_to_adapters_.end()) {
×
87
        std::vector<AdapterInfo> result;
×
UNCOV
88
        result.reserve(it->second.size());
×
89

90
        for (auto const * adapterInfo: it->second) {
×
UNCOV
91
            result.push_back(*adapterInfo);
×
92
        }
93

94
        return result;
×
UNCOV
95
    }
×
96

UNCOV
97
    return {};// No adapters available for this type
×
98
}
99

100
std::unique_ptr<IComputerBase> ComputerRegistry::createComputer(
341✔
101
        std::string const & computerName,
102
        DataSourceVariant const & dataSource,
103
        std::map<std::string, std::string> const & parameters) const {
104

105
    auto it = computer_factories_.find(computerName);
341✔
106
    if (it != computer_factories_.end()) {
341✔
107
        try {
108
            return it->second(dataSource, parameters);
341✔
109
        } catch (std::exception const & e) {
1✔
110
            std::cerr << "Error creating computer '" << computerName << "': " << e.what() << std::endl;
1✔
111
            return nullptr;
1✔
112
        }
1✔
113
    }
114

115
    std::cerr << "Computer '" << computerName << "' not found in registry." << std::endl;
×
UNCOV
116
    return nullptr;
×
117
}
118

119
std::unique_ptr<IComputerBase> ComputerRegistry::createMultiComputer(
15✔
120
        std::string const & computerName,
121
        DataSourceVariant const & dataSource,
122
        std::map<std::string, std::string> const & parameters) const {
123
    auto it = multi_computer_factories_.find(computerName);
15✔
124
    if (it != multi_computer_factories_.end()) {
15✔
125
        try {
126
            return it->second(dataSource, parameters);
15✔
127
        } catch (std::exception const & e) {
×
128
            std::cerr << "Error creating multi-computer '" << computerName << "': " << e.what() << std::endl;
×
129
            return nullptr;
×
UNCOV
130
        }
×
131
    }
132
    std::cerr << "Multi-computer '" << computerName << "' not found in registry." << std::endl;
×
UNCOV
133
    return nullptr;
×
134
}
135

136
DataSourceVariant ComputerRegistry::createAdapter(
3✔
137
        std::string const & adapterName,
138
        std::shared_ptr<void> const & sourceData,
139
        std::shared_ptr<TimeFrame> const & timeFrame,
140
        std::string const & name,
141
        std::map<std::string, std::string> const & parameters) const {
142

143
    auto it = adapter_factories_.find(adapterName);
3✔
144
    if (it != adapter_factories_.end()) {
3✔
145
        try {
146
            return it->second(sourceData, timeFrame, name, parameters);
3✔
147
        } catch (std::exception const & e) {
×
148
            std::cerr << "Error creating adapter '" << adapterName << "': " << e.what() << std::endl;
×
149
            return DataSourceVariant{};
×
UNCOV
150
        }
×
151
    }
152

153
    std::cerr << "Adapter '" << adapterName << "' not found in registry." << std::endl;
×
UNCOV
154
    return DataSourceVariant{};
×
155
}
156

157
ComputerInfo const * ComputerRegistry::findComputerInfo(std::string const & computerName) const {
495✔
158
    auto it = name_to_computer_.find(computerName);
495✔
159
    return (it != name_to_computer_.end()) ? it->second : nullptr;
990✔
160
}
161

162
AdapterInfo const * ComputerRegistry::findAdapterInfo(std::string const & adapterName) const {
×
163
    auto it = name_to_adapter_.find(adapterName);
×
UNCOV
164
    return (it != name_to_adapter_.end()) ? it->second : nullptr;
×
165
}
166

167
std::vector<std::string> ComputerRegistry::getAllComputerNames() const {
×
168
    std::vector<std::string> names;
×
UNCOV
169
    names.reserve(all_computers_.size());
×
170

171
    for (auto const & info: all_computers_) {
×
UNCOV
172
        names.push_back(info.name);
×
173
    }
174

175
    return names;
×
UNCOV
176
}
×
177

178
std::vector<std::string> ComputerRegistry::getAllAdapterNames() const {
1✔
179
    std::vector<std::string> names;
1✔
180
    names.reserve(all_adapters_.size());
1✔
181

182
    for (auto const & info: all_adapters_) {
4✔
183
        names.push_back(info.name);
3✔
184
    }
185

186
    return names;
1✔
UNCOV
187
}
×
188

189
std::vector<std::type_index> ComputerRegistry::getAvailableOutputTypes() const {
×
UNCOV
190
    std::set<std::type_index> unique_types;
×
191

192
    for (auto const & info: all_computers_) {
×
UNCOV
193
        unique_types.insert(info.outputType);
×
194
    }
195

196
    return std::vector<std::type_index>(unique_types.begin(), unique_types.end());
×
UNCOV
197
}
×
198

199
std::map<std::type_index, std::string> ComputerRegistry::getOutputTypeNames() const {
×
UNCOV
200
    std::map<std::type_index, std::string> type_names;
×
201

202
    for (auto const & info: all_computers_) {
×
UNCOV
203
        type_names[info.outputType] = info.outputTypeName;
×
204
    }
205

206
    return type_names;
×
UNCOV
207
}
×
208

UNCOV
209
std::vector<ComputerInfo> ComputerRegistry::getComputersByOutputType(
×
210
        std::type_index outputType,
211
        std::optional<RowSelectorType> rowSelectorType,
212
        std::optional<std::type_index> sourceType) const {
UNCOV
213
    std::vector<ComputerInfo> result;
×
214

215
    for (auto const & info: all_computers_) {
×
216
        if (info.outputType != outputType) {
×
UNCOV
217
            continue;
×
218
        }
219

220
        if (rowSelectorType && info.requiredRowSelector != *rowSelectorType) {
×
UNCOV
221
            continue;
×
222
        }
223

224
        if (sourceType && info.requiredSourceType != *sourceType) {
×
UNCOV
225
            continue;
×
226
        }
227

UNCOV
228
        result.push_back(info);
×
229
    }
230

231
    return result;
×
UNCOV
232
}
×
233

234
bool ComputerRegistry::isVectorComputer(std::string const & computerName) const {
×
235
    auto info = findComputerInfo(computerName);
×
UNCOV
236
    return info ? info->isVectorType : false;
×
237
}
238

239
std::type_index ComputerRegistry::getElementType(std::string const & computerName) const {
×
240
    auto info = findComputerInfo(computerName);
×
UNCOV
241
    return info ? info->elementType : typeid(void);
×
242
}
243

244
void ComputerRegistry::registerComputer(ComputerInfo info, ComputerFactory factory) {
7,832✔
245
    std::string const name = info.name;// Copy the name before moving
7,832✔
246

247
    if (name_to_computer_.count(name)) {
7,832✔
248
        std::cerr << "Warning: Computer '" << name << "' already registered." << std::endl;
×
UNCOV
249
        return;
×
250
    }
251

252
    /*
253
    std::cout << "Registering computer: " << name 
254
              << " (Row selector: " << static_cast<int>(info.requiredRowSelector)
255
              << ", Source type: " << info.requiredSourceType.name() << ")" << std::endl;
256
    */
257
    all_computers_.push_back(std::move(info));
7,832✔
258
    ComputerInfo const * infoPtr = &all_computers_.back();
7,832✔
259

260
    name_to_computer_[name] = infoPtr;
7,832✔
261
    computer_factories_[name] = std::move(factory);
7,832✔
262
}
7,832✔
263

264
void ComputerRegistry::registerAdapter(AdapterInfo info, AdapterFactory factory) {
1,068✔
265
    std::string const name = info.name;// Copy the name before moving
1,068✔
266

267
    if (name_to_adapter_.count(name)) {
1,068✔
268
        std::cerr << "Warning: Adapter '" << name << "' already registered." << std::endl;
×
UNCOV
269
        return;
×
270
    }
271

272
    /*
273
    std::cout << "Registering adapter: " << name 
274
              << " (Input type: " << info.inputType.name()
275
              << ", Output type: " << info.outputType.name() << ")" << std::endl;
276
    */
277
    all_adapters_.push_back(std::move(info));
1,068✔
278
    AdapterInfo const * infoPtr = &all_adapters_.back();
1,068✔
279

280
    name_to_adapter_[name] = infoPtr;
1,068✔
281
    adapter_factories_[name] = std::move(factory);
1,068✔
282
}
1,068✔
283

284
void ComputerRegistry::registerMultiComputer(ComputerInfo info, MultiComputerFactory factory) {
712✔
285
    std::string const name = info.name;
712✔
286
    if (name_to_computer_.count(name) || multi_computer_factories_.count(name)) {
712✔
287
        std::cerr << "Warning: Computer '" << name << "' already registered." << std::endl;
×
UNCOV
288
        return;
×
289
    }
290

291
    info.isMultiOutput = true;
712✔
292

293
    /*
294
    std::cout << "Registering multi-output computer: " << name
295
              << " (Row selector: " << static_cast<int>(info.requiredRowSelector)
296
              << ", Source type: " << info.requiredSourceType.name() << ")" << std::endl;
297
    */
298
    all_computers_.push_back(std::move(info));
712✔
299
    ComputerInfo const * infoPtr = &all_computers_.back();
712✔
300

301
    name_to_computer_[name] = infoPtr;
712✔
302
    multi_computer_factories_[name] = std::move(factory);
712✔
303
}
712✔
304

305
void ComputerRegistry::computeComputerMappings() {
356✔
306
    //std::cout << "Computing computer mappings..." << std::endl;
307
    selector_source_to_computers_.clear();
356✔
308

309
    for (auto const & info: all_computers_) {
8,900✔
310
        auto key = std::make_pair(info.requiredRowSelector, info.requiredSourceType);
8,544✔
311
        selector_source_to_computers_[key].push_back(&info);
8,544✔
312
    }
313

314
    //std::cout << "Finished computing computer mappings." << std::endl;
315
}
356✔
316

317
void ComputerRegistry::computeAdapterMappings() {
356✔
318
    //std::cout << "Computing adapter mappings..." << std::endl;
319
    input_type_to_adapters_.clear();
356✔
320

321
    for (auto const & info: all_adapters_) {
1,424✔
322
        input_type_to_adapters_[info.inputType].push_back(&info);
1,068✔
323
    }
324

325
    //std::cout << "Finished computing adapter mappings." << std::endl;
326
}
356✔
327

328
std::type_index ComputerRegistry::getSourceTypeIndex(DataSourceVariant const & source) const {
519✔
329
    return std::visit([](auto const & src) -> std::type_index {
1,557✔
330
        return typeid(src);
519✔
331
    },
332
                      source);
1,038✔
333
}
334

335
void ComputerRegistry::registerBuiltInComputers() {
356✔
336
    //std::cout << "Registering built-in computers..." << std::endl;
337

338
    // IntervalReductionComputer - Mean
339
    {
340
        ComputerInfo info("Interval Mean",
356✔
341
                          "Calculate mean value over intervals",
342
                          typeid(double),
343
                          "double",
344
                          RowSelectorType::IntervalBased,
345
                          typeid(std::shared_ptr<IAnalogSource>));
2,492✔
346

347
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
348
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
349
            if (auto analogSrc = std::get_if<std::shared_ptr<IAnalogSource>>(&source)) {
6✔
350
                auto computer = std::make_unique<IntervalReductionComputer>(*analogSrc, ReductionType::Mean);
6✔
351
                return std::make_unique<ComputerWrapper<double>>(std::move(computer));
6✔
352
            }
6✔
UNCOV
353
            return nullptr;
×
354
        };
356✔
355

356
        registerComputer(std::move(info), std::move(factory));
356✔
357
    }
356✔
358

359
    // IntervalReductionComputer - Max
360
    {
361
        ComputerInfo info("Interval Max",
356✔
362
                          "Calculate maximum value over intervals",
363
                          typeid(double),
364
                          "double",
365
                          RowSelectorType::IntervalBased,
366
                          typeid(std::shared_ptr<IAnalogSource>));
2,492✔
367

368
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
369
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
370
            if (auto analogSrc = std::get_if<std::shared_ptr<IAnalogSource>>(&source)) {
2✔
371
                auto computer = std::make_unique<IntervalReductionComputer>(*analogSrc, ReductionType::Max);
2✔
372
                return std::make_unique<ComputerWrapper<double>>(std::move(computer));
2✔
373
            }
2✔
UNCOV
374
            return nullptr;
×
375
        };
356✔
376

377
        registerComputer(std::move(info), std::move(factory));
356✔
378
    }
356✔
379

380
    // IntervalReductionComputer - Min
381
    {
382
        ComputerInfo info("Interval Min",
356✔
383
                          "Calculate minimum value over intervals",
384
                          typeid(double),
385
                          "double",
386
                          RowSelectorType::IntervalBased,
387
                          typeid(std::shared_ptr<IAnalogSource>));
2,492✔
388

389
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
390
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
391
            if (auto analogSrc = std::get_if<std::shared_ptr<IAnalogSource>>(&source)) {
1✔
392
                auto computer = std::make_unique<IntervalReductionComputer>(*analogSrc, ReductionType::Min);
1✔
393
                return std::make_unique<ComputerWrapper<double>>(std::move(computer));
1✔
394
            }
1✔
UNCOV
395
            return nullptr;
×
396
        };
356✔
397

398
        registerComputer(std::move(info), std::move(factory));
356✔
399
    }
356✔
400

401
    // IntervalReductionComputer - StdDev
402
    {
403
        ComputerInfo info("Interval Standard Deviation",
356✔
404
                          "Calculate standard deviation over intervals",
405
                          typeid(double),
406
                          "double",
407
                          RowSelectorType::IntervalBased,
408
                          typeid(std::shared_ptr<IAnalogSource>));
2,492✔
409

410
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
411
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
412
            if (auto analogSrc = std::get_if<std::shared_ptr<IAnalogSource>>(&source)) {
2✔
413
                auto computer = std::make_unique<IntervalReductionComputer>(*analogSrc, ReductionType::StdDev);
2✔
414
                return std::make_unique<ComputerWrapper<double>>(std::move(computer));
2✔
415
            }
2✔
UNCOV
416
            return nullptr;
×
417
        };
356✔
418

419
        registerComputer(std::move(info), std::move(factory));
356✔
420
    }
356✔
421

422
    // IntervalReductionComputer - Sum
423
    {
424
        ComputerInfo info("Interval Sum",
356✔
425
                          "Calculate sum of values over intervals",
426
                          typeid(double),
427
                          "double",
428
                          RowSelectorType::IntervalBased,
429
                          typeid(std::shared_ptr<IAnalogSource>));
2,492✔
430

431
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
432
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
433
            if (auto analogSrc = std::get_if<std::shared_ptr<IAnalogSource>>(&source)) {
2✔
434
                auto computer = std::make_unique<IntervalReductionComputer>(*analogSrc, ReductionType::Sum);
2✔
435
                return std::make_unique<ComputerWrapper<double>>(std::move(computer));
2✔
436
            }
2✔
UNCOV
437
            return nullptr;
×
438
        };
356✔
439

440
        registerComputer(std::move(info), std::move(factory));
356✔
441
    }
356✔
442

443
    // IntervalReductionComputer - Count
444
    {
445
        ComputerInfo info("Interval Count",
356✔
446
                          "Count number of values over intervals",
447
                          typeid(double),
448
                          "double",
449
                          RowSelectorType::IntervalBased,
450
                          typeid(std::shared_ptr<IAnalogSource>));
2,492✔
451

452
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
453
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
454
            if (auto analogSrc = std::get_if<std::shared_ptr<IAnalogSource>>(&source)) {
1✔
455
                auto computer = std::make_unique<IntervalReductionComputer>(*analogSrc, ReductionType::Count);
1✔
456
                return std::make_unique<ComputerWrapper<double>>(std::move(computer));
1✔
457
            }
1✔
UNCOV
458
            return nullptr;
×
459
        };
356✔
460

461
        registerComputer(std::move(info), std::move(factory));
356✔
462
    }
356✔
463

464
    // EventInIntervalComputer - Presence
465
    {
466
        ComputerInfo info("Event Presence",
356✔
467
                          "Check if events exist in intervals",
468
                          typeid(bool),
469
                          "bool",
470
                          RowSelectorType::IntervalBased,
471
                          typeid(std::shared_ptr<IEventSource>));
2,492✔
472

473
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
474
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
475
            if (auto eventSrc = std::get_if<std::shared_ptr<IEventSource>>(&source)) {
118✔
476
                auto computer = std::make_unique<EventInIntervalComputer<bool>>(*eventSrc, EventOperation::Presence, (*eventSrc)->getName());
118✔
477
                return std::make_unique<ComputerWrapper<bool>>(std::move(computer));
118✔
478
            }
118✔
UNCOV
479
            return nullptr;
×
480
        };
356✔
481

482
        registerComputer(std::move(info), std::move(factory));
356✔
483
    }
356✔
484

485
    // EventInIntervalComputer - Count
486
    {
487
        ComputerInfo info("Event Count",
356✔
488
                          "Count events in intervals",
489
                          typeid(int),
490
                          "int",
491
                          RowSelectorType::IntervalBased,
492
                          typeid(std::shared_ptr<IEventSource>));
2,492✔
493

494
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
495
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
496
            if (auto eventSrc = std::get_if<std::shared_ptr<IEventSource>>(&source)) {
97✔
497
                auto computer = std::make_unique<EventInIntervalComputer<int>>(*eventSrc, EventOperation::Count, (*eventSrc)->getName());
97✔
498
                return std::make_unique<ComputerWrapper<int>>(std::move(computer));
97✔
499
            }
97✔
UNCOV
500
            return nullptr;
×
501
        };
356✔
502

503
        registerComputer(std::move(info), std::move(factory));
356✔
504
    }
356✔
505

506
    // IntervalPropertyComputer - Start
507
    {
508
        ComputerInfo info("Interval Start",
356✔
509
                          "Get the start time of intervals",
510
                          typeid(double),
511
                          "double",
512
                          RowSelectorType::IntervalBased,
513
                          typeid(std::shared_ptr<IIntervalSource>));
2,492✔
514

515
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
516
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
517
            if (auto intervalSrc = std::get_if<std::shared_ptr<IIntervalSource>>(&source)) {
15✔
518
                auto computer = std::make_unique<IntervalPropertyComputer<double>>(*intervalSrc, IntervalProperty::Start, (*intervalSrc)->getName());
15✔
519
                return std::make_unique<ComputerWrapper<double>>(std::move(computer));
15✔
520
            }
15✔
UNCOV
521
            return nullptr;
×
522
        };
356✔
523

524
        registerComputer(std::move(info), std::move(factory));
356✔
525
    }
356✔
526

527
    // IntervalPropertyComputer - End
528
    {
529
        ComputerInfo info("Interval End",
356✔
530
                          "Get the end time of intervals",
531
                          typeid(double),
532
                          "double",
533
                          RowSelectorType::IntervalBased,
534
                          typeid(std::shared_ptr<IIntervalSource>));
2,492✔
535

536
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
537
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
538
            if (auto intervalSrc = std::get_if<std::shared_ptr<IIntervalSource>>(&source)) {
12✔
539
                auto computer = std::make_unique<IntervalPropertyComputer<double>>(*intervalSrc, IntervalProperty::End, (*intervalSrc)->getName());
12✔
540
                return std::make_unique<ComputerWrapper<double>>(std::move(computer));
12✔
541
            }
12✔
UNCOV
542
            return nullptr;
×
543
        };
356✔
544

545
        registerComputer(std::move(info), std::move(factory));
356✔
546
    }
356✔
547

548
    // IntervalPropertyComputer - Duration
549
    {
550
        ComputerInfo info("Interval Duration",
356✔
551
                          "Get the duration of intervals",
552
                          typeid(double),
553
                          "double",
554
                          RowSelectorType::IntervalBased,
555
                          typeid(std::shared_ptr<IIntervalSource>));
2,492✔
556

557
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
558
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
559
            if (auto intervalSrc = std::get_if<std::shared_ptr<IIntervalSource>>(&source)) {
12✔
560
                auto computer = std::make_unique<IntervalPropertyComputer<double>>(*intervalSrc, IntervalProperty::Duration, (*intervalSrc)->getName());
12✔
561
                return std::make_unique<ComputerWrapper<double>>(std::move(computer));
12✔
562
            }
12✔
UNCOV
563
            return nullptr;
×
564
        };
356✔
565

566
        registerComputer(std::move(info), std::move(factory));
356✔
567
    }
356✔
568

569
    // EventInIntervalComputer - Gather with parameter
570
    {
571
        // Create parameter descriptors
572
        std::vector<std::unique_ptr<IParameterDescriptor>> paramDescriptors;
356✔
573
        paramDescriptors.push_back(std::make_unique<EnumParameterDescriptor>(
1,068✔
574
                "mode", "Gathering mode for event times",
575
                std::vector<std::string>{"absolute", "centered"},
2,492✔
576
                "absolute", true));
712✔
577

578
        ComputerInfo info("Event Gather",
356✔
579
                          "Gather event times within intervals",
580
                          typeid(std::vector<float>),
581
                          "std::vector<float>",
582
                          typeid(float),
583
                          "float",
584
                          RowSelectorType::IntervalBased,
585
                          typeid(std::shared_ptr<IEventSource>),
586
                          std::move(paramDescriptors));
3,204✔
587

588
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
589
                                     std::map<std::string, std::string> const & parameters) -> std::unique_ptr<IComputerBase> {
590
            if (auto eventSrc = std::get_if<std::shared_ptr<IEventSource>>(&source)) {
9✔
591
                // Parse the mode parameter
592
                EventOperation operation = EventOperation::Gather;// default
9✔
593
                auto mode_it = parameters.find("mode");
27✔
594
                if (mode_it != parameters.end()) {
9✔
595
                    if (mode_it->second == "centered") {
5✔
596
                        operation = EventOperation::Gather_Center;
2✔
597
                    } else {
598
                        operation = EventOperation::Gather;
3✔
599
                    }
600
                }
601

602
                auto computer = std::make_unique<EventInIntervalComputer<std::vector<float>>>(
9✔
603
                        *eventSrc, operation, (*eventSrc)->getName());
9✔
604
                return std::make_unique<ComputerWrapper<std::vector<float>>>(std::move(computer));
9✔
605
            }
9✔
UNCOV
606
            return nullptr;
×
607
        };
356✔
608

609
        registerComputer(std::move(info), std::move(factory));
356✔
610
    }
356✔
611

612
    // TimestampValueComputer - Extract values at specific timestamps
613
    {
614
        ComputerInfo info("Timestamp Value",
356✔
615
                          "Extract analog signal values at specific timestamps",
616
                          typeid(double),
617
                          "double",
618
                          RowSelectorType::Timestamp,
619
                          typeid(std::shared_ptr<IAnalogSource>));
2,492✔
620

621
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
622
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
623
            if (auto analogSrc = std::get_if<std::shared_ptr<IAnalogSource>>(&source)) {
30✔
624
                auto computer = std::make_unique<TimestampValueComputer>(*analogSrc);
30✔
625
                return std::make_unique<ComputerWrapper<double>>(std::move(computer));
29✔
626
            }
29✔
UNCOV
627
            return nullptr;
×
628
        };
356✔
629

630
        registerComputer(std::move(info), std::move(factory));
356✔
631
    }
356✔
632

633
    // AnalogTimestampOffsetsMultiComputer - multi-output sampling at offsets
634
    {
635
        std::vector<std::unique_ptr<IParameterDescriptor>> paramDescriptors;
356✔
636
        // Offsets provided as comma-separated integers, e.g., "-2,-1,0,1"
637
        // Use a simple text parameter via IParameterDescriptor base replacement: reuse IntParameterDescriptor for a hint?
638
        // We'll not enforce via UI here; consumers pass string list in parameters["offsets"].
639

640
        ComputerInfo info("Analog Timestamp Offsets",
356✔
641
                          "Sample analog values at specified integer offsets from each timestamp",
642
                          typeid(double),
643
                          "double",
644
                          RowSelectorType::Timestamp,
645
                          typeid(std::shared_ptr<IAnalogSource>),
646
                          std::move(paramDescriptors));
2,492✔
647
        info.isMultiOutput = true;
356✔
648
        info.makeOutputSuffixes = [](std::map<std::string, std::string> const & parameters) {
712✔
649
            std::vector<std::string> suffixes;
×
650
            auto it = parameters.find("offsets");
×
UNCOV
651
            if (it == parameters.end() || it->second.empty()) {
×
652
                // default single output at t+0
653
                suffixes.emplace_back(".t+0");
×
UNCOV
654
                return suffixes;
×
655
            }
656
            std::string const & csv = it->second;
×
657
            size_t pos = 0;
×
658
            while (pos < csv.size()) {
×
659
                size_t next = csv.find(',', pos);
×
UNCOV
660
                std::string token = csv.substr(pos, next == std::string::npos ? std::string::npos : next - pos);
×
661
                // trim spaces
662
                size_t beg = token.find_first_not_of(" \t");
×
663
                size_t end = token.find_last_not_of(" \t");
×
664
                if (beg != std::string::npos) token = token.substr(beg, end - beg + 1);
×
UNCOV
665
                int off = 0;
×
666
                try {
667
                    off = std::stoi(token);
×
668
                } catch (...) { off = 0; }
×
669
                if (off == 0) suffixes.emplace_back(".t+0");
×
670
                else if (off > 0)
×
UNCOV
671
                    suffixes.emplace_back(".t+" + std::to_string(off));
×
672
                else
673
                    suffixes.emplace_back(".t" + std::to_string(off));
×
674
                if (next == std::string::npos) break;
×
675
                pos = next + 1;
×
676
            }
×
677
            if (suffixes.empty()) suffixes.emplace_back(".t+0");
×
UNCOV
678
            return suffixes;
×
679
        };
356✔
680

681
        MultiComputerFactory factory = [](DataSourceVariant const & source,
712✔
682
                                          std::map<std::string, std::string> const & parameters) -> std::unique_ptr<IComputerBase> {
683
            if (auto analogSrc = std::get_if<std::shared_ptr<IAnalogSource>>(&source)) {
2✔
684
                // parse offsets
685
                std::vector<int> offsets;
2✔
686
                auto it = parameters.find("offsets");
6✔
687
                if (it != parameters.end()) {
2✔
688
                    std::string const & csv = it->second;
2✔
689
                    size_t pos = 0;
2✔
690
                    while (pos < csv.size()) {
6✔
691
                        size_t next = csv.find(',', pos);
6✔
692
                        std::string token = csv.substr(pos, next == std::string::npos ? std::string::npos : next - pos);
6✔
693
                        size_t beg = token.find_first_not_of(" \t");
6✔
694
                        size_t end = token.find_last_not_of(" \t");
6✔
695
                        if (beg != std::string::npos) token = token.substr(beg, end - beg + 1);
6✔
696
                        try {
697
                            offsets.push_back(std::stoi(token));
6✔
UNCOV
698
                        } catch (...) { offsets.push_back(0); }
×
699
                        if (next == std::string::npos) break;
6✔
700
                        pos = next + 1;
4✔
701
                    }
6✔
702
                }
703
                if (offsets.empty()) offsets.push_back(0);
2✔
704
                auto comp = std::make_unique<AnalogTimestampOffsetsMultiComputer>(*analogSrc, (*analogSrc)->getName(), offsets);
2✔
705
                return std::make_unique<MultiComputerWrapper<double>>(std::move(comp));
2✔
706
            }
2✔
UNCOV
707
            return nullptr;
×
708
        };
356✔
709

710
        registerMultiComputer(std::move(info), std::move(factory));
356✔
711
    }
356✔
712

713
    // TimestampInIntervalComputer - bool for timestamps inside digital intervals
714
    {
715
        ComputerInfo info("Timestamp In Interval",
356✔
716
                          "Returns true if timestamp lies within any digital interval",
717
                          typeid(bool),
718
                          "bool",
719
                          RowSelectorType::Timestamp,
720
                          typeid(std::shared_ptr<IIntervalSource>));
2,492✔
721

722
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
723
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
724
            if (auto intervalSrc = std::get_if<std::shared_ptr<IIntervalSource>>(&source)) {
6✔
725
                auto comp = std::make_unique<TimestampInIntervalComputer>(*intervalSrc, (*intervalSrc)->getName());
6✔
726
                return std::make_unique<ComputerWrapper<bool>>(std::move(comp));
6✔
727
            }
6✔
UNCOV
728
            return nullptr;
×
729
        };
356✔
730

731
        registerComputer(std::move(info), std::move(factory));
356✔
732
    }
356✔
733

734
    // LineSamplingMultiComputer - sample x/y at equally spaced segments along line
735
    {
736
        std::vector<std::unique_ptr<IParameterDescriptor>> paramDescriptors;
356✔
737
        paramDescriptors.push_back(std::make_unique<IntParameterDescriptor>(
1,068✔
738
                "segments", "Number of equal segments to divide the line into (generates segments+1 sample points)", 2, 1, 1000, true));
712✔
739

740
        ComputerInfo info("Line Sample XY",
356✔
741
                          "Sample line x and y at equally spaced positions",
742
                          typeid(double),
743
                          "double",
744
                          typeid(double),
745
                          "double",
746
                          RowSelectorType::Timestamp,
747
                          typeid(std::shared_ptr<ILineSource>),
748
                          std::move(paramDescriptors));
3,204✔
749
        info.isMultiOutput = true;
356✔
750
        info.makeOutputSuffixes = [](std::map<std::string, std::string> const & parameters) {
712✔
751
            int segments = 2;
×
752
            auto it = parameters.find("segments");
×
753
            if (it != parameters.end()) {
×
UNCOV
754
                segments = std::max(1, std::stoi(it->second));
×
755
            }
756
            std::vector<std::string> suffixes;
×
757
            suffixes.reserve(static_cast<size_t>((segments + 1) * 2));
×
758
            for (int i = 0; i <= segments; ++i) {
×
759
                double frac = static_cast<double>(i) / static_cast<double>(segments);
×
760
                char buf[32];
×
761
                std::snprintf(buf, sizeof(buf), "@%.3f", frac);
×
762
                suffixes.emplace_back(std::string{".x"} + buf);
×
UNCOV
763
                suffixes.emplace_back(std::string{".y"} + buf);
×
764
            }
UNCOV
765
            return suffixes;
×
766
        };
356✔
767

768
        MultiComputerFactory factory = [](DataSourceVariant const & source,
712✔
769
                                          std::map<std::string, std::string> const & parameters) -> std::unique_ptr<IComputerBase> {
770
            if (auto lineSrc = std::get_if<std::shared_ptr<ILineSource>>(&source)) {
13✔
771
                int segments = 2;
13✔
772
                auto it = parameters.find("segments");
39✔
773
                if (it != parameters.end()) {
13✔
774
                    segments = std::max(1, std::stoi(it->second));
13✔
775
                }
776
                auto comp = std::make_unique<LineSamplingMultiComputer>(*lineSrc, (*lineSrc)->getName(), (*lineSrc)->getTimeFrame(), segments);
13✔
777
                return std::make_unique<MultiComputerWrapper<double>>(std::move(comp));
13✔
778
            }
13✔
UNCOV
779
            return nullptr;
×
780
        };
356✔
781

782
        registerMultiComputer(std::move(info), std::move(factory));
356✔
783
    }
356✔
784

785
    // LineTimestampComputer - Extract timestamps from line data
786
    {
787
        ComputerInfo info("Line Timestamp",
356✔
788
                          "Extract timestamps from line data",
789
                          typeid(int64_t),
790
                          "int64_t",
791
                          RowSelectorType::Timestamp,
792
                          typeid(std::shared_ptr<ILineSource>));
2,492✔
793

794
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
795
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
796
            if (auto lineSrc = std::get_if<std::shared_ptr<ILineSource>>(&source)) {
4✔
797
                auto computer = std::make_unique<LineTimestampComputer>(*lineSrc, (*lineSrc)->getName(), (*lineSrc)->getTimeFrame());
4✔
798
                return std::make_unique<ComputerWrapper<int64_t>>(std::move(computer));
4✔
799
            }
4✔
UNCOV
800
            return nullptr;
×
801
        };
356✔
802

803
        registerComputer(std::move(info), std::move(factory));
356✔
804
    }
356✔
805

806
    // LineLengthComputer - Calculate cumulative length of line data
807
    {
808
        ComputerInfo info("Line Length",
356✔
809
                          "Calculate the cumulative length of line data",
810
                          typeid(float),
811
                          "float",
812
                          RowSelectorType::Timestamp,
813
                          typeid(std::shared_ptr<ILineSource>));
2,492✔
814

815
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
816
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
817
            if (auto lineSrc = std::get_if<std::shared_ptr<ILineSource>>(&source)) {
4✔
818
                auto computer = std::make_unique<LineLengthComputer>(*lineSrc, (*lineSrc)->getName(), (*lineSrc)->getTimeFrame());
4✔
819
                return std::make_unique<ComputerWrapper<float>>(std::move(computer));
4✔
820
            }
4✔
821
            return nullptr;
×
822
        };
356✔
823

824
        registerComputer(std::move(info), std::move(factory));
356✔
825
    }
356✔
826

827
    // IntervalOverlapComputer - AssignID operation
828
    {
829
        ComputerInfo info("Interval Overlap Assign ID",
356✔
830
                          "Find the ID of the column interval that overlaps with each row interval",
831
                          typeid(int64_t),
832
                          "int64_t",
833
                          RowSelectorType::IntervalBased,
834
                          typeid(std::shared_ptr<IIntervalSource>));
2,492✔
835

836
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
837
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
838
            if (auto intervalSrc = std::get_if<std::shared_ptr<IIntervalSource>>(&source)) {
7✔
839
                auto computer = std::make_unique<IntervalOverlapComputer<int64_t>>(
7✔
840
                        *intervalSrc, IntervalOverlapOperation::AssignID, (*intervalSrc)->getName());
7✔
841
                return std::make_unique<ComputerWrapper<int64_t>>(std::move(computer));
7✔
842
            }
7✔
843
            return nullptr;
×
844
        };
356✔
845

846
        registerComputer(std::move(info), std::move(factory));
356✔
847
    }
356✔
848

849
    // IntervalOverlapComputer - CountOverlaps operation
850
    {
851
        ComputerInfo info("Interval Overlap Count",
356✔
852
                          "Count the number of column intervals that overlap with each row interval",
853
                          typeid(int64_t),
854
                          "int64_t",
855
                          RowSelectorType::IntervalBased,
856
                          typeid(std::shared_ptr<IIntervalSource>));
2,492✔
857

858
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
859
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
860
            if (auto intervalSrc = std::get_if<std::shared_ptr<IIntervalSource>>(&source)) {
5✔
861
                auto computer = std::make_unique<IntervalOverlapComputer<int64_t>>(
5✔
862
                        *intervalSrc, IntervalOverlapOperation::CountOverlaps, (*intervalSrc)->getName());
5✔
863
                return std::make_unique<ComputerWrapper<int64_t>>(std::move(computer));
5✔
864
            }
5✔
865
            return nullptr;
×
866
        };
356✔
867

868
        registerComputer(std::move(info), std::move(factory));
356✔
869
    }
356✔
870

871
    // IntervalOverlapComputer - AssignID_Start operation
872
    {
873
        ComputerInfo info("Interval Overlap Assign Start",
356✔
874
                          "Find the start index of the column interval that overlaps with each row interval",
875
                          typeid(int64_t),
876
                          "int64_t",
877
                          RowSelectorType::IntervalBased,
878
                          typeid(std::shared_ptr<IIntervalSource>));
2,492✔
879

880
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
881
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
882
            if (auto intervalSrc = std::get_if<std::shared_ptr<IIntervalSource>>(&source)) {
1✔
883
                auto computer = std::make_unique<IntervalOverlapComputer<int64_t>>(
1✔
884
                        *intervalSrc, IntervalOverlapOperation::AssignID_Start, (*intervalSrc)->getName());
1✔
885
                return std::make_unique<ComputerWrapper<int64_t>>(std::move(computer));
1✔
886
            }
1✔
887
            return nullptr;
×
888
        };
356✔
889

890
        registerComputer(std::move(info), std::move(factory));
356✔
891
    }
356✔
892

893
    // IntervalOverlapComputer - AssignID_End operation
894
    {
895
        ComputerInfo info("Interval Overlap Assign End",
356✔
896
                          "Find the end index of the column interval that overlaps with each row interval",
897
                          typeid(int64_t),
898
                          "int64_t",
899
                          RowSelectorType::IntervalBased,
900
                          typeid(std::shared_ptr<IIntervalSource>));
2,492✔
901

902
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
903
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
904
            if (auto intervalSrc = std::get_if<std::shared_ptr<IIntervalSource>>(&source)) {
1✔
905
                auto computer = std::make_unique<IntervalOverlapComputer<int64_t>>(
1✔
906
                        *intervalSrc, IntervalOverlapOperation::AssignID_End, (*intervalSrc)->getName());
1✔
907
                return std::make_unique<ComputerWrapper<int64_t>>(std::move(computer));
1✔
908
            }
1✔
UNCOV
909
            return nullptr;
×
910
        };
356✔
911

912
        registerComputer(std::move(info), std::move(factory));
356✔
913
    }
356✔
914

915
    // AnalogSliceGathererComputer - Gather analog data slices within intervals
916
    {
917
        ComputerInfo info("Analog Slice Gatherer",
356✔
918
                          "Gather analog data slices within intervals as vectors",
919
                          typeid(std::vector<double>),
920
                          "std::vector<double>",
921
                          typeid(double),
922
                          "double",
923
                          RowSelectorType::IntervalBased,
924
                          typeid(std::shared_ptr<IAnalogSource>));
3,204✔
925

926
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
927
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
928
            if (auto analogSrc = std::get_if<std::shared_ptr<IAnalogSource>>(&source)) {
4✔
929
                auto computer = std::make_unique<AnalogSliceGathererComputer<std::vector<double>>>(*analogSrc, (*analogSrc)->getName());
4✔
930
                return std::make_unique<ComputerWrapper<std::vector<double>>>(std::move(computer));
4✔
931
            }
4✔
UNCOV
932
            return nullptr;
×
933
        };
356✔
934

935
        registerComputer(std::move(info), std::move(factory));
356✔
936
    }
356✔
937

938
    // AnalogSliceGathererComputer - Float version
939
    {
940
        ComputerInfo info("Analog Slice Gatherer Float",
356✔
941
                          "Gather analog data slices within intervals as vectors of floats",
942
                          typeid(std::vector<float>),
943
                          "std::vector<float>",
944
                          typeid(float),
945
                          "float",
946
                          RowSelectorType::IntervalBased,
947
                          typeid(std::shared_ptr<IAnalogSource>));
3,204✔
948

949
        ComputerFactory factory = [](DataSourceVariant const & source,
712✔
950
                                     std::map<std::string, std::string> const &) -> std::unique_ptr<IComputerBase> {
951
            if (auto analogSrc = std::get_if<std::shared_ptr<IAnalogSource>>(&source)) {
2✔
952
                auto computer = std::make_unique<AnalogSliceGathererComputer<std::vector<float>>>(*analogSrc, (*analogSrc)->getName());
2✔
953
                return std::make_unique<ComputerWrapper<std::vector<float>>>(std::move(computer));
2✔
954
            }
2✔
UNCOV
955
            return nullptr;
×
956
        };
356✔
957

958
        registerComputer(std::move(info), std::move(factory));
356✔
959
    }
356✔
960

961
    //std::cout << "Finished registering built-in computers." << std::endl;
962
}
1,424✔
963

964
void ComputerRegistry::registerBuiltInAdapters() {
356✔
965
    //std::cout << "Registering built-in adapters..." << std::endl;
966

967
    // PointComponentAdapter - X Component
968
    {
969
        AdapterInfo info("Point X Component",
356✔
970
                         "Extract X component from PointData as analog source",
971
                         typeid(PointData),
972
                         typeid(std::shared_ptr<IAnalogSource>));
1,780✔
973

974
        AdapterFactory factory = [](std::shared_ptr<void> const & sourceData,
712✔
975
                                    std::shared_ptr<TimeFrame> const & timeFrame,
976
                                    std::string const & name,
977
                                    std::map<std::string, std::string> const &) -> DataSourceVariant {
UNCOV
978
            if (auto pointData = std::static_pointer_cast<PointData>(sourceData)) {
×
UNCOV
979
                auto adapter = std::make_shared<PointComponentAdapter>(
×
980
                        pointData,
981
                        PointComponentAdapter::Component::X,
×
982
                        timeFrame,
UNCOV
983
                        name + "_X");
×
984
                return DataSourceVariant{std::static_pointer_cast<IAnalogSource>(adapter)};
×
UNCOV
985
            }
×
986
            return DataSourceVariant{};
×
987
        };
356✔
988

989
        registerAdapter(std::move(info), std::move(factory));
356✔
990
    }
356✔
991

992
    // PointComponentAdapter - Y Component
993
    {
994
        AdapterInfo info("Point Y Component",
356✔
995
                         "Extract Y component from PointData as analog source",
996
                         typeid(PointData),
997
                         typeid(std::shared_ptr<IAnalogSource>));
1,780✔
998

999
        AdapterFactory factory = [](std::shared_ptr<void> const & sourceData,
712✔
1000
                                    std::shared_ptr<TimeFrame> const & timeFrame,
1001
                                    std::string const & name,
1002
                                    std::map<std::string, std::string> const &) -> DataSourceVariant {
UNCOV
1003
            if (auto pointData = std::static_pointer_cast<PointData>(sourceData)) {
×
UNCOV
1004
                auto adapter = std::make_shared<PointComponentAdapter>(
×
1005
                        pointData,
UNCOV
1006
                        PointComponentAdapter::Component::Y,
×
1007
                        timeFrame,
UNCOV
1008
                        name + "_Y");
×
UNCOV
1009
                return DataSourceVariant{std::static_pointer_cast<IAnalogSource>(adapter)};
×
1010
            }
×
UNCOV
1011
            return DataSourceVariant{};
×
1012
        };
356✔
1013

1014
        registerAdapter(std::move(info), std::move(factory));
356✔
1015
    }
356✔
1016

1017
    // LineDataAdapter - LineData -> ILineSource
1018
    {
1019
        AdapterInfo info("Line Data",
356✔
1020
                         "Expose LineData as ILineSource",
1021
                         typeid(LineData),
1022
                         typeid(std::shared_ptr<ILineSource>));
1,780✔
1023

1024
        AdapterFactory factory = [](std::shared_ptr<void> const & sourceData,
712✔
1025
                                    std::shared_ptr<TimeFrame> const & timeFrame,
1026
                                    std::string const & name,
1027
                                    std::map<std::string, std::string> const &) -> DataSourceVariant {
1028
            if (auto ld = std::static_pointer_cast<LineData>(sourceData)) {
3✔
1029
                auto adapter = std::make_shared<LineDataAdapter>(ld, timeFrame, name);
3✔
1030
                return DataSourceVariant{std::static_pointer_cast<ILineSource>(adapter)};
3✔
1031
            }
6✔
UNCOV
1032
            return DataSourceVariant{};
×
1033
        };
356✔
1034

1035
        registerAdapter(std::move(info), std::move(factory));
356✔
1036
    }
356✔
1037

1038
    //std::cout << "Finished registering built-in adapters." << std::endl;
1039
}
356✔
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