crydev Messages: 151 Registered: October 2012 Location: Netherlands
Experienced Member
Hello,
I am templating my program and I now run into a problem. From my UI I used templates to send data to my worker class, but I cannot use templates to return data from my worker class to the UI by callback.
Is there a way to use templates combined with callback? I now have a construction that defines 'T' at the UI and sends it as parameter or template through the process. It would be nice if I could get the template through the callback back to the UI
crydev Messages: 151 Registered: October 2012 Location: Netherlands
Experienced Member
Didier wrote on Mon, 15 April 2013 20:02
Hi crydev,
I think an example would help us understand the coding issue that gives you some problems
I`m sorry, I should give some code to make it more clear. I have a situation like this.
I have this parameter class to pass a templated parameter containing any data I need to my worker function.
class ParameterBase
{
// general data that applies for any templated type.
};
template <class T>
class WorkerParameters<T> : public ParameterBase
{
T data;
};
Say my UI initiates this function, which calls my callback function using the given template. In the ideal situation that is possible, making me able to send my templated data to the UI.
What I already tried is creating a new class deriving from the Callback using a template I can alter in that class. No luck though. It is not possible to attach a function properly to THISBACK in my UI.
crydev Messages: 151 Registered: October 2012 Location: Netherlands
Experienced Member
Didier wrote on Wed, 17 April 2013 23:56
Hi crydev,
I think what you are lokking for is : Value
This class is a holder for anything you wan't so it will alow you to send any data to youre app using a Callback1< ,Value>
I already tried Value, but unfortunately it gives me a lot of problems that I need to avoid. The first problem I encountered is storing float values, which is handled perfectly well using templates, and converting the values back and forth wasn't too good using Values.