Autodesk / Autodesk/AutomaticComponentToolkit

[C++] Interfacewrapper.cpp compilation failure (string cache)

Aperta
#148 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
53
Fork
26
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Given a function with a class / optionalclass argument, the generated code ends up looking something like this:

interfacewrapper.cpp
```c++
std::string sName("");
IBase* pBaseThisResult(nullptr);
IFoo* pIFoo = dynamic_cast(pIBaseClass);
if (!pIFoo)
throw EMyComponentInterfaceException(MYCOMPONENT_ERROR_INVALIDCAST);
bool isCacheCall = (pNameBuffer == nullptr);
if (isCacheCall) {
pBaseThisResult = pIFoo->GetProperties(sName, *pBar);
pIFoo->_setCache (new ParameterCache_3 (sName, *pBar, pBaseThisResult));
}
else {
auto cache = dynamic_cast*> (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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp
Ambito
tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.