cMsg Messaging System  5.2
 All Classes Namespaces Files Functions Variables Friends
cMsgPrivate.hxx
Go to the documentation of this file.
1 /*----------------------------------------------------------------------------*
2 * Copyright (c) 2005 Southeastern Universities Research Association, *
3 * Thomas Jefferson National Accelerator Facility *
4 * *
5 * This software was developed under a United States Government license *
6 * described in the NOTICE file included as part of this distribution. *
7 * *
8 * E.Wolin, 14-Jun-2007, Jefferson Lab *
9 * *
10 * Authors: Elliott Wolin *
11 * wolin@jlab.org Jefferson Lab, MS-12H5 *
12 * Phone: (757) 269-7365 12000 Jefferson Ave. *
13 * Fax: (757) 269-5519 Newport News, VA 23606 *
14 *
15 *----------------------------------------------------------------------------*/
16 
17 
18 #ifndef _cMsgPrivate_hxx
19 #define _cMsgPrivate_hxx
20 
21 
22 //-----------------------------------------------------------------------------
23 
24 
32 template <class T> class cMsgDispatcher : public cMsgCallback {
33 
34 private:
35  T *t;
36  void (T::*mfp)(cMsgMessage *msg, void* userArg);
38 public:
45  cMsgDispatcher(T *t, void (T::*mfp)(cMsgMessage *msg, void* userArg)) throw(cMsgException*) : t(t), mfp(mfp) {}
46 
47 
53  void callback(cMsgMessage *msg, void* userArg) throw(cMsgException) {
54  (t->*mfp)(msg,userArg);
55  }
56 
57 };
58 
59 
60 //-----------------------------------------------------------------------------
61 
62 
63 
64 #endif /* _cMsgPrivate_hxx */
cMsgDispatcher(T *t, void(T::*mfp)(cMsgMessage *msg, void *userArg))
Constructor stores object pointer and member function pointer.
Definition: cMsgPrivate.hxx:45
void callback(cMsgMessage *msg, void *userArg)
Callback method dispatches to member function.
Definition: cMsgPrivate.hxx:53
This class provides a cMsg C callback method that dispatchs to a member function of another object...
Definition: cMsgPrivate.hxx:32