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++ Callbacks and Timers » A new [Ctrl] timer id strategy
A new [Ctrl] timer id strategy [message #14613] Tue, 04 March 2008 16:07 Go to next message
huanghuan is currently offline  huanghuan
Messages: 10
Registered: December 2007
Promising Member
Ctrl::~Ctrl() {
	...
	KillTimeCallbacks(this, (byte *) this + sizeof(Ctrl));
	[COLOR=red]KillTimeCallbacks(this, (byte *) this + sizeof(this));[/COLOR]
}


How can red code implement its mean ? I don't know.
Why? reasons as follow:
1. lazy coder write a new ctrl inherit from some deep inherited ctrl classes. lazyer don't want read the all classes in inherit tree.
class ACtrl : public SomeDeepInheritedClassBySomeOthers
{
...
Ctrl::SetTimeCallback(..., id?  );
...
}
2. In big inherit tree. timer id is managed by increment. But sometimes we forget or mistake the last id. The follow code is safe. So Ctrl::SetTimeCallback is desperate.
class A : public Ctrl
{
	char dummy;
public:
...
Upp::SetTimeCallback(..., &dummy);
...
};
class AA : public A
{
	char dummy;
public:
...
Upp::SetTimeCallback(..., &dummy);
...
};
Re: A new [Ctrl] timer id strategy [message #14618 is a reply to message #14613] Tue, 04 March 2008 17:20 Go to previous message
mirek is currently offline  mirek
Messages: 12616
Registered: November 2005
Ultimate Member
Yep. This is what TimeCallback class does.

Using "direct id" is "low-level practice"...

Mirek
Previous Topic: How to use callback with 3 parameters
Next Topic: How to disable a callback?
Goto Forum:
  


Current Time: Wed Aug 12 00:10:51 CEST 2020

Total time taken to generate the page: 0.00855 seconds