Closed kwabenantim closed 4 months ago
Investigation
wrapper_header_collection.hpp
typedef aliases
are in wrapper_header_collection.hpp
There seems to be an issue recognizing template defaults of the form:
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM=ELEMENT_DIM>
This appears to be a castxml source parser issue for templates like:
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM=ELEMENT_DIM>
For some classes e.g.
template<unsigned ELEMENT_DIM, unsigned SPACE_DIM=ELEMENT_DIM>
class AbstractCellBasedSimulationModifier : public Identifiable
{
castxml finds AbstractCellBasedSimulationModifier <2>
(but cannot find AbstractCellBasedSimulationModifier <2,2>
)
For other classes e.g.
template <unsigned ELEMENT_DIM, unsigned SPACE_DIM = ELEMENT_DIM>
class AbstractCellBasedSimulation : public Identifiable
{
castxml finds AbstractCellBasedSimulation<3,3>
(but cannot find AbstractCellBasedSimulation<3>
)
The reasons for this are not yet clear.
Classes which resolve to Foo<2>
all seem to use macros like EXPORT_TEMPLATE_CLASS_ALL_DIMS
or TEMPLATED_CLASS_IS_ABSTRACT_2_UNSIGNED
.
Classes with two template arguments that collapse into one e.g. <2, 2> -> <2>
:
# pde
AbstractLinearPde
AbstractLinearParabolicPde
# cell_based
AbstractCellBasedSimulationModifier
AbstractForce
AbstractTwoBodyInteractionForce
GeneralisedLinearSpringForce
DifferentialAdhesionGeneralisedLinearSpringForce
AbstractCellPopulationBoundaryCondition
PlaneBoundaryCondition
AttractingPlaneBoundaryCondition
AbstractCellPopulation
AbstractOffLatticeCellPopulation
MeshBasedCellPopulation
OffLatticeSimulation
AbstractCentreBasedDivisionRule
FixedCentreBasedDivisionRule
RandomDirectionCentreBasedDivisionRule
Possible workaround
Each ClassInfo
object currently has a list of short_names
for Python (e.g. AbstractLinearPde2_2
) and full_names
for C++ (e.g. AbstractLinearPde<2,2>
). Both short_names
and full_names
are used in wrapper code.
The full_names
are also used in pygccxml queries to find relevant declarations from parsed source code.
Since castxml doesn't recognize full names like AbstractLinearPde<2,2>
in some cases, ClassInfo
objects could also be given a list of parsed_names
e.g. AbstractLinearPde<2>
which are guaranteed to be recognized by castxml (e.g. using a try-catch block).
The parsed_names
would then be used in all pygccxml queries and full names will continue to be used in wrapper code.
Description Generating wrappers throws errors for some classes:
Unable to find declaration Clazz
orUnable to find declaration Clazz< 2, 2 >
Error Message