Skip to content

Commit c49f469

Browse files
committed
Add ArgMatchScore interface for numba extension
1 parent 5b24b1f commit c49f469

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

clingwrapper/src/clingwrapper.cxx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,6 +1461,35 @@ std::string Cppyy::GetMethodArgDefault(TCppMethod_t method, TCppIndex_t iarg)
14611461
return Cpp::GetFunctionArgDefault(method, iarg);
14621462
}
14631463

1464+
Cppyy::TCppIndex_t Cppyy::CompareMethodArgType(TCppMethod_t method, TCppIndex_t iarg, const std::string &req_type)
1465+
{
1466+
// if (method) {
1467+
// TFunction* f = m2f(method);
1468+
// TMethodArg* arg = (TMethodArg *)f->GetListOfMethodArgs()->At((int)iarg);
1469+
// void *argqtp = gInterpreter->TypeInfo_QualTypePtr(arg->GetTypeInfo());
1470+
1471+
// TypeInfo_t *reqti = gInterpreter->TypeInfo_Factory(req_type.c_str());
1472+
// void *reqqtp = gInterpreter->TypeInfo_QualTypePtr(reqti);
1473+
1474+
// if (ArgSimilarityScore(argqtp, reqqtp) < 10) {
1475+
// return ArgSimilarityScore(argqtp, reqqtp);
1476+
// }
1477+
// else { // Match using underlying types
1478+
// if(gInterpreter->IsPointerType(argqtp))
1479+
// argqtp = gInterpreter->TypeInfo_QualTypePtr(gInterpreter->GetPointerType(argqtp));
1480+
1481+
// // Handles reference types and strips qualifiers
1482+
// TypeInfo_t *arg_ul = gInterpreter->GetNonReferenceType(argqtp);
1483+
// TypeInfo_t *req_ul = gInterpreter->GetNonReferenceType(reqqtp);
1484+
// argqtp = gInterpreter->TypeInfo_QualTypePtr(gInterpreter->GetUnqualifiedType(gInterpreter->TypeInfo_QualTypePtr(arg_ul)));
1485+
// reqqtp = gInterpreter->TypeInfo_QualTypePtr(gInterpreter->GetUnqualifiedType(gInterpreter->TypeInfo_QualTypePtr(req_ul)));
1486+
1487+
// return ArgSimilarityScore(argqtp, reqqtp);
1488+
// }
1489+
// }
1490+
return 0; // Method is not valid
1491+
}
1492+
14641493
std::string Cppyy::GetMethodSignature(TCppMethod_t method, bool show_formal_args, TCppIndex_t max_args)
14651494
{
14661495
std::ostringstream sig;

clingwrapper/src/cpp_cppyy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ namespace Cppyy {
284284
RPY_EXPORTED
285285
TCppType_t GetMethodArgType(TCppMethod_t, TCppIndex_t iarg);
286286
RPY_EXPORTED
287+
TCppIndex_t CompareMethodArgType(TCppMethod_t, TCppIndex_t iarg, const std::string &req_type);
288+
RPY_EXPORTED
287289
std::string GetMethodArgTypeAsString(TCppMethod_t method, TCppIndex_t iarg);
288290
RPY_EXPORTED
289291
std::string GetMethodArgCanonTypeAsString(TCppMethod_t method, TCppIndex_t iarg);

0 commit comments

Comments
 (0)