source:
code/branches/objecthierarchy/src/network/NetworkCallback.h
@
2051
Last change on this file since 2051 was 1947, checked in by rgrieder, 16 years ago | |
---|---|
|
|
File size: 617 bytes |
Rev | Line | |
---|---|---|
[1529] | 1 | #ifndef _NETWORK_CALLBACK__ |
2 | #define _NETWORK_CALLBACK__ | |
3 | ||
[1916] | 4 | #include "NetworkPrereqs.h" |
5 | ||
[1529] | 6 | namespace network{ |
[1916] | 7 | class _NetworkExport NetworkCallbackBase |
[1529] | 8 | { |
9 | public: | |
10 | virtual void call() = 0; | |
[1536] | 11 | virtual ~NetworkCallbackBase() {} |
[1529] | 12 | }; |
[1916] | 13 | |
[1529] | 14 | template <class T> |
[1947] | 15 | class NetworkCallback: public NetworkCallbackBase |
[1529] | 16 | { |
17 | public: | |
18 | NetworkCallback(T* object, void (T::*function) (void)) : object_(object), function_(function) {} | |
[1536] | 19 | virtual ~NetworkCallback() {} |
[1529] | 20 | virtual void call() |
21 | { (this->object_->*function_)(); } | |
[1916] | 22 | |
[1529] | 23 | private: |
24 | T* object_; | |
25 | void (T::*function_) (void); | |
[1916] | 26 | }; |
[1529] | 27 | |
28 | ||
29 | } | |
30 | ||
31 | ||
32 | #endif |
Note: See TracBrowser
for help on using the repository browser.