[C++] Interfacewrapper.cpp compilation failure (string cache)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the generated interfacewrapper.cpp example and inspect how parameter caching handles class or optionalclass arguments. Trace the types used for pBaseThisResult, ParameterCache_3, and the binding class CMyComponentFoo, then verify the generated wrapper compiles and that the cache path still behaves correctly.
Written by the indexing model from the issue text.
Description
Given a function with a class / optionalclass argument, the generated code ends up looking something like this:
interfacewrapper.cpp
std::string sName("");
IBase* pBaseThisResult(nullptr);
IFoo* pIFoo = dynamic_cast<IFoo*>(pIBaseClass);
if (!pIFoo)
throw EMyComponentInterfaceException(MYCOMPONENT_ERROR_INVALIDCAST);
bool isCacheCall = (pNameBuffer == nullptr);
if (isCacheCall) {
pBaseThisResult = pIFoo->GetProperties(sName, *pBar);
pIFoo->_setCache (new ParameterCache_3<std::string, MyComponent_uint8, CMyComponentFoo *> (sName, *pBar, pBaseThisResult));
}
else {
auto cache = dynamic_cast<ParameterCache_3<std::string, MyComponent_uint8, CMyComponentFoo *>*> (pIFoo->_getCache ());
if (cache == nullptr)
throw EMyComponentInterfaceException(MYCOMPONENT_ERROR_INVALIDCAST);
cache->retrieveData (sName, *pBar, pBaseThisResult);
pIFoo->_setCache (nullptr);
}
Since CMyComponentFoo is a binding class, this won't compile. Also, the pointer pBaseThisResult is actually of type IBase *.
I've hacked a fix to get it to work by generating IBase * instead, but as I don't know how this parameter caching is supposed to work I can't say if it's the right way to fix it.
- Dominant language
- Go
- Stars
- 54
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Autodesk/AutomaticComponentToolkit
-
Autodesk/AutomaticComponentToolkit#226 · 5 comments · 3 reactions · 3 assignees ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
Autodesk/AutomaticComponentToolkit#213 · 1 comment · 2 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Autodesk/AutomaticComponentToolkit#188 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
Autodesk/AutomaticComponentToolkit#183 · 1 comment ·
-
Autodesk/AutomaticComponentToolkit#162 · 1 reaction · 2 assignees ·
All issues in Autodesk/AutomaticComponentToolkit
Similar issues
-
textual definition
Difficulty 1/5 Under an hour Newbie friendliness 90/100
geneontology/go-ontology#32653 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
-
needs design
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Priority/High ready-for-agent Severity/Major Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100