42#include "pybind11/embed.h"
53namespace py = pybind11;
61 void (*init_func)(py::module_ &),
63 initFunc(init_func),
name(_name),
base(_base)
68EmbeddedPyBind::EmbeddedPyBind(
const char *_name,
69 void (*init_func)(py::module_ &)) :
70 EmbeddedPyBind(_name, init_func,
"")
82 auto &ready = getReady();
83 auto &pending = getPending();
86 if (!
mod || (!
base.empty() && ready.find(
base) == ready.end())) {
87 pending.insert({std::string(
base),
this});
101EmbeddedPyBind::initPending(
const std::string &finished)
103 auto &pending = getPending();
105 auto range = pending.equal_range(finished);
107 range.first, range.second);
108 pending.erase(range.first, range.second);
110 for (
auto &entry: todo)
111 entry.second->init();
114std::map<std::string, EmbeddedPyBind *> &
115EmbeddedPyBind::getReady()
117 static std::map<std::string, EmbeddedPyBind *> ready;
121std::multimap<std::string, EmbeddedPyBind *> &
122EmbeddedPyBind::getPending()
124 static std::multimap<std::string, EmbeddedPyBind *> pending;
129EmbeddedPyBind::initAll(py::module_ &_m5)
static pybind11::module_ * mod
EmbeddedPyBind(const char *_name, void(*init_func)(pybind11::module_ &), const char *_base)
const FlagsType init
This Stat is Initialized.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
void pybind_init_debug(py::module_ &m_native)
void pybind_init_event(py::module_ &m_native)
void cprintf(const char *format, const Args &...args)
void pybind_init_core(py::module_ &m_native)
void pybind_init_stats(pybind11::module_ &m_native)
#define GEM5_PYBIND_MODULE_INIT(name, func)
const std::string & name()