Last change
on this file since 1801 was
1536,
checked in by rgrieder, 16 years ago
|
added virtual destructors for NetworkCallback
|
-
Property svn:eol-style set to
native
|
File size:
578 bytes
|
Line | |
---|
1 | #ifndef _NETWORK_CALLBACK__ |
---|
2 | #define _NETWORK_CALLBACK__ |
---|
3 | |
---|
4 | namespace network{ |
---|
5 | class NetworkCallbackBase |
---|
6 | { |
---|
7 | public: |
---|
8 | virtual void call() = 0; |
---|
9 | virtual ~NetworkCallbackBase() {} |
---|
10 | }; |
---|
11 | |
---|
12 | template <class T> |
---|
13 | class NetworkCallback: public NetworkCallbackBase |
---|
14 | { |
---|
15 | public: |
---|
16 | NetworkCallback(T* object, void (T::*function) (void)) : object_(object), function_(function) {} |
---|
17 | virtual ~NetworkCallback() {} |
---|
18 | virtual void call() |
---|
19 | { (this->object_->*function_)(); } |
---|
20 | |
---|
21 | private: |
---|
22 | T* object_; |
---|
23 | void (T::*function_) (void); |
---|
24 | }; |
---|
25 | |
---|
26 | |
---|
27 | } |
---|
28 | |
---|
29 | |
---|
30 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.