Skip to content

Commit

Permalink
Merge pull request #44 from Chaste/fix-excluded-overrides
Browse files Browse the repository at this point in the history
Fix excluded overrides
  • Loading branch information
kwabenantim authored Jun 24, 2024
2 parents 26a4074 + 8ecfce9 commit a2ffdb6
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 9 deletions.
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: 0 additions & 5 deletions cppwg/writers/class_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,6 @@ def write(self, work_dir: str) -> None:
for member_function in class_decl.member_functions(
function=query, allow_empty=True
):
if self.class_info.excluded_methods:
# Skip excluded methods
if member_function.name in self.class_info.excluded_methods:
continue

method_writer = CppMethodWrapperWriter(
self.class_info,
idx,
Expand Down
11 changes: 8 additions & 3 deletions cppwg/writers/method_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ def exclude(self) -> bool:
bool
True if the method should be excluded, False otherwise
"""
# Exclude private methods without over-rides
# Skip methods marked for exclusion
if self.class_info.excluded_methods:
if self.method_decl.name in self.class_info.excluded_methods:
return True

# Exclude private methods
if self.method_decl.access_type == "private":
return True

Expand Down Expand Up @@ -220,8 +225,8 @@ def generate_virtual_override_wrapper(self) -> str:
str
The virtual override wrapper code.
"""
# Skip private methods
if self.method_decl.access_type == "private":
# Skip excluded methods
if self.exclude():
return ""

# Get list of arguments and types
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 a2ffdb6

Please sign in to comment.