2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 // $XConsortium: UAS_Sender.hh /main/7 1996/08/21 15:44:45 drk $
24 #ifndef _UAS_Sender_hh
25 #define _UAS_Sender_hh
27 # include "UAS_PtrList.hh"
30 #if defined(__STDC__) || defined(hpux)
31 #define CONCAT(A,B) A##B
32 #define CONCAT3(A,B,C) A##B##C
34 #define CONCAT(A,B) A/**/B
35 #define CONCAT3(A,B,C) A/**/B/**/C
39 template <class T> class UAS_Receiver;
47 void send_message (const T &message, void *client_data = 0);
50 void request (UAS_Receiver<T> *receiver);
51 // Stop receiving message T.
52 void unrequest (UAS_Receiver<T> *receiver);
55 // Keep track of message receivers so that we can send them messages
56 // and notify them when we have been destroyed.
57 UAS_PtrList<UAS_Receiver<T> > f_receiver_list;
60 #define STATIC_SENDER_HH(T) \
61 static void send_message (const T &message, void *client_data = 0) \
62 { CONCAT(sender,T)().send_message (message, client_data); } \
63 static void request (UAS_Receiver<T> *receiver) \
64 { CONCAT(sender,T)().request (receiver); } \
65 static void unrequest (UAS_Receiver<T> *receiver) \
66 { CONCAT(sender,T)().unrequest (receiver); } \
67 static UAS_Sender<T> &CONCAT(sender,T)()
69 #define STATIC_SENDER_CC(T) \
70 UAS_Sender<T> &CLASS::CONCAT(sender,T)() { \
71 static UAS_Sender<T> CONCAT(f_sender,T); \
72 return (CONCAT(f_sender,T)); }
74 #ifdef EXPAND_TEMPLATES
75 #include "UAS_Sender.C"