473,473 Members | 1,999 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

what's the design pattern of following codes?

The class TimerScheduler inherits from a template which uses the
parameter TimerScheduler itself.
What's the benefit of this arrangement?
Thanks.

00028 class TimerScheduler : public TCountedObject<TimerScheduler>
00029 {
00031 TimerSchedulerImpl* pimpl_;
00032 public:
00034 TimerScheduler();
00035
00037 ~TimerScheduler();
00038
00056 Timer* schedule(Functor const& functor, Queue* queue, Time
t)
00058
00062 void cancel(Timer* timer);
00063 };

May 14 '07 #1
2 1374
Alien wrote:
The class TimerScheduler inherits from a template which uses the
parameter TimerScheduler itself.
What's the benefit of this arrangement?
Find the online resources on "Curiously Recursive Template Pattern"
and read about it. Even Wikipedia has an article on it.
Thanks.

00028 class TimerScheduler : public TCountedObject<TimerScheduler>
00029 {
00031 TimerSchedulerImpl* pimpl_;
00032 public:
00034 TimerScheduler();
00035
00037 ~TimerScheduler();
00038
00056 Timer* schedule(Functor const& functor, Queue* queue, Time
t)
00058
00062 void cancel(Timer* timer);
00063 };
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
May 14 '07 #2
On Mon, 14 May 2007 13:49:42 -0400, Victor Bazarov wrote:
>Alien wrote:
>The class TimerScheduler inherits from a template which uses the
parameter TimerScheduler itself.
What's the benefit of this arrangement?

Find the online resources on "Curiously Recursive Template Pattern"
and read about it.
Curiously *recurring*, officially :-)

--
Gennaro Prota
https://sourceforge.net/projects/breeze/
(please check 'Status <date>' link in Summary page)
May 14 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Neil Zanella | last post by:
Hello, I would be very interested in knowing how the following C++ multi-instance singleton (AKA Borg) design pattern based code snippet can be neatly coded in Python. While there may be...
11
by: FluffyCat | last post by:
In Febraury - April of 2002 I put together in Java examples of all 23 of the classic "Gang Of Four" design patterns for my website. Partly I wanted to get a better understanding of those patterns....
1
by: Chua Wen Ching | last post by:
Hi there, I had a scenario here. I had many tonnes of C codes in my office. Each C codes are used in low level stuff. Like connecting to smart card readers or even the OS itself. I was being...
2
by: Magdelin | last post by:
I am trying to implement the front controller web presentation design pattern proposed by MS at the following link: http://msdn.microsoft.com/practices/type/patterns/enterpris...
6
by: pitachu | last post by:
Hi, I'm not an expect in .NET, so would anyone know an answer a design pattern for the following? There are many customers that require minor customizations to the program I will be...
2
by: Mike | last post by:
Hello NG, i am just learning various Design Patterns and now i am not sure, if this design is correct (Builder) or if i should use an other pattern. I have various classes (here ChildA and...
22
by: Krivenok Dmitry | last post by:
Hello All! I am trying to implement my own Design Patterns Library. I have read the following documentation about Observer Pattern: 1) Design Patterns by GoF Classic description of Observer....
8
by: Andy B | last post by:
I have an xml schema that I am working on. I wanted to know if it was a normal thing to do something like this: 1. Have a ZipCode simple type that has to be 5 characters long. 2. Have a...
3
by: vainstah | last post by:
Hello Guys and Galls, To start off, I have reached the solution I was looking for, but I would like comments and feedback on the solution I have reached and tips/tricks on making it more elegant....
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.