Skip to content

Commit

Permalink
#5 fix template parameters with two or more args
Browse files Browse the repository at this point in the history
  • Loading branch information
kwabenantim committed Jun 24, 2024
1 parent b38e11a commit 8ecfce9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cppwg/input/info_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ def extract_templates_from_source(self, feature_info: BaseInfo) -> None:
template_params = []
for tp in template_substitution["signature"].split(","):
template_params.append(
tp.replace("<", "")
tp.strip()
.replace("<", "")
.replace(">", "")
.split(" ")[1]
.split("=")[0]
Expand Down
5 changes: 5 additions & 0 deletions examples/shapes/src/mesh/AbstractMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,10 @@ void AbstractMesh<ELEMENT_DIM, SPACE_DIM>::SetIndex(unsigned index)
mIndex = index;
}

template <unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractMesh<ELEMENT_DIM, SPACE_DIM>::AddVertex(Point<SPACE_DIM> vertex)
{
}

template class AbstractMesh<2, 2>;
template class AbstractMesh<3, 3>;
7 changes: 7 additions & 0 deletions examples/shapes/src/mesh/AbstractMesh.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef _ABSTRACT_MESH_HPP
#define _ABSTRACT_MESH_HPP

#include "Point.hpp"

/**
* A mesh in SPACE_DIM space with ELEMENT_DIM dimensional elements
*/
Expand Down Expand Up @@ -34,6 +36,11 @@ class AbstractMesh
*/
void SetIndex(unsigned index);

/**
* Add a vertex to the mesh
*/
void AddVertex(Point<SPACE_DIM> vertex);

/**
* Scale the mesh by a factor
*/
Expand Down
4 changes: 4 additions & 0 deletions examples/shapes/wrapper/mesh/AbstractMesh2_2.cppwg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ py::class_<AbstractMesh2_2 , AbstractMesh2_2_Overrides , std::shared_ptr<Abstrac
"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,
Expand Down
4 changes: 4 additions & 0 deletions examples/shapes/wrapper/mesh/AbstractMesh3_3.cppwg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ py::class_<AbstractMesh3_3 , AbstractMesh3_3_Overrides , std::shared_ptr<Abstrac
"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,
Expand Down

0 comments on commit 8ecfce9

Please sign in to comment.