Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fsahmad opened this issue Jan 29, 2021 · 0 comments
Open

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

fsahmad opened this issue Jan 29, 2021 · 0 comments

Comments

@fsahmad
Copy link

fsahmad commented Jan 29, 2021

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.

fsahmad added a commit to fsahmad/AutomaticComponentToolkit that referenced this issue Feb 23, 2021
anpilog pushed a commit to anpilog/AutomaticComponentToolkit that referenced this issue Oct 6, 2021
anpilog added a commit to anpilog/AutomaticComponentToolkit that referenced this issue Oct 6, 2021
anpilog pushed a commit to anpilog/AutomaticComponentToolkit that referenced this issue Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant