pymvsim_comms.cpp
Go to the documentation of this file.
1 #include <map>
2 #include <memory>
3 #include <stdexcept>
4 #include <functional>
5 #include <string>
6 
7 #include <pybind11/pybind11.h>
8 
9 typedef std::function< pybind11::module & (std::string const &) > ModuleGetter;
10 
11 void bind_std_exception(std::function< pybind11::module &(std::string const &namespace_) > &M);
12 void bind_std_stdexcept(std::function< pybind11::module &(std::string const &namespace_) > &M);
13 void bind_mvsim_Comms_common(std::function< pybind11::module &(std::string const &namespace_) > &M);
14 void bind_mvsim_Comms_Client(std::function< pybind11::module &(std::string const &namespace_) > &M);
15 
16 
17 PYBIND11_MODULE(pymvsim_comms, root_module) {
18  root_module.doc() = "pymvsim_comms module";
19 
20  std::map <std::string, pybind11::module> modules;
21  ModuleGetter M = [&](std::string const &namespace_) -> pybind11::module & {
22  auto it = modules.find(namespace_);
23  if( it == modules.end() ) throw std::runtime_error("Attempt to access pybind11::module for namespace " + namespace_ + " before it was created!!!");
24  return it->second;
25  };
26 
27  modules[""] = root_module;
28 
29  std::vector< std::pair<std::string, std::string> > sub_modules {
30  {"", "mvsim"},
31  {"", "std"},
32  };
33  for(auto &p : sub_modules ) modules[p.first.size() ? p.first+"::"+p.second : p.second] = modules[p.first].def_submodule(p.second.c_str(), ("Bindings for " + p.first + "::" + p.second + " namespace").c_str() );
34 
35  //pybind11::class_<std::shared_ptr<void>>(M(""), "_encapsulated_data_");
36 
41 
42 }
void bind_mvsim_Comms_Client(std::function< pybind11::module &(std::string const &namespace_) > &M)
GLfloat GLfloat p
void bind_std_exception(std::function< pybind11::module &(std::string const &namespace_) > &M)
Definition: exception.cpp:36
PYBIND11_MODULE(pymvsim_comms, root_module)
std::function< pybind11::module &(std::string const &) > ModuleGetter
void bind_mvsim_Comms_common(std::function< pybind11::module &(std::string const &namespace_) > &M)
void bind_std_stdexcept(std::function< pybind11::module &(std::string const &namespace_) > &M)
Definition: stdexcept.cpp:39


mvsim
Author(s):
autogenerated on Fri May 7 2021 03:05:51