Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » templated callback
templated callback [message #39650] Fri, 12 April 2013 22:29 Go to next message
crydev is currently offline  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 Wink

Thanks in advance!
Re: templated callback [message #39661 is a reply to message #39650] Mon, 15 April 2013 20:02 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Hi crydev,

I think an example would help us understand the coding issue that gives you some problems

[Updated on: Mon, 15 April 2013 20:04]

Report message to a moderator

Re: templated callback [message #39683 is a reply to message #39661] Wed, 17 April 2013 11:00 Go to previous messageGo to next message
crydev is currently offline  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.

template <class T>
void Worker(ParameterBase* pParams)
{
     UICallback<T>();     
}


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. Sad

Thanks in advance!
Re: templated callback [message #39693 is a reply to message #39683] Wed, 17 April 2013 23:56 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
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>
Re: templated callback [message #39698 is a reply to message #39693] Thu, 18 April 2013 08:35 Go to previous message
crydev is currently offline  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. Wink
Previous Topic: Console data not searchable
Next Topic: About RS232
Goto Forum:
  


Current Time: Fri Mar 29 16:22:25 CET 2024

Total time taken to generate the page: 0.01688 seconds