Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions phlex/app/load_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,18 @@ namespace phlex::experimental {

void load_source(framework_graph& g, std::string const& label, boost::json::object raw_config)
{
auto const& spec = value_to<std::string>(raw_config.at("cpp"));
auto const adjusted_config = detail::adjust_config(label, std::move(raw_config));

auto const& spec = value_to<std::string>(adjusted_config.at("cpp"));
auto& creator =
create_source.emplace_back(plugin_loader<detail::source_creator_t>(spec, "create_source"));

// FIXME: Should probably use the parameter name (e.g.) 'plugin_label' instead of
// 'module_label', but that requires adjusting other parts of the system
// (e.g. make_algorithm_name).
raw_config["module_label"] = label;
// adjusted_config["module_label"] = label; // already set by adjust_config

configuration const config{raw_config};
configuration const config{adjusted_config};
creator(g.source_proxy(config), config);
}

Expand Down
1 change: 1 addition & 0 deletions plugins/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ add_library(
src/pymodule.cpp
src/modulewrap.cpp
src/configwrap.cpp
src/dciwrap.cpp
src/lifelinewrap.cpp
src/errorwrap.cpp
)
Expand Down
1 change: 0 additions & 1 deletion plugins/python/src/configwrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ PyObject* phlex::experimental::wrap_configuration(configuration const& config)
return (PyObject*)pyconfig;
}

//= CPyCppyy low level view construction/destruction =========================
static py_config_map* pcm_new(PyTypeObject* subtype, PyObject*, PyObject*)
{
py_config_map* pcm = (py_config_map*)subtype->tp_alloc(subtype, 0);
Expand Down
101 changes: 101 additions & 0 deletions plugins/python/src/dciwrap.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#include "phlex/model/data_cell_index.hpp"
#include "wrap.hpp"

using namespace phlex::experimental;
using namespace phlex;

// Provide selected (for now) access to Phlex's data_cell_index instances.
// clang-format off
namespace phlex::experimental {
struct py_data_cell_index {
PyObject_HEAD
data_cell_index const* ph_dci;
};
}
// clang-format on

PyObject* phlex::experimental::wrap_dci(data_cell_index const& dci)
{
py_data_cell_index* pydci = PyObject_New(py_data_cell_index, &PhlexDataCellIndex_Type);
pydci->ph_dci = &dci;

return (PyObject*)pydci;
}

// simple forwarding methods
static PyObject* dci_number(py_data_cell_index* pydci)
{
return PyLong_FromLong((long)pydci->ph_dci->number());
}

static PyMethodDef dci_methods[] = {
{(char*)"number", (PyCFunction)dci_number, METH_NOARGS, (char*)"index number"},
{(char*)nullptr, nullptr, 0, nullptr}};

// clang-format off
PyTypeObject phlex::experimental::PhlexDataCellIndex_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
(char*) "pyphlex.data_cell_index", // tp_name
sizeof(py_data_cell_index), // tp_basicsize
0, // tp_itemsize
0, // tp_dealloc
0, // tp_vectorcall_offset / tp_print
0, // tp_getattr
0, // tp_setattr
0, // tp_as_async / tp_compare
0, // tp_repr
0, // tp_as_number
0, // tp_as_sequence
0, // tp_as_mapping
0, // tp_hash
0, // tp_call
0, // tp_str
0, // tp_getattro
0, // tp_setattro
0, // tp_as_buffer
Py_TPFLAGS_DEFAULT, // tp_flags
(char*)"phlex data_cell_index", // tp_doc
0, // tp_traverse
0, // tp_clear
0, // tp_richcompare
0, // tp_weaklistoffset
0, // tp_iter
0, // tp_iternext
dci_methods, // tp_methods
0, // tp_members
0, // tp_getset
0, // tp_base
0, // tp_dict
0, // tp_descr_get
0, // tp_descr_set
0, // tp_dictoffset
0, // tp_init
0, // tp_alloc
0, // tp_new
0, // tp_free
0, // tp_is_gc
0, // tp_bases
0, // tp_mro
0, // tp_cache
0, // tp_subclasses
0 // tp_weaklist
#if PY_VERSION_HEX >= 0x02030000
, 0 // tp_del
#endif
#if PY_VERSION_HEX >= 0x02060000
, 0 // tp_version_tag
#endif
#if PY_VERSION_HEX >= 0x03040000
, 0 // tp_finalize
#endif
#if PY_VERSION_HEX >= 0x03080000
, 0 // tp_vectorcall
#endif
#if PY_VERSION_HEX >= 0x030c0000
, 0 // tp_watched
#endif
#if PY_VERSION_HEX >= 0x030d0000
, 0 // tp_versions_used
#endif
};
// clang-format on
Loading
Loading