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++ Core » Callback (THISBACK) Improve
Re: Callback (THISBACK) Improve [message #31145 is a reply to message #31035] Thu, 10 February 2011 11:26 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
tojocky wrote on Wed, 02 February 2011 08:34


we need to keep old functionality and to provide new functions

i totally agree with you..thats why i dont quite understand why the hesitation. i'm using the changes in my projects for some time now. ide compiles and works as before.

* the provided cleanup does not change functionality at all (except for 1 case: class R return types as marked below), it extends stuff to some more use cases.

* if anyone could tell the reason for the class R return type templates from 2-args row and forth (and why 1 arg row is normal void), i could change that to it's previous state, making things *totally* compatible..

it's a cleanup, consider people trying to understand callback. with current sources..that's not easy.

[Updated on: Thu, 10 February 2011 11:28]

Report message to a moderator

Re: Callback (THISBACK) Improve [message #32155 is a reply to message #31145] Thu, 28 April 2011 13:53 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
sorry to poke again..
this one is still pending.

i'm actually using this code for quite a long time now, and it makes no problems. besides the return value changes its the old code reordered. in the new layout of files the finding and extending of own stuff is a lot esier..

the 'class R' return value issue isn't explained so i have to consider it kinda legacy from testing times...which should be fixed for cleaning and has been adressed in this cleanup as well.

so what's the deal no taking it upstream?
(i want to become upstream again, have several changes laying at my side)..

the changes are really few (see what has been added in red for Callback, it's small (the remainder is only the same thing for Gate).

cheers

[Updated on: Thu, 28 April 2011 15:49]

Report message to a moderator

Re: Callback (THISBACK) Improve [message #41898 is a reply to message #32155] Tue, 04 February 2014 23:55 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Hi.... reviving this one because I'm in need of some additions to Callbacks mechanics. In detail:

- some way to call functions with returned value (and get the value....).

- maybe an argument more...it would be handy sometimes. So Callback5.

Did somebody implement at least the first one ?

Ciao

Max
Re: Callback (THISBACK) Improve [message #41914 is a reply to message #41898] Wed, 05 February 2014 16:50 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 693
Registered: December 2005
Location: Budapest, Hungary
Contributor
You can send a Callback(N) object, I think. Or a pointer to your variable to set?
For the second one: have you tried using structs instead of a lot of arguments?

[Updated on: Wed, 05 February 2014 16:53]

Report message to a moderator

Re: Callback (THISBACK) Improve [message #41916 is a reply to message #41914] Wed, 05 February 2014 17:28 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Yep... I'm using a tuple, now, and an helper function with a return value reference as a parameter.
Quite unelegant....
Re: Callback (THISBACK) Improve [message #41970 is a reply to message #30083] Sun, 09 February 2014 12:09 Go to previous messageGo to next message
piotr5 is currently offline  piotr5
Messages: 107
Registered: November 2005
Experienced Member
I think Callback should be implemented with variable number of parameters in c++11 once u++ is ready for that.
Re: Callback (THISBACK) Improve [message #41971 is a reply to message #41970] Sun, 09 February 2014 12:15 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
GCC and MSC have already variadic macros, even if it's not a standard feature. I'm using it in my PolyXML stuff and they work great, but even without them the Callbacks are quite good.
The only thing I miss are handling of functions returning values (don't know if it's possible....) and some more arguments.
Re: Callback (THISBACK) Improve [message #41980 is a reply to message #30083] Sun, 09 February 2014 15:43 Go to previous message
piotr5 is currently offline  piotr5
Messages: 107
Registered: November 2005
Experienced Member
I were thinking of variadic templates in combination with variadic functions, so "more parameters" are not necessary since infinitely many are allowed. as for return value, I am not sure it can still be called callback when it's returning non-boolean value. the caller usually doesn't know who is being called. better use THISBACK for your own class and let the callback store some value inside of that class instead of returning it. but I agree some generic code doing that for global functions would be nice. new Templates4U project on bazaar?
Previous Topic: Core regression between svn 6693 -> 6697
Next Topic: Code for Substrating Months And Years function In Date Class
Goto Forum:
  


Current Time: Thu Mar 28 22:35:20 CET 2024

Total time taken to generate the page: 0.02586 seconds