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 previous 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);
...
};
 
Read Message
Read Message
Previous Topic: How to use callback with 3 parameters
Next Topic: How to disable a callback?
Goto Forum:
  


Current Time: Tue Apr 23 11:10:38 CEST 2024

Total time taken to generate the page: 0.02397 seconds