Skip to content

Commit

Permalink
Add ArgMatchScore interface for numba extension
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronj0 committed Nov 8, 2024
1 parent 5b24b1f commit c49f469
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
29 changes: 29 additions & 0 deletions clingwrapper/src/clingwrapper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1461,6 +1461,35 @@ std::string Cppyy::GetMethodArgDefault(TCppMethod_t method, TCppIndex_t iarg)
return Cpp::GetFunctionArgDefault(method, iarg);
}

Cppyy::TCppIndex_t Cppyy::CompareMethodArgType(TCppMethod_t method, TCppIndex_t iarg, const std::string &req_type)
{
// if (method) {
// TFunction* f = m2f(method);
// TMethodArg* arg = (TMethodArg *)f->GetListOfMethodArgs()->At((int)iarg);
// void *argqtp = gInterpreter->TypeInfo_QualTypePtr(arg->GetTypeInfo());

// TypeInfo_t *reqti = gInterpreter->TypeInfo_Factory(req_type.c_str());
// void *reqqtp = gInterpreter->TypeInfo_QualTypePtr(reqti);

// if (ArgSimilarityScore(argqtp, reqqtp) < 10) {
// return ArgSimilarityScore(argqtp, reqqtp);
// }
// else { // Match using underlying types
// if(gInterpreter->IsPointerType(argqtp))
// argqtp = gInterpreter->TypeInfo_QualTypePtr(gInterpreter->GetPointerType(argqtp));

// // Handles reference types and strips qualifiers
// TypeInfo_t *arg_ul = gInterpreter->GetNonReferenceType(argqtp);
// TypeInfo_t *req_ul = gInterpreter->GetNonReferenceType(reqqtp);
// argqtp = gInterpreter->TypeInfo_QualTypePtr(gInterpreter->GetUnqualifiedType(gInterpreter->TypeInfo_QualTypePtr(arg_ul)));
// reqqtp = gInterpreter->TypeInfo_QualTypePtr(gInterpreter->GetUnqualifiedType(gInterpreter->TypeInfo_QualTypePtr(req_ul)));

// return ArgSimilarityScore(argqtp, reqqtp);
// }
// }
return 0; // Method is not valid
}

std::string Cppyy::GetMethodSignature(TCppMethod_t method, bool show_formal_args, TCppIndex_t max_args)
{
std::ostringstream sig;
Expand Down
2 changes: 2 additions & 0 deletions clingwrapper/src/cpp_cppyy.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ namespace Cppyy {
RPY_EXPORTED
TCppType_t GetMethodArgType(TCppMethod_t, TCppIndex_t iarg);
RPY_EXPORTED
TCppIndex_t CompareMethodArgType(TCppMethod_t, TCppIndex_t iarg, const std::string &req_type);
RPY_EXPORTED
std::string GetMethodArgTypeAsString(TCppMethod_t method, TCppIndex_t iarg);
RPY_EXPORTED
std::string GetMethodArgCanonTypeAsString(TCppMethod_t method, TCppIndex_t iarg);
Expand Down

0 comments on commit c49f469

Please sign in to comment.