7 #ifndef CNOID_UTIL_SIGNAL_H 8 #define CNOID_UTIL_SIGNAL_H 11 #include <boost/type_traits/function_traits.hpp> 13 #define CNOID_SIGNAL_CONCAT( X, Y ) CNOID_SIGNAL_DO_CONCAT( X, Y ) 14 #define CNOID_SIGNAL_DO_CONCAT( X, Y ) CNOID_SIGNAL_DO_CONCAT2(X,Y) 15 #define CNOID_SIGNAL_DO_CONCAT2( X, Y ) X##Y 21 namespace signal_private {
27 template<
typename InputIterator>
28 T
operator()(InputIterator first, InputIterator last)
const {
40 template<
typename InputIterator>
41 void operator()(InputIterator first, InputIterator last)
const{
53 virtual void disconnect() = 0;
54 virtual bool connected()
const = 0;
55 virtual void changeOrder(
int orderId) = 0;
61 template<
typename SlotType,
typename ArgSetType>
66 SlotType* currentSlot;
71 while(currentSlot && currentSlot->isBlocked){
72 currentSlot = currentSlot->next;
77 : currentSlot(firstSlot), args(args) {
82 : currentSlot(org.currentSlot), args(org.args) {
87 return (currentSlot == rhs.currentSlot);
91 return (currentSlot != rhs.currentSlot);
96 currentSlot = currentSlot->next;
101 result_type
operator*()
const {
return args.call(currentSlot); }
177 #define CNOID_SIGNAL_NUM_ARGS 0 178 #define CNOID_SIGNAL_TEMPLATE_PARMS 179 #define CNOID_SIGNAL_TEMPLATE_ARGS 180 #define CNOID_SIGNAL_PARMS 181 #define CNOID_SIGNAL_ARGS 182 #define CNOID_SIGNAL_ARGS_AS_MEMBERS 183 #define CNOID_SIGNAL_COPY_PARMS 184 #define CNOID_SIGNAL_INIT_ARGS 188 #undef CNOID_SIGNAL_INIT_ARGS 189 #undef CNOID_SIGNAL_COPY_PARMS 190 #undef CNOID_SIGNAL_ARGS_AS_MEMBERS 191 #undef CNOID_SIGNAL_ARGS 192 #undef CNOID_SIGNAL_PARMS 193 #undef CNOID_SIGNAL_TEMPLATE_ARGS 194 #undef CNOID_SIGNAL_TEMPLATE_PARMS 195 #undef CNOID_SIGNAL_NUM_ARGS 197 #define CNOID_SIGNAL_NUM_ARGS 1 198 #define CNOID_SIGNAL_TEMPLATE_PARMS typename T1 199 #define CNOID_SIGNAL_TEMPLATE_ARGS T1 200 #define CNOID_SIGNAL_PARMS T1 a1 201 #define CNOID_SIGNAL_ARGS a1 202 #define CNOID_SIGNAL_ARGS_AS_MEMBERS T1 a1; 203 #define CNOID_SIGNAL_COPY_PARMS T1 ia1 204 #define CNOID_SIGNAL_INIT_ARGS :a1(ia1) 208 #undef CNOID_SIGNAL_INIT_ARGS 209 #undef CNOID_SIGNAL_COPY_PARMS 210 #undef CNOID_SIGNAL_ARGS_AS_MEMBERS 211 #undef CNOID_SIGNAL_ARGS 212 #undef CNOID_SIGNAL_PARMS 213 #undef CNOID_SIGNAL_TEMPLATE_ARGS 214 #undef CNOID_SIGNAL_TEMPLATE_PARMS 215 #undef CNOID_SIGNAL_NUM_ARGS 217 #define CNOID_SIGNAL_NUM_ARGS 2 218 #define CNOID_SIGNAL_TEMPLATE_PARMS typename T1, typename T2 219 #define CNOID_SIGNAL_TEMPLATE_ARGS T1, T2 220 #define CNOID_SIGNAL_PARMS T1 a1, T2 a2 221 #define CNOID_SIGNAL_ARGS a1, a2 222 #define CNOID_SIGNAL_ARGS_AS_MEMBERS T1 a1;T2 a2; 223 #define CNOID_SIGNAL_COPY_PARMS T1 ia1, T2 ia2 224 #define CNOID_SIGNAL_INIT_ARGS :a1(ia1), a2(ia2) 228 #undef CNOID_SIGNAL_INIT_ARGS 229 #undef CNOID_SIGNAL_COPY_PARMS 230 #undef CNOID_SIGNAL_ARGS_AS_MEMBERS 231 #undef CNOID_SIGNAL_ARGS 232 #undef CNOID_SIGNAL_PARMS 233 #undef CNOID_SIGNAL_TEMPLATE_ARGS 234 #undef CNOID_SIGNAL_TEMPLATE_PARMS 235 #undef CNOID_SIGNAL_NUM_ARGS 237 #define CNOID_SIGNAL_NUM_ARGS 3 238 #define CNOID_SIGNAL_TEMPLATE_PARMS typename T1, typename T2, typename T3 239 #define CNOID_SIGNAL_TEMPLATE_ARGS T1, T2, T3 240 #define CNOID_SIGNAL_PARMS T1 a1, T2 a2, T3 a3 241 #define CNOID_SIGNAL_ARGS a1, a2, a3 242 #define CNOID_SIGNAL_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3; 243 #define CNOID_SIGNAL_COPY_PARMS T1 ia1, T2 ia2, T3 ia3 244 #define CNOID_SIGNAL_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3) 248 #undef CNOID_SIGNAL_INIT_ARGS 249 #undef CNOID_SIGNAL_COPY_PARMS 250 #undef CNOID_SIGNAL_ARGS_AS_MEMBERS 251 #undef CNOID_SIGNAL_ARGS 252 #undef CNOID_SIGNAL_PARMS 253 #undef CNOID_SIGNAL_TEMPLATE_ARGS 254 #undef CNOID_SIGNAL_TEMPLATE_PARMS 255 #undef CNOID_SIGNAL_NUM_ARGS 260 namespace signal_private {
262 template<
int Arity,
typename Signature,
typename Combiner>
265 template<
typename Signature,
typename Combiner>
268 typedef boost::function_traits<Signature> traits;
270 typedef Signal0<typename traits::result_type, Combiner>
type;
273 template<
typename Signature,
typename Combiner>
276 typedef boost::function_traits<Signature> traits;
278 typedef Signal1<
typename traits::result_type,
279 typename traits::arg1_type,
283 template<
typename Signature,
typename Combiner>
286 typedef boost::function_traits<Signature> traits;
288 typedef Signal2<
typename traits::result_type,
289 typename traits::arg1_type,
290 typename traits::arg2_type,
295 template<
typename Signature,
typename Combiner>
298 typedef boost::function_traits<Signature> traits;
300 typedef Signal3<
typename traits::result_type,
301 typename traits::arg1_type,
302 typename traits::arg2_type,
303 typename traits::arg3_type,
307 template<
typename Signature,
typename Combiner>
309 (boost::function_traits<Signature>::arity), Signature, Combiner>
329 template<
typename Signature,
typename Combiner>
350 template<
typename InputIterator>
351 bool operator()(InputIterator first, InputIterator last)
const {
353 while(first != last){
365 template<
typename InputIterator>
366 bool operator()(InputIterator first, InputIterator last)
const {
368 while(first != last){
393 connection_type
connect(
typename SignalType::slot_function_type f){
395 return signal->connect(f);
397 return connection_type();
SlotCallIterator(const SlotCallIterator &org)
Definition: Signal.h:81
SlotCallIterator(SlotType *firstSlot, ArgSetType &args)
Definition: Signal.h:76
Connection connection_type
Definition: Signal.h:332
ScopedConnection(const Connection &org)
Definition: Signal.h:160
ScopedConnection & changeOrder(Order order)
Definition: Signal.h:167
connection_type connect(typename SignalType::slot_function_type f)
Definition: Signal.h:393
bool connected()
Definition: Signal.h:130
SignalProxy()
Definition: Signal.h:385
ScopedConnection()
Definition: Signal.h:159
void block()
Definition: Signal.h:134
bool connected()
Definition: Signal.h:164
Connection & changeOrder(Order order)
Definition: Signal.h:148
Definition: Referenced.h:67
void disconnect()
Definition: Signal.h:123
void reset(const Connection &c)
Definition: Signal.h:162
bool operator()(InputIterator first, InputIterator last) const
Definition: Signal.h:366
void unblock()
Definition: Signal.h:166
result_type operator*() const
Definition: Signal.h:101
virtual bool connected() const =0
Connection & operator=(const Connection &rhs)
Definition: Signal.h:118
void operator()(InputIterator first, InputIterator last) const
Definition: Signal.h:41
Signal1< typename traits::result_type, typename traits::arg1_type, Combiner > type
Definition: Signal.h:280
Signal0< typename traits::result_type, Combiner > type
Definition: Signal.h:270
bool result_type
Definition: Signal.h:349
bool operator!=(const SlotCallIterator &rhs) const
Definition: Signal.h:90
virtual void disconnect()=0
Connection(signal_private::SlotHolderBase *slot)
Definition: Signal.h:114
virtual ~SlotHolderBase()
Definition: Signal.h:52
Signal2< typename traits::result_type, typename traits::arg1_type, typename traits::arg2_type, Combiner > type
Definition: Signal.h:291
SlotCallIterator operator++(int)
Definition: Signal.h:94
bool operator()(InputIterator first, InputIterator last) const
Definition: Signal.h:351
Defines the minimum processing for performing pasing file for STL.
Definition: AbstractSceneLoader.h:9
T result_type
Definition: Signal.h:25
signal_traits< SignalType >::connection_type connection_type
Definition: Signal.h:391
SignalProxy(const SignalProxy &org)
Definition: Signal.h:387
Connection(const Connection &org)
Definition: Signal.h:116
TSignature Signature
Definition: Signal.h:323
T operator()(InputIterator first, InputIterator last) const
Definition: Signal.h:28
Signal3< typename traits::result_type, typename traits::arg1_type, typename traits::arg2_type, typename traits::arg3_type, Combiner > type
Definition: Signal.h:304
SignalProxy(SignalType &signal)
Definition: Signal.h:386
bool result_type
Definition: Signal.h:364
SlotHolderBase()
Definition: Signal.h:51
Connection()
Definition: Signal.h:112
void unblock()
Definition: Signal.h:140
void seekUnblockedSlot()
Definition: Signal.h:70
virtual void changeOrder(int orderId)=0
bool isBlocked
Definition: Signal.h:57
~ScopedConnection()
Definition: Signal.h:161
void block()
Definition: Signal.h:165
bool operator==(const SlotCallIterator &rhs) const
Definition: Signal.h:86
void disconnect()
Definition: Signal.h:163
Order
Definition: Signal.h:146
SignalProxy & operator=(const SignalProxy &rhs)
Definition: Signal.h:389
Signal< Signature, Combiner > SignalType
Definition: Signal.h:383