Skip to content

Commit

Permalink
[misc] removed dataflow dict from core module
Browse files Browse the repository at this point in the history
  • Loading branch information
d-leroy committed Jan 10, 2024
1 parent ee270bf commit 073582c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 39 deletions.
26 changes: 0 additions & 26 deletions include/SciHook.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,6 @@ namespace py = pybind11;
namespace SciHook
{

struct __attribute__((visibility("default"))) DataFlowDict {
const std::map<ssize_t, std::vector<py::object>>& map;

std::vector<py::object> get(py::object key) const {
auto it = map.find(py::hash(key));
if (it == map.end()) {
throw py::key_error();
}
return it->second;
}

bool empty() const { return !map.empty(); };

py::iterator iter() const { return py::make_key_iterator(map.begin(), map.end()); };

bool contains(py::object key) const {
auto it = map.find(py::hash(key));
if (it == map.end()) {
return false;
}
return true;
};

DataFlowDict(const std::map<ssize_t, std::vector<py::object>>& map) : map(map) {}
};

struct SciHookExecutionContext
{
std::string name = "SciHookExecutionContext";
Expand Down
13 changes: 0 additions & 13 deletions src/bindings/scihook_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,4 @@ PYBIND11_MODULE(_scihook, m) {
{
SciHook::trigger(event_id, scope);
});

py::class_<SciHook::DataFlowDict>(m, "DataFlowDict")
.def("__bool__", [](const SciHook::DataFlowDict &self) -> bool { return !self.empty(); })
.def("__iter__", [](const SciHook::DataFlowDict &self) { return self.iter(); }, py::keep_alive<0, 1>())
.def("__getitem__", [](const SciHook::DataFlowDict &self, const py::object &key) -> std::vector<py::object> {
return self.get(key);
},
py::return_value_policy::reference_internal
)
.def("__contains__", [](const SciHook::DataFlowDict &self, const py::object &key) -> bool {
return self.contains(key);
});

}

0 comments on commit 073582c

Please sign in to comment.