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

daisytuner / sdfglib / 15660144388

15 Jun 2025 06:02AM UTC coverage: 13.305% (-49.8%) from 63.144%
15660144388

Pull #76

github

web-flow
Merge 2a5be9552 into 413c53212
Pull Request #76: New Loop Dependency Analysis

379 of 485 new or added lines in 8 files covered. (78.14%)

6214 existing lines in 109 files now uncovered.

1622 of 12191 relevant lines covered (13.3%)

17.54 hits per line

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

50.0
/include/sdfg/codegen/dispatchers/node_dispatcher_registry.h
1
#pragma once
2

3
#include <mutex>
4
#include <typeindex>
5
#include <unordered_map>
6

7
#include "sdfg/codegen/dispatchers/node_dispatcher.h"
8
#include "sdfg/codegen/instrumentation/instrumentation.h"
9
#include "sdfg/codegen/language_extension.h"
10

11
namespace sdfg {
12
namespace codegen {
13

14
using NodeDispatcherFn = std::function<std::unique_ptr<NodeDispatcher>(
15
    LanguageExtension&, StructuredSDFG&, structured_control_flow::ControlFlowNode&,
16
    Instrumentation&)>;
17

18
class NodeDispatcherRegistry {
19
   private:
20
    mutable std::mutex mutex_;
21
    std::unordered_map<std::type_index, NodeDispatcherFn> factory_map_;
22

23
   public:
24
    static NodeDispatcherRegistry& instance() {
18✔
25
        static NodeDispatcherRegistry registry;
18✔
26
        return registry;
18✔
27
    }
28

29
    void register_dispatcher(std::type_index type, NodeDispatcherFn fn) {
18✔
30
        std::lock_guard<std::mutex> lock(mutex_);
18✔
31
        if (factory_map_.find(type) != factory_map_.end()) {
18✔
32
            throw std::runtime_error("Dispatcher already registered for type: " +
×
33
                                     std::string(type.name()));
×
34
        }
35
        factory_map_[type] = std::move(fn);
18✔
36
    }
18✔
37

UNCOV
38
    NodeDispatcherFn get_dispatcher(std::type_index type) const {
×
UNCOV
39
        auto it = factory_map_.find(type);
×
UNCOV
40
        if (it != factory_map_.end()) {
×
UNCOV
41
            return it->second;
×
42
        }
43
        return nullptr;
×
UNCOV
44
    }
×
45

46
    size_t size() const { return factory_map_.size(); }
47
};
48

49
std::unique_ptr<NodeDispatcher> create_dispatcher(LanguageExtension& language_extension,
50
                                                  StructuredSDFG& sdfg,
51
                                                  structured_control_flow::ControlFlowNode& node,
52
                                                  Instrumentation& instrumentation);
53

54
void register_default_dispatchers();
55

56
}  // namespace codegen
57
}  // namespace sdfg
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

© 2025 Coveralls, Inc