Implement functions for C++ interface#239
Open
frostedoyster wants to merge 4 commits into
Open
Conversation
Luthaf
reviewed
May 28, 2026
Member
Luthaf
left a comment
There was a problem hiding this comment.
We will also need classes for PairListOptions, ModelMetadata, and Quantity that do the conversion to and from JSON
Comment on lines
+78
to
+81
| // The C plugin registry keeps this pointer; allocate stable process-lifetime storage. | ||
| auto* name_storage = new char[name.size() + 1]; | ||
| std::memcpy(name_storage, name.c_str(), name.size() + 1); | ||
| details::PluginRegistration<PluginT>::name = name_storage; |
Member
There was a problem hiding this comment.
The Rust code makes a copy of the name, there is no need to keep it alive
Comment on lines
+69
to
+70
| template<typename PluginT> | ||
| void register_plugin(PluginT& plugin) { |
Member
There was a problem hiding this comment.
I'm not sure we need this as a public API versus something hidden inside the upcoming MTA_REGISTER_PLUGIN macro, but we can keep it for now
Comment on lines
+91
to
+94
| /// Register a raw C plugin. | ||
| inline void register_plugin(mta_plugin_t plugin) { | ||
| mta_register_plugin(plugin); | ||
| } |
| inline Model load_model( | ||
| const std::string& plugin_name, | ||
| const std::string& load_from, | ||
| const std::vector<KeyValuePair>& options = {} |
Member
There was a problem hiding this comment.
Can you rebase on top of #237 and update the API accordingly?
| namespace metatomic { | ||
|
|
||
| /// RAII wrapper around a `mta_model_t`. | ||
| class Model final { |
Member
There was a problem hiding this comment.
We will also need a abstract base class to define a model in C++
66f764d to
bb08c9b
Compare
bb08c9b to
3ca7326
Compare
89c24c1 to
d87def3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements the metatomic C++ interface
Contributor (creator of pull-request) checklist
Issue referenced (for PRs that solve an issue)?Reviewer checklist
CHANGELOG updated with public API or any other important changes?📚 Download documentation for this pull-request
⚙️ Download Python wheels for this pull-request (you can install these with pip)