diff --git a/cppwg/input/class_info.py b/cppwg/input/class_info.py index 60d71f3..c4b274f 100644 --- a/cppwg/input/class_info.py +++ b/cppwg/input/class_info.py @@ -21,7 +21,7 @@ class CppClassInfo(CppTypeInfo): cpp_names : List[str] The C++ names of the class e.g. ["Foo<2,2>", "Foo<3,3>"] py_names : List[str] - The Python names of the class e.g. ["Foo2_2", "Foo3_3"] + The Python names of the class e.g. ["Foo_2_2", "Foo_3_3"] decls : pygccxml.declarations.declaration_t Declarations for this type's base class, one per template instantiation """ @@ -252,7 +252,7 @@ def update_py_names(self) -> None: special characters. The return type is a list, as a class can have multiple names if it is templated. For example, a class "Foo" with template arguments [[2, 2], [3, 3]] will have a python name list - ["Foo2_2", "Foo3_3"]. + ["Foo_2_2", "Foo_3_3"]. """ # Handles untemplated classes if self.template_arg_lists is None: @@ -308,7 +308,7 @@ def update_py_names(self) -> None: if idx < len(template_arg_list) - 1: template_string += "_" - self.py_names.append(type_name + template_string) + self.py_names.append(type_name + "_" + template_string) def update_cpp_names(self) -> None: """ @@ -318,7 +318,7 @@ def update_cpp_names(self) -> None: The return type is a list, as a class can have multiple names if it is templated. For example, a class "Foo" with template arguments [[2, 2], [3, 3]] will have a C++ name list - ["Foo<2,2 >", "Foo<3,3 >"]. + ["Foo<2, 2>", "Foo<3, 3>"]. """ # Handles untemplated classes if self.template_arg_lists is None: @@ -327,11 +327,11 @@ def update_cpp_names(self) -> None: self.cpp_names = [] for template_arg_list in self.template_arg_lists: - # Create template string from arg list e.g. [2, 2] -> "<2,2 >" - template_string = ",".join([str(arg) for arg in template_arg_list]) - template_string = "<" + template_string + " >" + # Create template string from arg list e.g. [2, 2] -> "<2, 2>" + template_string = ", ".join([str(arg) for arg in template_arg_list]) + template_string = "<" + template_string + ">" - # Join full name e.g. "Foo<2,2 >" + # Join full name e.g. "Foo<2, 2>" self.cpp_names.append(self.name + template_string) def update_names(self) -> None: diff --git a/cppwg/templates/pybind11_default.py b/cppwg/templates/pybind11_default.py index 010fe67..0a1bd59 100644 --- a/cppwg/templates/pybind11_default.py +++ b/cppwg/templates/pybind11_default.py @@ -36,20 +36,23 @@ """ % tuple([CPPWG_EXT]*3) class_virtual_override_header = """\ -class {class_py_name}%s : public {class_py_name}{{ - public: +class {class_py_name}%s : public {class_py_name} +{{ +public: using {class_py_name}::{class_base_name}; """ % CPPWG_CLASS_OVERRIDE_SUFFIX class_virtual_override_footer = "}\n" class_definition = """\ -void register_{class_py_name}_class(py::module &m){{ -py::class_<{class_py_name} {overrides_string} {ptr_support} {bases} >(m, "{class_py_name}") +void register_{class_py_name}_class(py::module &m) +{{ + py::class_<{class_py_name}{overrides_string}{ptr_support}{bases}>(m, "{class_py_name}") """ method_virtual_override = """\ - {return_type} {method_name}({arg_string}){const_adorn} override {{ + {return_type} {method_name}({arg_string}){const_adorn} override + {{ PYBIND11_OVERRIDE{overload_adorn}( {tidy_method_name}, {class_py_name}, @@ -61,14 +64,13 @@ class {class_py_name}%s : public {class_py_name}{{ smart_pointer_holder = "PYBIND11_DECLARE_HOLDER_TYPE(T, {})" free_function = """\ - m.def{def_adorn}("{function_name}", &{function_name}, {function_docs} {default_args}); + m.def{def_adorn}("{function_name}", &{function_name}, {function_docs}{default_args}); """ class_method = """\ - .def{def_adorn}( - "{method_name}", + .def{def_adorn}("{method_name}", ({return_type}({self_ptr})({arg_signature}){const_adorn}) &{class_py_name}::{method_name}, - {method_docs} {default_args} {call_policy}) + {method_docs}{default_args}{call_policy}) """ template_collection = { diff --git a/cppwg/writers/class_writer.py b/cppwg/writers/class_writer.py index db69ea1..8ca5310 100644 --- a/cppwg/writers/class_writer.py +++ b/cppwg/writers/class_writer.py @@ -67,7 +67,7 @@ def add_hpp(self, class_py_name: str) -> None: Parameters ---------- class_py_name: str - The Python name of the class e.g. Foo2_2 + The Python name of the class e.g. Foo_2_2 """ # Add the top prefix text self.hpp_string += self.class_info.module_info.package_info.prefix_text + "\n" @@ -88,7 +88,7 @@ def add_cpp_header(self, class_cpp_name: str, class_py_name: str) -> None: class_cpp_name : str The C++ name of the class e.g. Foo<2,2> class_py_name : str - The Python name of the class e.g. Foo2_2 + The Python name of the class e.g. Foo_2_2 """ # Add the top prefix text self.cpp_string += self.class_info.module_info.package_info.prefix_text + "\n" @@ -214,7 +214,7 @@ def add_virtual_overrides( # void bar(double d) const override { # PYBIND11_OVERRIDE_PURE( # bar, - # Foo2_2, + # Foo_2_2, # bar, # d); # } @@ -227,7 +227,7 @@ def add_virtual_overrides( ) self.cpp_string += method_writer.generate_virtual_override_wrapper() - self.cpp_string += "\n};\n" + self.cpp_string += "};\n\n" return methods_needing_override @@ -301,7 +301,7 @@ def write(self, work_dir: str) -> None: smart_ptr_type: str = self.class_info.hierarchy_attribute("smart_ptr_type") ptr_support = "" if self.has_shared_ptr and smart_ptr_type: - ptr_support = f", {smart_ptr_type}<{class_py_name} > " + ptr_support = f", {smart_ptr_type}<{class_py_name}>" # Add base classes to the wrapper class definition if needed # e.g. py::class_(m, "Foo") @@ -314,7 +314,7 @@ def write(self, work_dir: str) -> None: # Check if the base class is also wrapped in the module if base.related_class in self.module_class_decls: - bases += f", {base.related_class.name} " + bases += f", {base.related_class.name}" # Add the class registration class_definition_dict = { @@ -378,7 +378,7 @@ def write_files(self, work_dir: str, class_py_name: str) -> None: work_dir : str The directory to write the files to class_py_name : str - The Python name of the class e.g. Foo2_2 + The Python name of the class e.g. Foo_2_2 """ hpp_filepath = os.path.join(work_dir, f"{class_py_name}.{CPPWG_EXT}.hpp") cpp_filepath = os.path.join(work_dir, f"{class_py_name}.{CPPWG_EXT}.cpp") diff --git a/cppwg/writers/constructor_writer.py b/cppwg/writers/constructor_writer.py index 5994420..b2aff6c 100644 --- a/cppwg/writers/constructor_writer.py +++ b/cppwg/writers/constructor_writer.py @@ -25,7 +25,7 @@ class CppConstructorWrapperWriter(CppBaseWrapperWriter): wrapper_templates : Dict[str, str] String templates with placeholders for generating wrapper code class_py_name : Optional[str] - The Python name of the class e.g. 'Foo2_2' + The Python name of the class e.g. 'Foo_2_2' template_params: Optional[List[str]] The template params for the class e.g. ['DIM_A', 'DIM_B'] template_args: Optional[List[str]] @@ -165,7 +165,7 @@ def generate_wrapper(self) -> str: arg_types = [t.decl_string for t in self.ctor_decl.argument_types] wrapper_string += ", ".join(arg_types) - wrapper_string += " >()" + wrapper_string += ">()" # Keyword args with default values e.g. py::arg("i") = 1 keyword_args = "" diff --git a/cppwg/writers/header_collection_writer.py b/cppwg/writers/header_collection_writer.py index a87801b..0c4fdbf 100644 --- a/cppwg/writers/header_collection_writer.py +++ b/cppwg/writers/header_collection_writer.py @@ -14,7 +14,7 @@ class CppHeaderCollectionWriter: The header collection file includes all the headers to be parsed by CastXML. It also contains explicit template instantiations and their corresponding - typedefs (e.g. typedef Foo<2,2> Foo2_2) for all classes that are to be + typedefs (e.g. typedef Foo<2,2> Foo_2_2) for all classes that are to be automatically wrapped. Attributes @@ -126,7 +126,7 @@ def write(self) -> None: included_files.add(hpp_filename) # Add the template instantiations e.g. `template class Foo<2,2>;` - # and typdefs e.g. `typedef Foo<2,2> Foo2_2;` + # and typdefs e.g. `typedef Foo<2,2> Foo_2_2;` template_instantiations = "" template_typedefs = "" @@ -141,14 +141,14 @@ def write(self) -> None: continue # C++ class names eg. ["Foo<2,2>", "Foo<3,3>"] - cpp_names = [name.replace(" ", "") for name in class_info.cpp_names] + cpp_names = [name.strip() for name in class_info.cpp_names] - # Python class names eg. ["Foo2_2", "Foo3_3"] - py_names = [name.replace(" ", "") for name in class_info.py_names] + # Python class names eg. ["Foo_2_2", "Foo_3_3"] + py_names = [name.strip() for name in class_info.py_names] for cpp_name, py_name in zip(cpp_names, py_names): template_instantiations += f"template class {cpp_name};\n" - template_typedefs += f"typedef {cpp_name} {py_name};\n" + template_typedefs += f" typedef {cpp_name} {py_name};\n" self.hpp_collection_string += "\n// Instantiate Template Classes\n" self.hpp_collection_string += template_instantiations diff --git a/cppwg/writers/method_writer.py b/cppwg/writers/method_writer.py index 29ce8a7..4fd7c02 100644 --- a/cppwg/writers/method_writer.py +++ b/cppwg/writers/method_writer.py @@ -25,7 +25,7 @@ class CppMethodWrapperWriter(CppBaseWrapperWriter): wrapper_templates : Dict[str, str] String templates with placeholders for generating wrapper code class_py_name : Optional[str] - The Python name of the class e.g. 'Foo2_2' + The Python name of the class e.g. 'Foo_2_2' template_params: Optional[List[str]] The template params for the class e.g. ['DIM_A', 'DIM_B'] template_args: Optional[List[str]] @@ -135,13 +135,13 @@ def generate_wrapper(self) -> str: if self.method_decl.has_static: self_ptr = "*" else: - # e.g. Foo2_2::* + # e.g. Foo_2_2::* self_ptr = self.class_py_name + "::*" # Const-ness const_adorn = "" if self.method_decl.has_const: - const_adorn = " const " + const_adorn = " const" # Get the arg signature e.g. "int, bool" arg_types = [t.decl_string for t in self.method_decl.argument_types] @@ -214,7 +214,7 @@ def generate_virtual_override_wrapper(self) -> str: void bar(double d) const override { PYBIND11_OVERRIDE_PURE( bar, - Foo2_2, + Foo_2_2, bar, d); } @@ -237,7 +237,7 @@ def generate_virtual_override_wrapper(self) -> str: self.method_decl.arguments, self.method_decl.argument_types ): arg_list.append(f"{arg_type.decl_string} {arg.name}") - arg_name_list.append(f" {arg.name}") + arg_name_list.append(f"{arg.name}") arg_string = ", ".join(arg_list) # e.g. "int a, bool b, double c" arg_name_string = ",\n".join(arg_name_list) # e.g. "a,\n b,\n c" @@ -245,7 +245,7 @@ def generate_virtual_override_wrapper(self) -> str: # Const-ness const_adorn = "" if self.method_decl.has_const: - const_adorn = " const " + const_adorn = " const" # For pure virtual methods, use PYBIND11_OVERRIDE_PURE overload_adorn = "" diff --git a/cppwg/writers/module_writer.py b/cppwg/writers/module_writer.py index 3c03307..793620c 100644 --- a/cppwg/writers/module_writer.py +++ b/cppwg/writers/module_writer.py @@ -91,7 +91,7 @@ def write_module_wrapper(self) -> None: continue for py_name in class_info.py_names: - # Example: #include "Foo2_2.cppwg.hpp" + # Example: #include "Foo_2_2.cppwg.hpp" cpp_string += f'#include "{py_name}.{CPPWG_EXT}.hpp"\n' # Format module name as _packagename_modulename @@ -118,7 +118,7 @@ def write_module_wrapper(self) -> None: continue for py_name in class_info.py_names: - # Example: register_Foo2_2_class(m);" + # Example: register_Foo_2_2_class(m);" cpp_string += f" register_{py_name}_class(m);\n" # Add code from the module's custom generator diff --git a/examples/shapes/src/python/test/test_classes.py b/examples/shapes/src/python/test/test_classes.py index 4241f1f..673f1fd 100644 --- a/examples/shapes/src/python/test/test_classes.py +++ b/examples/shapes/src/python/test/test_classes.py @@ -9,21 +9,21 @@ class TestClasses(unittest.TestCase): def testGeometry(self): - p0 = pyshapes.geometry.Point2() + p0 = pyshapes.geometry.Point_2() self.assertTrue(p0.GetLocation() == [0.0, 0.0]) - p1 = pyshapes.geometry.Point2(5.0, 0.0) + p1 = pyshapes.geometry.Point_2(5.0, 0.0) self.assertTrue(p1.GetLocation() == [5.0, 0.0]) - p2 = pyshapes.geometry.Point2(5.0, 5.0) + p2 = pyshapes.geometry.Point_2(5.0, 5.0) self.assertTrue(p2.GetLocation() == [5.0, 5.0]) - p3 = pyshapes.geometry.Point2(0.0, 5.0) + p3 = pyshapes.geometry.Point_2(0.0, 5.0) self.assertTrue(p3.GetLocation() == [0.0, 5.0]) points = [p1, p2, p3] - triangle = pyshapes.primitives.Shape2() + triangle = pyshapes.primitives.Shape_2() triangle.SetVertices(points) self.assertTrue(len(triangle.rGetVertices()) == 3) @@ -38,7 +38,7 @@ def testGeometry(self): def testMesh(self): - cmesh = pyshapes.mesh.ConcreteMesh2() + cmesh = pyshapes.mesh.ConcreteMesh_2() self.assertTrue(cmesh.GetIndex() == 0) cmesh.SetIndex(1) diff --git a/examples/shapes/wrapper/geometry/Point2.cppwg.cpp b/examples/shapes/wrapper/geometry/Point2.cppwg.cpp deleted file mode 100644 index 8ac0ca9..0000000 --- a/examples/shapes/wrapper/geometry/Point2.cppwg.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// This file is automatically generated by cppwg. -// Do not modify this file directly. - -#include -#include -#include "wrapper_header_collection.hpp" - -#include "Point2.cppwg.hpp" - -namespace py = pybind11; -typedef Point<2 > Point2; -PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr); - -void register_Point2_class(py::module &m){ -py::class_ >(m, "Point2") - .def(py::init< >()) - .def(py::init(), py::arg("x"), py::arg("y"), py::arg("z") = (2 - 2)) - .def( - "GetLocation", - (::std::array(Point2::*)() const ) &Point2::GetLocation, - " " ) - .def( - "rGetLocation", - (::std::array const &(Point2::*)() const ) &Point2::rGetLocation, - " " , py::return_value_policy::reference_internal) - .def( - "GetIndex", - (unsigned int(Point2::*)() const ) &Point2::GetIndex, - " " ) - .def( - "SetIndex", - (void(Point2::*)(unsigned int)) &Point2::SetIndex, - " " , py::arg("index") ) - .def( - "SetLocation", - (void(Point2::*)(::std::array const &)) &Point2::SetLocation, - " " , py::arg("rLocation") ) - ; -} diff --git a/examples/shapes/wrapper/geometry/Point2.cppwg.hpp b/examples/shapes/wrapper/geometry/Point2.cppwg.hpp deleted file mode 100644 index 376fb8f..0000000 --- a/examples/shapes/wrapper/geometry/Point2.cppwg.hpp +++ /dev/null @@ -1,10 +0,0 @@ -// This file is automatically generated by cppwg. -// Do not modify this file directly. - -#ifndef Point2_hpp__cppwg_wrapper -#define Point2_hpp__cppwg_wrapper - -#include - -void register_Point2_class(pybind11::module &m); -#endif // Point2_hpp__cppwg_wrapper diff --git a/examples/shapes/wrapper/geometry/Point3.cppwg.cpp b/examples/shapes/wrapper/geometry/Point3.cppwg.cpp deleted file mode 100644 index bf4dd42..0000000 --- a/examples/shapes/wrapper/geometry/Point3.cppwg.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// This file is automatically generated by cppwg. -// Do not modify this file directly. - -#include -#include -#include "wrapper_header_collection.hpp" - -#include "Point3.cppwg.hpp" - -namespace py = pybind11; -typedef Point<3 > Point3; -PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr); - -void register_Point3_class(py::module &m){ -py::class_ >(m, "Point3") - .def(py::init< >()) - .def(py::init(), py::arg("x"), py::arg("y"), py::arg("z") = (3 - 3)) - .def( - "GetLocation", - (::std::array(Point3::*)() const ) &Point3::GetLocation, - " " ) - .def( - "rGetLocation", - (::std::array const &(Point3::*)() const ) &Point3::rGetLocation, - " " , py::return_value_policy::reference_internal) - .def( - "GetIndex", - (unsigned int(Point3::*)() const ) &Point3::GetIndex, - " " ) - .def( - "SetIndex", - (void(Point3::*)(unsigned int)) &Point3::SetIndex, - " " , py::arg("index") ) - .def( - "SetLocation", - (void(Point3::*)(::std::array const &)) &Point3::SetLocation, - " " , py::arg("rLocation") ) - ; -} diff --git a/examples/shapes/wrapper/geometry/Point3.cppwg.hpp b/examples/shapes/wrapper/geometry/Point3.cppwg.hpp deleted file mode 100644 index 630ecf2..0000000 --- a/examples/shapes/wrapper/geometry/Point3.cppwg.hpp +++ /dev/null @@ -1,10 +0,0 @@ -// This file is automatically generated by cppwg. -// Do not modify this file directly. - -#ifndef Point3_hpp__cppwg_wrapper -#define Point3_hpp__cppwg_wrapper - -#include - -void register_Point3_class(pybind11::module &m); -#endif // Point3_hpp__cppwg_wrapper diff --git a/examples/shapes/wrapper/geometry/Point_2.cppwg.cpp b/examples/shapes/wrapper/geometry/Point_2.cppwg.cpp new file mode 100644 index 0000000..33864ac --- /dev/null +++ b/examples/shapes/wrapper/geometry/Point_2.cppwg.cpp @@ -0,0 +1,35 @@ +// This file is automatically generated by cppwg. +// Do not modify this file directly. + +#include +#include +#include "wrapper_header_collection.hpp" + +#include "Point_2.cppwg.hpp" + +namespace py = pybind11; +typedef Point<2> Point_2; +PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr); + +void register_Point_2_class(py::module &m) +{ + py::class_>(m, "Point_2") + .def(py::init<>()) + .def(py::init(), py::arg("x"), py::arg("y"), py::arg("z") = (2 - 2)) + .def("GetLocation", + (::std::array(Point_2::*)() const) &Point_2::GetLocation, + " ") + .def("rGetLocation", + (::std::array const &(Point_2::*)() const) &Point_2::rGetLocation, + " ", py::return_value_policy::reference_internal) + .def("GetIndex", + (unsigned int(Point_2::*)() const) &Point_2::GetIndex, + " ") + .def("SetIndex", + (void(Point_2::*)(unsigned int)) &Point_2::SetIndex, + " ", py::arg("index")) + .def("SetLocation", + (void(Point_2::*)(::std::array const &)) &Point_2::SetLocation, + " ", py::arg("rLocation")) + ; +} diff --git a/examples/shapes/wrapper/geometry/Point_2.cppwg.hpp b/examples/shapes/wrapper/geometry/Point_2.cppwg.hpp new file mode 100644 index 0000000..7b5e0ca --- /dev/null +++ b/examples/shapes/wrapper/geometry/Point_2.cppwg.hpp @@ -0,0 +1,10 @@ +// This file is automatically generated by cppwg. +// Do not modify this file directly. + +#ifndef Point_2_hpp__cppwg_wrapper +#define Point_2_hpp__cppwg_wrapper + +#include + +void register_Point_2_class(pybind11::module &m); +#endif // Point_2_hpp__cppwg_wrapper diff --git a/examples/shapes/wrapper/geometry/Point_3.cppwg.cpp b/examples/shapes/wrapper/geometry/Point_3.cppwg.cpp new file mode 100644 index 0000000..1ac38c7 --- /dev/null +++ b/examples/shapes/wrapper/geometry/Point_3.cppwg.cpp @@ -0,0 +1,35 @@ +// This file is automatically generated by cppwg. +// Do not modify this file directly. + +#include +#include +#include "wrapper_header_collection.hpp" + +#include "Point_3.cppwg.hpp" + +namespace py = pybind11; +typedef Point<3> Point_3; +PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr); + +void register_Point_3_class(py::module &m) +{ + py::class_>(m, "Point_3") + .def(py::init<>()) + .def(py::init(), py::arg("x"), py::arg("y"), py::arg("z") = (3 - 3)) + .def("GetLocation", + (::std::array(Point_3::*)() const) &Point_3::GetLocation, + " ") + .def("rGetLocation", + (::std::array const &(Point_3::*)() const) &Point_3::rGetLocation, + " ", py::return_value_policy::reference_internal) + .def("GetIndex", + (unsigned int(Point_3::*)() const) &Point_3::GetIndex, + " ") + .def("SetIndex", + (void(Point_3::*)(unsigned int)) &Point_3::SetIndex, + " ", py::arg("index")) + .def("SetLocation", + (void(Point_3::*)(::std::array const &)) &Point_3::SetLocation, + " ", py::arg("rLocation")) + ; +} diff --git a/examples/shapes/wrapper/geometry/Point_3.cppwg.hpp b/examples/shapes/wrapper/geometry/Point_3.cppwg.hpp new file mode 100644 index 0000000..4acc0ec --- /dev/null +++ b/examples/shapes/wrapper/geometry/Point_3.cppwg.hpp @@ -0,0 +1,10 @@ +// This file is automatically generated by cppwg. +// Do not modify this file directly. + +#ifndef Point_3_hpp__cppwg_wrapper +#define Point_3_hpp__cppwg_wrapper + +#include + +void register_Point_3_class(pybind11::module &m); +#endif // Point_3_hpp__cppwg_wrapper diff --git a/examples/shapes/wrapper/geometry/geometry.main.cpp b/examples/shapes/wrapper/geometry/geometry.main.cpp index b924795..7cf21be 100644 --- a/examples/shapes/wrapper/geometry/geometry.main.cpp +++ b/examples/shapes/wrapper/geometry/geometry.main.cpp @@ -3,13 +3,13 @@ #include #include "wrapper_header_collection.hpp" -#include "Point2.cppwg.hpp" -#include "Point3.cppwg.hpp" +#include "Point_2.cppwg.hpp" +#include "Point_3.cppwg.hpp" namespace py = pybind11; PYBIND11_MODULE(_pyshapes_geometry, m) { - register_Point2_class(m); - register_Point3_class(m); + register_Point_2_class(m); + register_Point_3_class(m); } diff --git a/examples/shapes/wrapper/math_funcs/math_funcs.main.cpp b/examples/shapes/wrapper/math_funcs/math_funcs.main.cpp index ff93950..a5ad656 100644 --- a/examples/shapes/wrapper/math_funcs/math_funcs.main.cpp +++ b/examples/shapes/wrapper/math_funcs/math_funcs.main.cpp @@ -8,5 +8,5 @@ namespace py = pybind11; PYBIND11_MODULE(_pyshapes_math_funcs, m) { - m.def("add", &add, " " , py::arg("i") = 1., py::arg("j") = 2.); + m.def("add", &add, " ", py::arg("i") = 1., py::arg("j") = 2.); } diff --git a/examples/shapes/wrapper/mesh/AbstractMesh2_2.cppwg.cpp b/examples/shapes/wrapper/mesh/AbstractMesh2_2.cppwg.cpp deleted file mode 100644 index ac95c23..0000000 --- a/examples/shapes/wrapper/mesh/AbstractMesh2_2.cppwg.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// This file is automatically generated by cppwg. -// Do not modify this file directly. - -#include -#include -#include "wrapper_header_collection.hpp" - -#include "AbstractMesh2_2.cppwg.hpp" - -namespace py = pybind11; -typedef AbstractMesh<2,2 > AbstractMesh2_2; -PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr); - -class AbstractMesh2_2_Overrides : public AbstractMesh2_2{ - public: - using AbstractMesh2_2::AbstractMesh; - void Scale(double const factor) override { - PYBIND11_OVERRIDE_PURE( - void, - AbstractMesh2_2, - Scale, - factor); - } - -}; -void register_AbstractMesh2_2_class(py::module &m){ -py::class_ >(m, "AbstractMesh2_2") - .def(py::init< >()) - .def( - "GetIndex", - (unsigned int(AbstractMesh2_2::*)() const ) &AbstractMesh2_2::GetIndex, - " " ) - .def( - "SetIndex", - (void(AbstractMesh2_2::*)(unsigned int)) &AbstractMesh2_2::SetIndex, - " " , py::arg("index") ) - .def( - "AddVertex", - (void(AbstractMesh2_2::*)(::Point<2>)) &AbstractMesh2_2::AddVertex, - " " , py::arg("vertex") ) - .def( - "Scale", - (void(AbstractMesh2_2::*)(double const)) &AbstractMesh2_2::Scale, - " " , py::arg("factor") ) - ; -} diff --git a/examples/shapes/wrapper/mesh/AbstractMesh2_2.cppwg.hpp b/examples/shapes/wrapper/mesh/AbstractMesh2_2.cppwg.hpp deleted file mode 100644 index 67fbb32..0000000 --- a/examples/shapes/wrapper/mesh/AbstractMesh2_2.cppwg.hpp +++ /dev/null @@ -1,10 +0,0 @@ -// This file is automatically generated by cppwg. -// Do not modify this file directly. - -#ifndef AbstractMesh2_2_hpp__cppwg_wrapper -#define AbstractMesh2_2_hpp__cppwg_wrapper - -#include - -void register_AbstractMesh2_2_class(pybind11::module &m); -#endif // AbstractMesh2_2_hpp__cppwg_wrapper diff --git a/examples/shapes/wrapper/mesh/AbstractMesh3_3.cppwg.cpp b/examples/shapes/wrapper/mesh/AbstractMesh3_3.cppwg.cpp deleted file mode 100644 index 3f4c6f0..0000000 --- a/examples/shapes/wrapper/mesh/AbstractMesh3_3.cppwg.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// This file is automatically generated by cppwg. -// Do not modify this file directly. - -#include -#include -#include "wrapper_header_collection.hpp" - -#include "AbstractMesh3_3.cppwg.hpp" - -namespace py = pybind11; -typedef AbstractMesh<3,3 > AbstractMesh3_3; -PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr); - -class AbstractMesh3_3_Overrides : public AbstractMesh3_3{ - public: - using AbstractMesh3_3::AbstractMesh; - void Scale(double const factor) override { - PYBIND11_OVERRIDE_PURE( - void, - AbstractMesh3_3, - Scale, - factor); - } - -}; -void register_AbstractMesh3_3_class(py::module &m){ -py::class_ >(m, "AbstractMesh3_3") - .def(py::init< >()) - .def( - "GetIndex", - (unsigned int(AbstractMesh3_3::*)() const ) &AbstractMesh3_3::GetIndex, - " " ) - .def( - "SetIndex", - (void(AbstractMesh3_3::*)(unsigned int)) &AbstractMesh3_3::SetIndex, - " " , py::arg("index") ) - .def( - "AddVertex", - (void(AbstractMesh3_3::*)(::Point<3>)) &AbstractMesh3_3::AddVertex, - " " , py::arg("vertex") ) - .def( - "Scale", - (void(AbstractMesh3_3::*)(double const)) &AbstractMesh3_3::Scale, - " " , py::arg("factor") ) - ; -} diff --git a/examples/shapes/wrapper/mesh/AbstractMesh3_3.cppwg.hpp b/examples/shapes/wrapper/mesh/AbstractMesh3_3.cppwg.hpp deleted file mode 100644 index 8b4187e..0000000 --- a/examples/shapes/wrapper/mesh/AbstractMesh3_3.cppwg.hpp +++ /dev/null @@ -1,10 +0,0 @@ -// This file is automatically generated by cppwg. -// Do not modify this file directly. - -#ifndef AbstractMesh3_3_hpp__cppwg_wrapper -#define AbstractMesh3_3_hpp__cppwg_wrapper - -#include - -void register_AbstractMesh3_3_class(pybind11::module &m); -#endif // AbstractMesh3_3_hpp__cppwg_wrapper diff --git a/examples/shapes/wrapper/mesh/AbstractMesh_2_2.cppwg.cpp b/examples/shapes/wrapper/mesh/AbstractMesh_2_2.cppwg.cpp new file mode 100644 index 0000000..ffdd409 --- /dev/null +++ b/examples/shapes/wrapper/mesh/AbstractMesh_2_2.cppwg.cpp @@ -0,0 +1,45 @@ +// This file is automatically generated by cppwg. +// Do not modify this file directly. + +#include +#include +#include "wrapper_header_collection.hpp" + +#include "AbstractMesh_2_2.cppwg.hpp" + +namespace py = pybind11; +typedef AbstractMesh<2, 2> AbstractMesh_2_2; +PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr); + +class AbstractMesh_2_2_Overrides : public AbstractMesh_2_2 +{ +public: + using AbstractMesh_2_2::AbstractMesh; + void Scale(double const factor) override + { + PYBIND11_OVERRIDE_PURE( + void, + AbstractMesh_2_2, + Scale, + factor); + } +}; + +void register_AbstractMesh_2_2_class(py::module &m) +{ + py::class_>(m, "AbstractMesh_2_2") + .def(py::init<>()) + .def("GetIndex", + (unsigned int(AbstractMesh_2_2::*)() const) &AbstractMesh_2_2::GetIndex, + " ") + .def("SetIndex", + (void(AbstractMesh_2_2::*)(unsigned int)) &AbstractMesh_2_2::SetIndex, + " ", py::arg("index")) + .def("AddVertex", + (void(AbstractMesh_2_2::*)(::Point<2>)) &AbstractMesh_2_2::AddVertex, + " ", py::arg("vertex")) + .def("Scale", + (void(AbstractMesh_2_2::*)(double const)) &AbstractMesh_2_2::Scale, + " ", py::arg("factor")) + ; +} diff --git a/examples/shapes/wrapper/mesh/AbstractMesh_2_2.cppwg.hpp b/examples/shapes/wrapper/mesh/AbstractMesh_2_2.cppwg.hpp new file mode 100644 index 0000000..e565615 --- /dev/null +++ b/examples/shapes/wrapper/mesh/AbstractMesh_2_2.cppwg.hpp @@ -0,0 +1,10 @@ +// This file is automatically generated by cppwg. +// Do not modify this file directly. + +#ifndef AbstractMesh_2_2_hpp__cppwg_wrapper +#define AbstractMesh_2_2_hpp__cppwg_wrapper + +#include + +void register_AbstractMesh_2_2_class(pybind11::module &m); +#endif // AbstractMesh_2_2_hpp__cppwg_wrapper diff --git a/examples/shapes/wrapper/mesh/AbstractMesh_3_3.cppwg.cpp b/examples/shapes/wrapper/mesh/AbstractMesh_3_3.cppwg.cpp new file mode 100644 index 0000000..9c7df91 --- /dev/null +++ b/examples/shapes/wrapper/mesh/AbstractMesh_3_3.cppwg.cpp @@ -0,0 +1,45 @@ +// This file is automatically generated by cppwg. +// Do not modify this file directly. + +#include +#include +#include "wrapper_header_collection.hpp" + +#include "AbstractMesh_3_3.cppwg.hpp" + +namespace py = pybind11; +typedef AbstractMesh<3, 3> AbstractMesh_3_3; +PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr); + +class AbstractMesh_3_3_Overrides : public AbstractMesh_3_3 +{ +public: + using AbstractMesh_3_3::AbstractMesh; + void Scale(double const factor) override + { + PYBIND11_OVERRIDE_PURE( + void, + AbstractMesh_3_3, + Scale, + factor); + } +}; + +void register_AbstractMesh_3_3_class(py::module &m) +{ + py::class_>(m, "AbstractMesh_3_3") + .def(py::init<>()) + .def("GetIndex", + (unsigned int(AbstractMesh_3_3::*)() const) &AbstractMesh_3_3::GetIndex, + " ") + .def("SetIndex", + (void(AbstractMesh_3_3::*)(unsigned int)) &AbstractMesh_3_3::SetIndex, + " ", py::arg("index")) + .def("AddVertex", + (void(AbstractMesh_3_3::*)(::Point<3>)) &AbstractMesh_3_3::AddVertex, + " ", py::arg("vertex")) + .def("Scale", + (void(AbstractMesh_3_3::*)(double const)) &AbstractMesh_3_3::Scale, + " ", py::arg("factor")) + ; +} diff --git a/examples/shapes/wrapper/mesh/AbstractMesh_3_3.cppwg.hpp b/examples/shapes/wrapper/mesh/AbstractMesh_3_3.cppwg.hpp new file mode 100644 index 0000000..f122f63 --- /dev/null +++ b/examples/shapes/wrapper/mesh/AbstractMesh_3_3.cppwg.hpp @@ -0,0 +1,10 @@ +// This file is automatically generated by cppwg. +// Do not modify this file directly. + +#ifndef AbstractMesh_3_3_hpp__cppwg_wrapper +#define AbstractMesh_3_3_hpp__cppwg_wrapper + +#include + +void register_AbstractMesh_3_3_class(pybind11::module &m); +#endif // AbstractMesh_3_3_hpp__cppwg_wrapper diff --git a/examples/shapes/wrapper/mesh/ConcreteMesh2.cppwg.cpp b/examples/shapes/wrapper/mesh/ConcreteMesh2.cppwg.cpp deleted file mode 100644 index 6529c4d..0000000 --- a/examples/shapes/wrapper/mesh/ConcreteMesh2.cppwg.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// This file is automatically generated by cppwg. -// Do not modify this file directly. - -#include -#include -#include "wrapper_header_collection.hpp" - -#include "ConcreteMesh2.cppwg.hpp" - -namespace py = pybind11; -typedef ConcreteMesh<2 > ConcreteMesh2; -PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr); - -class ConcreteMesh2_Overrides : public ConcreteMesh2{ - public: - using ConcreteMesh2::ConcreteMesh; - void Scale(double const factor) override { - PYBIND11_OVERRIDE( - void, - ConcreteMesh2, - Scale, - factor); - } - -}; -void register_ConcreteMesh2_class(py::module &m){ -py::class_ , AbstractMesh<2> >(m, "ConcreteMesh2") - .def(py::init< >()) - .def( - "Scale", - (void(ConcreteMesh2::*)(double const)) &ConcreteMesh2::Scale, - " " , py::arg("factor") ) - ; -} diff --git a/examples/shapes/wrapper/mesh/ConcreteMesh2.cppwg.hpp b/examples/shapes/wrapper/mesh/ConcreteMesh2.cppwg.hpp deleted file mode 100644 index 9d39f3b..0000000 --- a/examples/shapes/wrapper/mesh/ConcreteMesh2.cppwg.hpp +++ /dev/null @@ -1,10 +0,0 @@ -// This file is automatically generated by cppwg. -// Do not modify this file directly. - -#ifndef ConcreteMesh2_hpp__cppwg_wrapper -#define ConcreteMesh2_hpp__cppwg_wrapper - -#include - -void register_ConcreteMesh2_class(pybind11::module &m); -#endif // ConcreteMesh2_hpp__cppwg_wrapper diff --git a/examples/shapes/wrapper/mesh/ConcreteMesh3.cppwg.cpp b/examples/shapes/wrapper/mesh/ConcreteMesh3.cppwg.cpp deleted file mode 100644 index bed5dc4..0000000 --- a/examples/shapes/wrapper/mesh/ConcreteMesh3.cppwg.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// This file is automatically generated by cppwg. -// Do not modify this file directly. - -#include -#include -#include "wrapper_header_collection.hpp" - -#include "ConcreteMesh3.cppwg.hpp" - -namespace py = pybind11; -typedef ConcreteMesh<3 > ConcreteMesh3; -PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr); - -class ConcreteMesh3_Overrides : public ConcreteMesh3{ - public: - using ConcreteMesh3::ConcreteMesh; - void Scale(double const factor) override { - PYBIND11_OVERRIDE( - void, - ConcreteMesh3, - Scale, - factor); - } - -}; -void register_ConcreteMesh3_class(py::module &m){ -py::class_ , AbstractMesh<3> >(m, "ConcreteMesh3") - .def(py::init< >()) - .def( - "Scale", - (void(ConcreteMesh3::*)(double const)) &ConcreteMesh3::Scale, - " " , py::arg("factor") ) - ; -} diff --git a/examples/shapes/wrapper/mesh/ConcreteMesh3.cppwg.hpp b/examples/shapes/wrapper/mesh/ConcreteMesh3.cppwg.hpp deleted file mode 100644 index 97f89c6..0000000 --- a/examples/shapes/wrapper/mesh/ConcreteMesh3.cppwg.hpp +++ /dev/null @@ -1,10 +0,0 @@ -// This file is automatically generated by cppwg. -// Do not modify this file directly. - -#ifndef ConcreteMesh3_hpp__cppwg_wrapper -#define ConcreteMesh3_hpp__cppwg_wrapper - -#include - -void register_ConcreteMesh3_class(pybind11::module &m); -#endif // ConcreteMesh3_hpp__cppwg_wrapper diff --git a/examples/shapes/wrapper/mesh/ConcreteMesh_2.cppwg.cpp b/examples/shapes/wrapper/mesh/ConcreteMesh_2.cppwg.cpp new file mode 100644 index 0000000..10ac791 --- /dev/null +++ b/examples/shapes/wrapper/mesh/ConcreteMesh_2.cppwg.cpp @@ -0,0 +1,36 @@ +// This file is automatically generated by cppwg. +// Do not modify this file directly. + +#include +#include +#include "wrapper_header_collection.hpp" + +#include "ConcreteMesh_2.cppwg.hpp" + +namespace py = pybind11; +typedef ConcreteMesh<2> ConcreteMesh_2; +PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr); + +class ConcreteMesh_2_Overrides : public ConcreteMesh_2 +{ +public: + using ConcreteMesh_2::ConcreteMesh; + void Scale(double const factor) override + { + PYBIND11_OVERRIDE( + void, + ConcreteMesh_2, + Scale, + factor); + } +}; + +void register_ConcreteMesh_2_class(py::module &m) +{ + py::class_, AbstractMesh<2>>(m, "ConcreteMesh_2") + .def(py::init<>()) + .def("Scale", + (void(ConcreteMesh_2::*)(double const)) &ConcreteMesh_2::Scale, + " ", py::arg("factor")) + ; +} diff --git a/examples/shapes/wrapper/mesh/ConcreteMesh_2.cppwg.hpp b/examples/shapes/wrapper/mesh/ConcreteMesh_2.cppwg.hpp new file mode 100644 index 0000000..fcf783a --- /dev/null +++ b/examples/shapes/wrapper/mesh/ConcreteMesh_2.cppwg.hpp @@ -0,0 +1,10 @@ +// This file is automatically generated by cppwg. +// Do not modify this file directly. + +#ifndef ConcreteMesh_2_hpp__cppwg_wrapper +#define ConcreteMesh_2_hpp__cppwg_wrapper + +#include + +void register_ConcreteMesh_2_class(pybind11::module &m); +#endif // ConcreteMesh_2_hpp__cppwg_wrapper diff --git a/examples/shapes/wrapper/mesh/ConcreteMesh_3.cppwg.cpp b/examples/shapes/wrapper/mesh/ConcreteMesh_3.cppwg.cpp new file mode 100644 index 0000000..7ba503e --- /dev/null +++ b/examples/shapes/wrapper/mesh/ConcreteMesh_3.cppwg.cpp @@ -0,0 +1,36 @@ +// This file is automatically generated by cppwg. +// Do not modify this file directly. + +#include +#include +#include "wrapper_header_collection.hpp" + +#include "ConcreteMesh_3.cppwg.hpp" + +namespace py = pybind11; +typedef ConcreteMesh<3> ConcreteMesh_3; +PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr); + +class ConcreteMesh_3_Overrides : public ConcreteMesh_3 +{ +public: + using ConcreteMesh_3::ConcreteMesh; + void Scale(double const factor) override + { + PYBIND11_OVERRIDE( + void, + ConcreteMesh_3, + Scale, + factor); + } +}; + +void register_ConcreteMesh_3_class(py::module &m) +{ + py::class_, AbstractMesh<3>>(m, "ConcreteMesh_3") + .def(py::init<>()) + .def("Scale", + (void(ConcreteMesh_3::*)(double const)) &ConcreteMesh_3::Scale, + " ", py::arg("factor")) + ; +} diff --git a/examples/shapes/wrapper/mesh/ConcreteMesh_3.cppwg.hpp b/examples/shapes/wrapper/mesh/ConcreteMesh_3.cppwg.hpp new file mode 100644 index 0000000..900cb8d --- /dev/null +++ b/examples/shapes/wrapper/mesh/ConcreteMesh_3.cppwg.hpp @@ -0,0 +1,10 @@ +// This file is automatically generated by cppwg. +// Do not modify this file directly. + +#ifndef ConcreteMesh_3_hpp__cppwg_wrapper +#define ConcreteMesh_3_hpp__cppwg_wrapper + +#include + +void register_ConcreteMesh_3_class(pybind11::module &m); +#endif // ConcreteMesh_3_hpp__cppwg_wrapper diff --git a/examples/shapes/wrapper/mesh/mesh.main.cpp b/examples/shapes/wrapper/mesh/mesh.main.cpp index 68facdd..a02dce2 100644 --- a/examples/shapes/wrapper/mesh/mesh.main.cpp +++ b/examples/shapes/wrapper/mesh/mesh.main.cpp @@ -3,17 +3,17 @@ #include #include "wrapper_header_collection.hpp" -#include "AbstractMesh2_2.cppwg.hpp" -#include "AbstractMesh3_3.cppwg.hpp" -#include "ConcreteMesh2.cppwg.hpp" -#include "ConcreteMesh3.cppwg.hpp" +#include "AbstractMesh_2_2.cppwg.hpp" +#include "AbstractMesh_3_3.cppwg.hpp" +#include "ConcreteMesh_2.cppwg.hpp" +#include "ConcreteMesh_3.cppwg.hpp" namespace py = pybind11; PYBIND11_MODULE(_pyshapes_mesh, m) { - register_AbstractMesh2_2_class(m); - register_AbstractMesh3_3_class(m); - register_ConcreteMesh2_class(m); - register_ConcreteMesh3_class(m); + register_AbstractMesh_2_2_class(m); + register_AbstractMesh_3_3_class(m); + register_ConcreteMesh_2_class(m); + register_ConcreteMesh_3_class(m); } diff --git a/examples/shapes/wrapper/primitives/Cuboid.cppwg.cpp b/examples/shapes/wrapper/primitives/Cuboid.cppwg.cpp index 1dc52a3..485dfae 100644 --- a/examples/shapes/wrapper/primitives/Cuboid.cppwg.cpp +++ b/examples/shapes/wrapper/primitives/Cuboid.cppwg.cpp @@ -11,8 +11,9 @@ namespace py = pybind11; typedef Cuboid Cuboid; PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr); -void register_Cuboid_class(py::module &m){ -py::class_ , Shape<3> >(m, "Cuboid") - .def(py::init(), py::arg("width") = 2., py::arg("height") = 1., py::arg("depth") = 1.) +void register_Cuboid_class(py::module &m) +{ + py::class_, Shape<3>>(m, "Cuboid") + .def(py::init(), py::arg("width") = 2., py::arg("height") = 1., py::arg("depth") = 1.) ; } diff --git a/examples/shapes/wrapper/primitives/Rectangle.cppwg.cpp b/examples/shapes/wrapper/primitives/Rectangle.cppwg.cpp index ba9e4fc..c5fabb2 100644 --- a/examples/shapes/wrapper/primitives/Rectangle.cppwg.cpp +++ b/examples/shapes/wrapper/primitives/Rectangle.cppwg.cpp @@ -11,9 +11,10 @@ namespace py = pybind11; typedef Rectangle Rectangle; PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr); -void register_Rectangle_class(py::module &m){ -py::class_ , Shape<2> >(m, "Rectangle") - .def(py::init(), py::arg("width") = 2., py::arg("height") = 1.) - .def(py::init<::std::vector>> const >(), py::arg("points") = ::std::vector>> {}) +void register_Rectangle_class(py::module &m) +{ + py::class_, Shape<2>>(m, "Rectangle") + .def(py::init(), py::arg("width") = 2., py::arg("height") = 1.) + .def(py::init<::std::vector>> const>(), py::arg("points") = ::std::vector>> {}) ; } diff --git a/examples/shapes/wrapper/primitives/Shape2.cppwg.cpp b/examples/shapes/wrapper/primitives/Shape2.cppwg.cpp deleted file mode 100644 index 718530a..0000000 --- a/examples/shapes/wrapper/primitives/Shape2.cppwg.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// This file is automatically generated by cppwg. -// Do not modify this file directly. - -#include -#include -#include "wrapper_header_collection.hpp" - -#include "Shape2.cppwg.hpp" - -namespace py = pybind11; -typedef Shape<2 > Shape2; -PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr); - -void register_Shape2_class(py::module &m){ -py::class_ >(m, "Shape2") - .def(py::init< >()) - .def( - "GetIndex", - (unsigned int(Shape2::*)() const ) &Shape2::GetIndex, - " " ) - .def( - "rGetVertices", - (::std::vector>> const &(Shape2::*)() const ) &Shape2::rGetVertices, - " " , py::return_value_policy::reference_internal) - .def( - "SetIndex", - (void(Shape2::*)(unsigned int)) &Shape2::SetIndex, - " " , py::arg("index") ) - .def( - "SetVertices", - (void(Shape2::*)(::std::vector>> const &)) &Shape2::SetVertices, - " " , py::arg("rVertices") ) - .def( - "AddVertex", - (void(Shape2::*)(::std::shared_ptr>)) &Shape2::AddVertex, - " " , py::arg("point") = std::make_shared>() ) - ; -} diff --git a/examples/shapes/wrapper/primitives/Shape2.cppwg.hpp b/examples/shapes/wrapper/primitives/Shape2.cppwg.hpp deleted file mode 100644 index e25483f..0000000 --- a/examples/shapes/wrapper/primitives/Shape2.cppwg.hpp +++ /dev/null @@ -1,10 +0,0 @@ -// This file is automatically generated by cppwg. -// Do not modify this file directly. - -#ifndef Shape2_hpp__cppwg_wrapper -#define Shape2_hpp__cppwg_wrapper - -#include - -void register_Shape2_class(pybind11::module &m); -#endif // Shape2_hpp__cppwg_wrapper diff --git a/examples/shapes/wrapper/primitives/Shape3.cppwg.cpp b/examples/shapes/wrapper/primitives/Shape3.cppwg.cpp deleted file mode 100644 index 3c86339..0000000 --- a/examples/shapes/wrapper/primitives/Shape3.cppwg.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// This file is automatically generated by cppwg. -// Do not modify this file directly. - -#include -#include -#include "wrapper_header_collection.hpp" - -#include "Shape3.cppwg.hpp" - -namespace py = pybind11; -typedef Shape<3 > Shape3; -PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr); - -void register_Shape3_class(py::module &m){ -py::class_ >(m, "Shape3") - .def(py::init< >()) - .def( - "GetIndex", - (unsigned int(Shape3::*)() const ) &Shape3::GetIndex, - " " ) - .def( - "rGetVertices", - (::std::vector>> const &(Shape3::*)() const ) &Shape3::rGetVertices, - " " , py::return_value_policy::reference_internal) - .def( - "SetIndex", - (void(Shape3::*)(unsigned int)) &Shape3::SetIndex, - " " , py::arg("index") ) - .def( - "SetVertices", - (void(Shape3::*)(::std::vector>> const &)) &Shape3::SetVertices, - " " , py::arg("rVertices") ) - .def( - "AddVertex", - (void(Shape3::*)(::std::shared_ptr>)) &Shape3::AddVertex, - " " , py::arg("point") = std::make_shared>() ) - ; -} diff --git a/examples/shapes/wrapper/primitives/Shape3.cppwg.hpp b/examples/shapes/wrapper/primitives/Shape3.cppwg.hpp deleted file mode 100644 index bc8ea2f..0000000 --- a/examples/shapes/wrapper/primitives/Shape3.cppwg.hpp +++ /dev/null @@ -1,10 +0,0 @@ -// This file is automatically generated by cppwg. -// Do not modify this file directly. - -#ifndef Shape3_hpp__cppwg_wrapper -#define Shape3_hpp__cppwg_wrapper - -#include - -void register_Shape3_class(pybind11::module &m); -#endif // Shape3_hpp__cppwg_wrapper diff --git a/examples/shapes/wrapper/primitives/Shape_2.cppwg.cpp b/examples/shapes/wrapper/primitives/Shape_2.cppwg.cpp new file mode 100644 index 0000000..290702c --- /dev/null +++ b/examples/shapes/wrapper/primitives/Shape_2.cppwg.cpp @@ -0,0 +1,34 @@ +// This file is automatically generated by cppwg. +// Do not modify this file directly. + +#include +#include +#include "wrapper_header_collection.hpp" + +#include "Shape_2.cppwg.hpp" + +namespace py = pybind11; +typedef Shape<2> Shape_2; +PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr); + +void register_Shape_2_class(py::module &m) +{ + py::class_>(m, "Shape_2") + .def(py::init<>()) + .def("GetIndex", + (unsigned int(Shape_2::*)() const) &Shape_2::GetIndex, + " ") + .def("rGetVertices", + (::std::vector>> const &(Shape_2::*)() const) &Shape_2::rGetVertices, + " ", py::return_value_policy::reference_internal) + .def("SetIndex", + (void(Shape_2::*)(unsigned int)) &Shape_2::SetIndex, + " ", py::arg("index")) + .def("SetVertices", + (void(Shape_2::*)(::std::vector>> const &)) &Shape_2::SetVertices, + " ", py::arg("rVertices")) + .def("AddVertex", + (void(Shape_2::*)(::std::shared_ptr>)) &Shape_2::AddVertex, + " ", py::arg("point") = std::make_shared>()) + ; +} diff --git a/examples/shapes/wrapper/primitives/Shape_2.cppwg.hpp b/examples/shapes/wrapper/primitives/Shape_2.cppwg.hpp new file mode 100644 index 0000000..0898be1 --- /dev/null +++ b/examples/shapes/wrapper/primitives/Shape_2.cppwg.hpp @@ -0,0 +1,10 @@ +// This file is automatically generated by cppwg. +// Do not modify this file directly. + +#ifndef Shape_2_hpp__cppwg_wrapper +#define Shape_2_hpp__cppwg_wrapper + +#include + +void register_Shape_2_class(pybind11::module &m); +#endif // Shape_2_hpp__cppwg_wrapper diff --git a/examples/shapes/wrapper/primitives/Shape_3.cppwg.cpp b/examples/shapes/wrapper/primitives/Shape_3.cppwg.cpp new file mode 100644 index 0000000..709daf5 --- /dev/null +++ b/examples/shapes/wrapper/primitives/Shape_3.cppwg.cpp @@ -0,0 +1,34 @@ +// This file is automatically generated by cppwg. +// Do not modify this file directly. + +#include +#include +#include "wrapper_header_collection.hpp" + +#include "Shape_3.cppwg.hpp" + +namespace py = pybind11; +typedef Shape<3> Shape_3; +PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr); + +void register_Shape_3_class(py::module &m) +{ + py::class_>(m, "Shape_3") + .def(py::init<>()) + .def("GetIndex", + (unsigned int(Shape_3::*)() const) &Shape_3::GetIndex, + " ") + .def("rGetVertices", + (::std::vector>> const &(Shape_3::*)() const) &Shape_3::rGetVertices, + " ", py::return_value_policy::reference_internal) + .def("SetIndex", + (void(Shape_3::*)(unsigned int)) &Shape_3::SetIndex, + " ", py::arg("index")) + .def("SetVertices", + (void(Shape_3::*)(::std::vector>> const &)) &Shape_3::SetVertices, + " ", py::arg("rVertices")) + .def("AddVertex", + (void(Shape_3::*)(::std::shared_ptr>)) &Shape_3::AddVertex, + " ", py::arg("point") = std::make_shared>()) + ; +} diff --git a/examples/shapes/wrapper/primitives/Shape_3.cppwg.hpp b/examples/shapes/wrapper/primitives/Shape_3.cppwg.hpp new file mode 100644 index 0000000..a307241 --- /dev/null +++ b/examples/shapes/wrapper/primitives/Shape_3.cppwg.hpp @@ -0,0 +1,10 @@ +// This file is automatically generated by cppwg. +// Do not modify this file directly. + +#ifndef Shape_3_hpp__cppwg_wrapper +#define Shape_3_hpp__cppwg_wrapper + +#include + +void register_Shape_3_class(pybind11::module &m); +#endif // Shape_3_hpp__cppwg_wrapper diff --git a/examples/shapes/wrapper/primitives/primitives.main.cpp b/examples/shapes/wrapper/primitives/primitives.main.cpp index b691509..4d9eefa 100644 --- a/examples/shapes/wrapper/primitives/primitives.main.cpp +++ b/examples/shapes/wrapper/primitives/primitives.main.cpp @@ -3,8 +3,8 @@ #include #include "wrapper_header_collection.hpp" -#include "Shape2.cppwg.hpp" -#include "Shape3.cppwg.hpp" +#include "Shape_2.cppwg.hpp" +#include "Shape_3.cppwg.hpp" #include "Rectangle.cppwg.hpp" #include "Cuboid.cppwg.hpp" @@ -12,8 +12,8 @@ namespace py = pybind11; PYBIND11_MODULE(_pyshapes_primitives, m) { - register_Shape2_class(m); - register_Shape3_class(m); + register_Shape_2_class(m); + register_Shape_3_class(m); register_Rectangle_class(m); register_Cuboid_class(m); } diff --git a/examples/shapes/wrapper/wrapper_header_collection.hpp b/examples/shapes/wrapper/wrapper_header_collection.hpp index 6bfa1af..dfad45a 100644 --- a/examples/shapes/wrapper/wrapper_header_collection.hpp +++ b/examples/shapes/wrapper/wrapper_header_collection.hpp @@ -23,20 +23,20 @@ template class Shape<2>; template class Shape<3>; template class ConcreteMesh<2>; template class ConcreteMesh<3>; -template class AbstractMesh<2,2>; -template class AbstractMesh<3,3>; +template class AbstractMesh<2, 2>; +template class AbstractMesh<3, 3>; // Typedefs for nicer naming namespace cppwg { -typedef Point<2> Point2; -typedef Point<3> Point3; -typedef Shape<2> Shape2; -typedef Shape<3> Shape3; -typedef ConcreteMesh<2> ConcreteMesh2; -typedef ConcreteMesh<3> ConcreteMesh3; -typedef AbstractMesh<2,2> AbstractMesh2_2; -typedef AbstractMesh<3,3> AbstractMesh3_3; + typedef Point<2> Point_2; + typedef Point<3> Point_3; + typedef Shape<2> Shape_2; + typedef Shape<3> Shape_3; + typedef ConcreteMesh<2> ConcreteMesh_2; + typedef ConcreteMesh<3> ConcreteMesh_3; + typedef AbstractMesh<2, 2> AbstractMesh_2_2; + typedef AbstractMesh<3, 3> AbstractMesh_3_3; } // namespace cppwg #endif // pyshapes_HEADERS_HPP_