2 dnl Basic Signal Templates
4 dnl Copyright 1999 Karl Nelson <kenelson@ece.ucdavis.edu>
6 dnl This library is free software; you can redistribute it and/or
7 dnl modify it under the terms of the GNU Library General Public
8 dnl License as published by the Free Software Foundation; either
9 dnl version 2 of the License, or (at your option) any later version.
11 dnl This library is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 dnl Library General Public License for more details.
16 dnl You should have received a copy of the GNU Library General Public
17 dnl License along with this library; if not, write to the Free
18 dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 dnl Ignore the next line
22 /* This is a generated file, do not edit. Generated from __file__ */
23 include(template.macros.m4)
26 #include <sigc++/marshal.h>
27 #include <sigc++/slot.h>
31 #ifdef SIGC_CXX_NAMESPACES
36 /****************************************************************
37 ***** Signals (build by macros)
38 ****************************************************************/
40 // common part to all signals
41 class LIBSIGC_API Signal_
44 Signal_(const Signal_&);
47 typedef ScopeList List;
49 struct LIBSIGC_API Impl
51 typedef ScopeList List;
60 SlotData* in_connect();
61 SlotData* out_connect(SlotData *s);
72 dnl BASIC_SIGNAL([P1, P2, ...])
74 define([BASIC_SIGNAL],
75 [/****************************************************************
77 ****************************************************************/
80 template <LIST(class R,1,ARG_CLASS($1),[$1],[typename Marsh=Marshal<R> ],1)>
81 class [Signal]NUM($1):public Signal_
84 typedef __SLOT__(R,[$1]) InSlotType;
85 typedef __SLOT__(typename Marsh::OutType,[$1]) OutSlotType;
88 #ifdef SIGC_CXX_PARTIAL_SPEC
89 typedef typename Marsh::OutType SType;
92 typedef Trait<typename Marsh::OutType>::type SType;
93 typedef Trait<R>::type RType;
95 typedef typename InSlotType::Callback Callback;
96 typedef [Signal]NUM($1)<LIST(R,1,ARG_TYPE($1),[$1],Marsh,1)> Self;
97 typedef CallDataObj2<typename OutSlotType::Func,Self> CallData;
99 static SType callback(LIST(void* d,1,ARG_BOTH($1),[$1]))
101 CallData* data=(CallData*)d;
102 return data->obj->emit(ARG_NAME($1));
108 SlotData* tmp=in_connect();
109 CallData &data=reinterpret_cast<CallData&>(tmp->data_);
110 data.callback=(typename OutSlotType::Func)callback;
115 Connection connect(const InSlotType &s)
117 return out_connect(s.data());
120 SType emit(ARG_REF($1));
121 SType operator()(ARG_REF($1))
122 {return emit(ARG_NAME($1));}
125 [Signal]NUM($1)(const InSlotType &s) {connect(s);}
126 ~[Signal]NUM($1)() {}
131 template <LIST(class R,1,ARG_CLASS($1),[$1],class Marsh,1)>
132 typename [Signal]NUM($1)<LIST(R,1,ARG_TYPE($1),[$1],Marsh,1)>::SType [Signal]NUM($1)<LIST(R,1,ARG_TYPE($1),[$1],Marsh,1)>::
135 if (!impl||impl->outgoing_.empty()) return Marsh::default_value();
136 List &out=impl->outgoing_;
139 List::Iterator i=out.begin();
142 data=((SlotDependent*)(i.node()))->parent();
144 Callback& s=(Callback&)(data->callback());
145 if (rc.marshal(s.call(ARG_NAME($1)))) return rc.value();
150 #ifdef SIGC_CXX_PARTIAL_SPEC
151 template <LIST(ARG_CLASS($1),[$1],[class Marsh],1)>
152 class [Signal]NUM($1)<LIST(void,1,ARG_TYPE($1),[$1],Marsh,1)>
156 typedef __SLOT__(void,[$1]) InSlotType;
157 typedef __SLOT__(void,[$1]) OutSlotType;
159 typedef ifelse([$1],,,[typename ])InSlotType::Callback Callback;
160 typedef [Signal]NUM($1)<LIST(void,1,ARG_TYPE($1),[$1],Marsh,1)> Self;
161 typedef CallDataObj2<ifelse([$1],,,[typename ])OutSlotType::Func,Self> CallData;
163 static void callback(LIST(void* d,1,ARG_BOTH($1),[$1]))
165 CallData* data=(CallData*)d;
166 data->obj->emit(ARG_NAME($1));
172 SlotData* tmp=in_connect();
173 CallData& data=reinterpret_cast<CallData&>(tmp->data_);
174 data.callback=callback;
179 Connection connect(const InSlotType &s)
181 return out_connect(s.data());
184 void emit(ARG_REF($1));
185 void operator()(ARG_REF($1))
186 {emit(ARG_NAME($1));}
189 [Signal]NUM($1)(const InSlotType &s) {connect(s);}
190 ~[Signal]NUM($1)() {}
195 template <LIST(ARG_CLASS($1),[$1],class Marsh,1)>
196 void [Signal]NUM($1)<LIST(void,1,ARG_TYPE($1),[$1],Marsh,1)>::
199 if (!impl||impl->outgoing_.empty()) return;
200 List &out=impl->outgoing_;
202 List::Iterator i=out.begin();
205 data=((SlotDependent*)(i.node()))->parent();
207 Callback& s=(Callback&)(data->callback());
208 s.call(ARG_NAME($1));
216 BASIC_SIGNAL(ARGS(P,0))
217 BASIC_SIGNAL(ARGS(P,1))
218 BASIC_SIGNAL(ARGS(P,2))
219 BASIC_SIGNAL(ARGS(P,3))
221 #ifdef SIGC_CXX_NAMESPACES