Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berryMessage.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 BlueBerry Platform
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef BERRYMESSAGE_H_
18 #define BERRYMESSAGE_H_
19 
20 #include <vector>
21 #include <Poco/Mutex.h>
22 
27 #define berryNewMessageMacro(msgHandleObject) \
28  private: Message<> m_ ## msgHandleObject ## Message; \
29  public: \
30  inline void Add ## msgHandleObject ## Listener(const MessageAbstractDelegate<>& delegate) \
31  { m_ ## msgHandleObject ## Message += delegate; } \
32  inline void Remove ## msgHandleObject ## Listener(const MessageAbstractDelegate<>& delegate) \
33  { m_ ## msgHandleObject ## Message -= delegate; } \
34 
35 
36 #define berryNewMessageWithReturnMacro(msgHandleObject, returnType) \
37  private: Message<returnType> m_ ## msgHandleObject ## Message; \
38  public: \
39  inline void Add ## msgHandleObject ## Listener(const MessageAbstractDelegate<returnType>& delegate) \
40  { m_ ## msgHandleObject ## Message += delegate; } \
41  inline void Remove ## msgHandleObject ## Listener(const MessageAbstractDelegate<returnType>& delegate) \
42  { m_ ## msgHandleObject ## Message -= delegate; } \
43 
44 
45 #define berryNewMessage1Macro(msgHandleObject, type1) \
46  private: Message1< type1 > m_msgHandleObject ## Message; \
47  public: \
48  void Add ## msgHandleObject ## Listener(const MessageAbstractDelegate1< type1 >& delegate) \
49  { m_ ## msgHandleObject ## Message += delegate; } \
50  void Remove ## msgHandleObject ## Listener(const MessageAbstractDelegate1< type1 >& delegate) \
51  { m_ ## msgHandleObject ## Message -= delegate; } \
52 
53 
54 namespace berry
55 {
56 
57 template<typename A = void>
59 {
60 public:
61 
63  {
64  }
65 
66  virtual A Execute() = 0;
67  virtual bool operator==(const MessageAbstractDelegate* cmd) = 0;
68  virtual MessageAbstractDelegate* Clone() const = 0;
69 };
70 
71 template<typename T, typename A = void>
73 {
74 public:
75 
77  {
78  }
79 
80  virtual A Execute(T t) = 0;
81  virtual bool operator==(const MessageAbstractDelegate1* cmd) = 0;
82  virtual MessageAbstractDelegate1* Clone() const = 0;
83 };
84 
85 template<typename T, typename U, typename A = void>
87 {
88 public:
89 
91  {
92  }
93 
94  virtual A Execute(T t, U u) const = 0;
95  virtual bool operator==(const MessageAbstractDelegate2* cmd) = 0;
96  virtual MessageAbstractDelegate2* Clone() const = 0;
97 };
98 
99 template<typename T, typename U, typename V, typename A = void>
101 {
102 public:
103 
105  {
106  }
107 
108  virtual A Execute(T t, U u, V v) const = 0;
109  virtual bool operator==(const MessageAbstractDelegate3* cmd) = 0;
110  virtual MessageAbstractDelegate3* Clone() const = 0;
111 };
112 
113 template<typename T, typename U, typename V, typename W, typename A = void>
115 {
116 public:
117 
119  {
120  }
121 
122  virtual A Execute(T t, U u, V v, W w) const = 0;
123  virtual bool operator==(const MessageAbstractDelegate4* cmd) = 0;
124  virtual MessageAbstractDelegate4* Clone() const = 0;
125 };
126 
127 template<class R, typename A = void>
129 {
130 public:
131 
132  // constructor - takes pointer to an object and pointer to a member and stores
133  // them in two private variables
134  MessageDelegate(R* object, A(R::*memberFunctionPointer)()) :
135  m_Object(object), m_MemberFunctionPointer(memberFunctionPointer)
136  {
137  }
138 
140  {
141  }
142 
143  // override function "Call"
144  virtual A Execute()
145  {
146  return (m_Object->*m_MemberFunctionPointer)(); // execute member function
147  }
148 
150  {
151  const MessageDelegate<R, A>* cmd =
152  dynamic_cast<const MessageDelegate<R, A>*> (c);
153  if (!cmd)
154  return false;
155 
156  if ((void*) this->m_Object != (void*) cmd->m_Object)
157  return false;
158  if (this->m_MemberFunctionPointer != cmd->m_MemberFunctionPointer)
159  return false;
160  return true;
161  }
162 
164  {
165  return new MessageDelegate(m_Object, m_MemberFunctionPointer);
166  }
167 
168 private:
169  R* m_Object; // pointer to object
170  A (R::*m_MemberFunctionPointer)(); // pointer to member function
171 };
172 
173 template<class R, typename T, typename A = void>
175 {
176 public:
177 
178  // constructor - takes pointer to an object and pointer to a member and stores
179  // them in two private variables
180  MessageDelegate1(R* object, A(R::*memberFunctionPointer)(T)) :
181  m_Object(object), m_MemberFunctionPointer(memberFunctionPointer)
182  {
183  }
184 
186  {
187  }
188 
189  // override function "Call"
190  virtual A Execute(T t)
191  {
192  return (m_Object->*m_MemberFunctionPointer)(t); // execute member function
193  }
194 
196  {
197  const MessageDelegate1<R, T, A>* cmd = dynamic_cast<const MessageDelegate1<
198  R, T, A>*> (c);
199  if (!cmd)
200  return false;
201 
202  if ((void*) this->m_Object != (void*) cmd->m_Object)
203  return false;
204  if (this->m_MemberFunctionPointer != cmd->m_MemberFunctionPointer)
205  return false;
206  return true;
207  }
208 
210  {
211  return new MessageDelegate1(m_Object, m_MemberFunctionPointer);
212  }
213 
214 private:
215  R* m_Object; // pointer to object
216  A (R::*m_MemberFunctionPointer)(T); // pointer to member function
217 };
218 
219 template<class R, typename T, typename U, typename A = void>
221 {
222 public:
223 
224  // constructor - takes pointer to an object and pointer to a member and stores
225  // them in two private variables
226  MessageDelegate2(R* object, A(R::*memberFunctionPointer)(T, U)) :
227  m_Object(object), m_MemberFunctionPointer(memberFunctionPointer)
228  {
229  }
230 
232  {
233  }
234 
235  // override function "Call"
236  virtual A Execute(T t, U u) const
237  {
238  return (m_Object->*m_MemberFunctionPointer)(t, u); // execute member function
239  }
240 
242  {
243  const MessageDelegate2<R, T, U, A>* cmd =
244  dynamic_cast<const MessageDelegate2<R, T, U, A>*> (c);
245  if (!cmd)
246  return false;
247 
248  if ((void*) this->m_Object != (void*) cmd->m_Object)
249  return false;
250  if (this->m_MemberFunctionPointer != cmd->m_MemberFunctionPointer)
251  return false;
252  return true;
253  }
254 
256  {
257  return new MessageDelegate2(m_Object, m_MemberFunctionPointer);
258  }
259 
260 private:
261  R* m_Object; // pointer to object
262  A (R::*m_MemberFunctionPointer)(T, U); // pointer to member function
263 };
264 
265 template<class R, typename T, typename U, typename V, typename A = void>
267 {
268 public:
269 
270  // constructor - takes pointer to an object and pointer to a member and stores
271  // them in two private variables
272  MessageDelegate3(R* object, A(R::*memberFunctionPointer)(T, U, V)) :
273  m_Object(object), m_MemberFunctionPointer(memberFunctionPointer)
274  {
275  }
276 
278  {
279  }
280 
281  // override function "Call"
282  virtual A Execute(T t, U u, V v) const
283  {
284  return (m_Object->*m_MemberFunctionPointer)(t, u, v); // execute member function
285  }
286 
288  {
290  dynamic_cast<const MessageDelegate3<R, T, U, V, A>*> (c);
291  if (!cmd)
292  return false;
293 
294  if ((void*) this->m_Object != (void*) cmd->m_Object)
295  return false;
296  if (this->m_MemberFunctionPointer != cmd->m_MemberFunctionPointer)
297  return false;
298  return true;
299  }
300 
302  {
303  return new MessageDelegate3(m_Object, m_MemberFunctionPointer);
304  }
305 
306 private:
307  R* m_Object; // pointer to object
308  A (R::*m_MemberFunctionPointer)(T, U, V); // pointer to member function
309 };
310 
311 template<class R, typename T, typename U, typename V, typename W,
312  typename A = void>
313 class MessageDelegate4: public MessageAbstractDelegate4<T, U, V, W, A>
314 {
315 public:
316 
317  // constructor - takes pointer to an object and pointer to a member and stores
318  // them in two private variables
319  MessageDelegate4(R* object, A(R::*memberFunctionPointer)(T, U, V, W)) :
320  m_Object(object), m_MemberFunctionPointer(memberFunctionPointer)
321  {
322  }
323 
325  {
326  }
327 
328  // override function "Call"
329  virtual A Execute(T t, U u, V v, W w) const
330  {
331  return (m_Object->*m_MemberFunctionPointer)(t, u, v, w); // execute member function
332  }
333 
335  {
337  dynamic_cast<const MessageDelegate4<R, T, U, V, W, A>*> (c);
338  if (!cmd)
339  return false;
340 
341  if ((void*) this->m_Object != (void*) cmd->m_Object)
342  return false;
343  if (this->m_MemberFunctionPointer != cmd->m_MemberFunctionPointer)
344  return false;
345  return true;
346  }
347 
349  {
350  return new MessageDelegate4(m_Object, m_MemberFunctionPointer);
351  }
352 
353 private:
354  R* m_Object; // pointer to object
355  A (R::*m_MemberFunctionPointer)(T, U, V, W); // pointer to member function
356 };
357 
359 {
360  virtual void HandleException(const std::exception& exc) = 0;
361  virtual AbstractExceptionHandler* Clone() const = 0;
362 
364  {
365  }
366 };
367 
368 template<typename R>
370 {
371  typedef void (R::*HandleExceptionCallback)(const std::exception&);
372 
374  m_Object(r), m_ExceptionCallback(c)
375  {
376  }
377 
378  void HandleException(const std::exception& exc) override
379  {
380  (m_Object->*m_ExceptionCallback)(exc);
381  }
382 
383  AbstractExceptionHandler* Clone() const override
384  {
385  if (!m_Object) return nullptr;
386  return new MessageExceptionHandler(m_Object, m_ExceptionCallback);
387  }
388 
389 private:
390 
391  R* m_Object;
392  HandleExceptionCallback m_ExceptionCallback;
393 };
394 
395 template<typename D>
397 {
398 
399 public:
400 
401  typedef D Delegate;
402  typedef std::vector<Delegate*> ListType;
403 
405  m_ExcHandler(nullptr)
406  {
407 
408  }
409 
411  {
412  for (auto iter = m_Delegates.begin(); iter
413  != m_Delegates.end(); ++iter)
414  {
415  delete *iter;
416  }
417 
418  delete m_ExcHandler;
419  }
420 
421  void Add(const Delegate& d) const
422  {
423  Delegate* copy = d.Clone();
424 
425  Poco::FastMutex::ScopedLock lock(m_Mutex);
426  for (auto iter = m_Delegates.begin(); iter
427  != m_Delegates.end(); ++iter)
428  {
429  if ((*iter)->operator==(copy))
430  {
431  delete copy;
432  return;
433  }
434  }
435  m_Delegates.push_back(copy);
436  }
437 
438  void Remove(const Delegate& d) const
439  {
440  Poco::FastMutex::ScopedLock lock(m_Mutex);
441  for (auto iter = m_Delegates.begin(); iter
442  != m_Delegates.end(); ++iter)
443  {
444  if ((*iter)->operator==(&d))
445  {
446  delete *iter;
447  m_Delegates.erase(iter);
448  return;
449  }
450  }
451  }
452 
453  bool IsEmpty() const
454  {
455  return m_Delegates.empty();
456  }
457 
458  template<typename Dummy>
459  void Send0(Dummy) const
460  {
461  ListType delegates;
462 
463  {
464  Poco::FastMutex::ScopedLock lock(m_Mutex);
465  delegates.assign(m_Delegates.begin(), m_Delegates.end());
466  }
467 
468  for (auto iter = delegates.begin(); iter
469  != delegates.end(); ++iter)
470  {
471  try
472  {
473  // notify each listener
474  (*iter)->Execute();
475  }
476  catch (const std::exception& e)
477  {
478  if (m_ExcHandler)
479  {
480  m_ExcHandler->HandleException(e);
481  }
482  else
483  {
484  throw e;
485  }
486  }
487  catch (...)
488  {
489  if (m_ExcHandler)
490  {
491  m_ExcHandler->HandleException(std::exception());
492  }
493  else
494  throw ;
495  }
496  }
497  }
498 
499  template<typename T>
500  void Send1(T t) const
501  {
502  ListType delegates;
503 
504  {
505  Poco::FastMutex::ScopedLock lock(m_Mutex);
506  delegates.assign(m_Delegates.begin(), m_Delegates.end());
507  }
508 
509  for (auto iter = delegates.begin(); iter
510  != delegates.end(); ++iter)
511  {
512  try
513  {
514  // notify each listener
515  (*iter)->Execute(t);
516  }
517  catch (const std::exception& e)
518  {
519  if (m_ExcHandler)
520  {
521  m_ExcHandler->HandleException(e);
522  }
523  else
524  {
525  throw e;
526  }
527  }
528  catch (...)
529  {
530  if (m_ExcHandler)
531  {
532  m_ExcHandler->HandleException(std::exception());
533  }
534  else throw;
535  }
536  }
537  }
538 
539  template<typename T, typename U>
540  void Send2(T t, U u) const
541  {
542  ListType delegates;
543 
544  {
545  Poco::FastMutex::ScopedLock lock(m_Mutex);
546  delegates.assign(m_Delegates.begin(), m_Delegates.end());
547  }
548 
549  for (auto iter = delegates.begin(); iter
550  != delegates.end(); ++iter)
551  {
552  try
553  {
554  // notify each listener
555  (*iter)->Execute(t, u);
556  }
557  catch (const std::exception& e)
558  {
559  if (m_ExcHandler)
560  {
561  m_ExcHandler->HandleException(e);
562  }
563  else
564  {
565  throw e;
566  }
567  }
568  catch (...)
569  {
570  if (m_ExcHandler)
571  {
572  m_ExcHandler->HandleException(std::exception());
573  }
574  else throw;
575  }
576  }
577  }
578 
579  template<typename T, typename U, typename V>
580  void Send3(T t, U u, V v) const
581  {
582  ListType delegates;
583 
584  {
585  Poco::FastMutex::ScopedLock lock(m_Mutex);
586  delegates.assign(m_Delegates.begin(), m_Delegates.end());
587  }
588 
589  for (auto iter = delegates.begin(); iter
590  != delegates.end(); ++iter)
591  {
592  try
593  {
594  // notify each listener
595  (*iter)->Execute(t, u, v);
596  }
597  catch (const std::exception& e)
598  {
599  if (m_ExcHandler)
600  {
601  m_ExcHandler->HandleException(e);
602  }
603  else
604  {
605  throw e;
606  }
607  }
608  catch (...)
609  {
610  if (m_ExcHandler)
611  {
612  m_ExcHandler->HandleException(std::exception());
613  }
614  else throw;
615  }
616  }
617  }
618 
619  template<typename T, typename U, typename V, typename W>
620  void Send4(T t, U u, V v, W w) const
621  {
622  ListType delegates;
623 
624  {
625  Poco::FastMutex::ScopedLock lock(m_Mutex);
626  delegates.assign(m_Delegates.begin(), m_Delegates.end());
627  }
628 
629  for (auto iter = delegates.begin(); iter
630  != delegates.end(); ++iter)
631  {
632  try
633  {
634  // notify each listener
635  (*iter)->Execute(t, u, v, w);
636  }
637  catch (const std::exception& e)
638  {
639  if (m_ExcHandler)
640  {
641  m_ExcHandler->HandleException(e);
642  }
643  else
644  {
645  throw e;
646  }
647  }
648  catch (...)
649  {
650  if (m_ExcHandler)
651  {
652  m_ExcHandler->HandleException(std::exception());
653  }
654  else throw;
655  }
656  }
657  }
658 
660  {
661  Poco::FastMutex::ScopedLock lock(m_Mutex);
662  delete m_ExcHandler;
663  m_ExcHandler = handler.Clone();
664  }
665 
667  {
668  Poco::FastMutex::ScopedLock lock(m_Mutex);
669  if (m_ExcHandler) return m_ExcHandler->Clone();
670  return nullptr;
671  }
672 
673  ListType GetDelegates() const
674  {
675  Poco::FastMutex::ScopedLock lock(m_Mutex);
676  return m_Delegates;
677  }
678 
679  private:
680 
698  mutable std::vector<Delegate*> m_Delegates;
699 
700  mutable AbstractExceptionHandler* m_ExcHandler;
701  mutable Poco::FastMutex m_Mutex;
702  };
703 
718  // message without parameters (pure signals)
719  template<typename A = void>
720  class Message
721  {
722  public:
723 
724  typedef Message Self;
727 
728  void AddListener(const AbstractDelegate& delegate) const
729  {
730  delegates.Add(delegate);
731  }
732 
733  void operator +=(const AbstractDelegate& delegate) const
734  {
735  this->AddListener(delegate);
736  }
737 
738  void RemoveListener(const AbstractDelegate& delegate) const
739  {
740  delegates.Remove(delegate);
741  }
742 
743  void operator -=(const AbstractDelegate& delegate) const
744  {
745  this->RemoveListener(delegate);
746  }
747 
748  void Send() const
749  {
750  delegates.Send0(0);
751  }
752 
753  void operator()() const
754  {
755  this->Send();
756  }
757 
759  {
760  delegates.SetExceptionHandler(handler);
761  }
762 
764  {
765  return delegates.GetExceptionHandler();
766  }
767 
768  ListenerList GetListeners() const
769  {
770  return delegates.GetDelegates();
771  }
772 
773  bool HasListeners() const
774  {
775  return !delegates.IsEmpty();
776  }
777 
778  bool IsEmpty() const
779  {
780  return delegates.IsEmpty();
781  }
782 
783  protected:
784 
786 
787  };
788 
789  // message with 1 parameter and return type
790  template<typename T, typename A = void>
791  class Message1
792  {
793  public:
794 
795  typedef Message1 Self;
798 
799  void AddListener(const AbstractDelegate& delegate) const
800  {
801  delegates.Add(delegate);
802  }
803 
804  void operator +=(const AbstractDelegate& delegate) const
805  {
806  this->AddListener(delegate);
807  }
808 
809  void RemoveListener(const AbstractDelegate& delegate) const
810  {
811  delegates.Remove(delegate);
812  }
813 
814  void operator -=(const AbstractDelegate& delegate) const
815  {
816  this->RemoveListener(delegate);
817  }
818 
819  void Send(T t) const
820  {
821  delegates.Send1(t);
822  }
823 
824  void operator()(T t) const
825  {
826  this->Send(t);
827  }
828 
830  {
831  delegates.SetExceptionHandler(handler);
832  }
833 
835  {
836  return delegates.GetExceptionHandler();
837  }
838 
839  ListenerList GetListeners() const
840  {
841  return delegates.GetDelegates();
842  }
843 
844  bool HasListeners() const
845  {
846  return !delegates.IsEmpty();
847  }
848 
849  bool IsEmpty() const
850  {
851  return delegates.IsEmpty();
852  }
853 
854  protected:
855 
857 
858  };
859 
860  // message with 2 parameters and return type
861  template<typename T, typename U, typename A = void>
862  class Message2
863  {
864  public:
865 
866  typedef Message2 Self;
869 
870  void AddListener(const AbstractDelegate& delegate) const
871  {
872  delegates.Add(delegate);
873  }
874 
875  void operator +=(const AbstractDelegate& delegate) const
876  {
877  this->AddListener(delegate);
878  }
879 
880  void RemoveListener(const AbstractDelegate& delegate) const
881  {
882  delegates.Remove(delegate);
883  }
884 
885  void operator -=(const AbstractDelegate& delegate) const
886  {
887  this->RemoveListener(delegate);
888  }
889 
890  void Send(T t, U u) const
891  {
892  delegates.Send2(t, u);
893  }
894 
895  void operator()(T t, U u) const
896  {
897  this->Send(t, u);
898  }
899 
901  {
902  delegates.SetExceptionHandler(handler);
903  }
904 
906  {
907  return delegates.GetExceptionHandler();
908  }
909 
910  ListenerList GetListeners() const
911  {
912  return delegates.GetDelegates();
913  }
914 
915  bool HasListeners() const
916  {
917  return !delegates.IsEmpty();
918  }
919 
920  bool IsEmpty() const
921  {
922  return delegates.IsEmpty();
923  }
924 
925  protected:
926 
928 
929  };
930 
931  // message with 3 parameters and return type
932  template<typename T, typename U, typename V, typename A = void>
933  class Message3
934  {
935  public:
936 
937  typedef Message3 Self;
940 
941  void AddListener(const AbstractDelegate& delegate) const
942  {
943  delegates.Add(delegate);
944  }
945 
946  void operator +=(const AbstractDelegate& delegate) const
947  {
948  this->AddListener(delegate);
949  }
950 
951  void RemoveListener(const AbstractDelegate& delegate) const
952  {
953  delegates.Remove(delegate);
954  }
955 
956  void operator -=(const AbstractDelegate& delegate) const
957  {
958  this->RemoveListener(delegate);
959  }
960 
961  void Send(T t, U u, V v) const
962  {
963  delegates.Send3(t, u, v);
964  }
965 
966  void operator()(T t, U u, V v) const
967  {
968  this->Send(t, u, v);
969  }
970 
972  {
973  delegates.SetExceptionHandler(handler);
974  }
975 
977  {
978  return delegates.GetExceptionHandler();
979  }
980 
981  ListenerList GetListeners() const
982  {
983  return delegates.GetDelegates();
984  }
985 
986  bool HasListeners() const
987  {
988  return !delegates.IsEmpty();
989  }
990 
991  bool IsEmpty() const
992  {
993  return delegates.IsEmpty();
994  }
995 
996  protected:
997 
999 
1000  };
1001 
1002  // message with 4 parameters and return type
1003  template<typename T, typename U, typename V, typename W, typename A = void>
1004  class Message4
1005  {
1006  public:
1007 
1008  typedef Message4 Self;
1011 
1012  void AddListener(const AbstractDelegate& delegate) const
1013  {
1014  delegates.Add(delegate);
1015  }
1016 
1017  void operator +=(const AbstractDelegate& delegate) const
1018  {
1019  this->AddListener(delegate);
1020  }
1021 
1022  void RemoveListener(const AbstractDelegate& delegate) const
1023  {
1024  delegates.Remove(delegate);
1025  }
1026 
1027  void operator -=(const AbstractDelegate& delegate) const
1028  {
1029  this->RemoveListener(delegate);
1030  }
1031 
1032  void Send(T t, U u, V v, W w) const
1033  {
1034  delegates.Send4(t, u, v, w);
1035  }
1036 
1037  void operator()(T t, U u, V v, W w) const
1038  {
1039  this->Send(t, u , v, w);
1040  }
1041 
1043  {
1044  delegates.SetExceptionHandler(handler);
1045  }
1046 
1048  {
1049  return delegates.GetExceptionHandler();
1050  }
1051 
1052  ListenerList GetListeners() const
1053  {
1054  return delegates.GetDelegates();
1055  }
1056 
1057  bool HasListeners() const
1058  {
1059  return !delegates.IsEmpty();
1060  }
1061 
1062  bool IsEmpty() const
1063  {
1064  return delegates.IsEmpty();
1065  }
1066 
1067  protected:
1068 
1070 
1071  };
1072 
1073 } // namespace berry
1074 
1075 #endif /*BERRYMESSAGE_H_*/
static MsgHandler handler
Definition: usUtils.cpp:261
void AddListener(const AbstractDelegate &delegate) const
Definition: berryMessage.h:799
AbstractExceptionHandler * GetExceptionHandler() const
Definition: berryMessage.h:834
virtual A Execute(T t, U u) const
Definition: berryMessage.h:236
bool HasListeners() const
Definition: berryMessage.h:844
DelegateList< AbstractDelegate >::ListType ListenerList
Definition: berryMessage.h:797
bool HasListeners() const
void operator-=(const AbstractDelegate &delegate) const
Definition: berryMessage.h:814
void operator()(T t, U u) const
Definition: berryMessage.h:895
AbstractExceptionHandler * GetExceptionHandler() const
MessageDelegate3(R *object, A(R::*memberFunctionPointer)(T, U, V))
Definition: berryMessage.h:272
virtual MessageAbstractDelegate3 * Clone() const =0
void Add(const Delegate &d) const
Definition: berryMessage.h:421
void operator()() const
Definition: berryMessage.h:753
virtual bool operator==(const MessageAbstractDelegate1 *cmd)=0
void SetExceptionHandler(const AbstractExceptionHandler &handler)
Definition: berryMessage.h:659
DelegateList< AbstractDelegate > delegates
Definition: berryMessage.h:927
void Send(T t) const
Definition: berryMessage.h:819
void operator-=(const AbstractDelegate &delegate) const
Definition: berryMessage.h:885
void operator()(T t) const
Definition: berryMessage.h:824
MessageAbstractDelegate3< T, U, V, A > AbstractDelegate
Definition: berryMessage.h:938
void operator()(T t, U u, V v, W w) const
void SetExceptionHandler(const AbstractExceptionHandler &handler)
Definition: berryMessage.h:829
bool IsEmpty() const
Definition: berryMessage.h:920
void AddListener(const AbstractDelegate &delegate) const
Definition: berryMessage.h:728
void Send2(T t, U u) const
Definition: berryMessage.h:540
MessageDelegate(R *object, A(R::*memberFunctionPointer)())
Definition: berryMessage.h:134
AbstractExceptionHandler * Clone() const override
Definition: berryMessage.h:383
DelegateList< AbstractDelegate > delegates
Definition: berryMessage.h:856
virtual A Execute(T t, U u, V v, W w) const
Definition: berryMessage.h:329
bool HasListeners() const
Definition: berryMessage.h:773
virtual bool operator==(const MessageAbstractDelegate3 *cmd)=0
virtual A Execute(T t, U u, V v) const =0
void Send3(T t, U u, V v) const
Definition: berryMessage.h:580
MessageDelegate4(R *object, A(R::*memberFunctionPointer)(T, U, V, W))
Definition: berryMessage.h:319
bool IsEmpty() const
Definition: berryMessage.h:778
bool IsEmpty() const
Definition: berryMessage.h:991
virtual bool operator==(const MessageAbstractDelegate4 *cmd)=0
AbstractExceptionHandler * GetExceptionHandler() const
Definition: berryMessage.h:763
MessageAbstractDelegate4< T, U, V, W, A > * Clone() const
Definition: berryMessage.h:348
void SetExceptionHandler(const AbstractExceptionHandler &handler)
Definition: berryMessage.h:900
AbstractExceptionHandler * GetExceptionHandler() const
Definition: berryMessage.h:905
virtual MessageAbstractDelegate2 * Clone() const =0
void Send(T t, U u) const
Definition: berryMessage.h:890
std::vector< Delegate * > ListType
Definition: berryMessage.h:402
MessageDelegate2(R *object, A(R::*memberFunctionPointer)(T, U))
Definition: berryMessage.h:226
AbstractExceptionHandler * GetExceptionHandler() const
Definition: berryMessage.h:976
DelegateList< AbstractDelegate >::ListType ListenerList
Definition: berryMessage.h:726
DelegateList< AbstractDelegate >::ListType ListenerList
Definition: berryMessage.h:868
void SetExceptionHandler(const AbstractExceptionHandler &handler)
virtual bool operator==(const MessageAbstractDelegate *cmd)=0
bool operator==(const MessageAbstractDelegate1< T, A > *c)
Definition: berryMessage.h:195
bool IsEmpty() const
MessageAbstractDelegate< A > * Clone() const
Definition: berryMessage.h:163
void operator-=(const AbstractDelegate &delegate) const
Definition: berryMessage.h:743
virtual A Execute(T t, U u, V v, W w) const =0
ListenerList GetListeners() const
Definition: berryMessage.h:910
virtual A Execute(T t, U u) const =0
void RemoveListener(const AbstractDelegate &delegate) const
Definition: berryMessage.h:738
MessageDelegate1(R *object, A(R::*memberFunctionPointer)(T))
Definition: berryMessage.h:180
void SetExceptionHandler(const AbstractExceptionHandler &handler)
Definition: berryMessage.h:971
bool IsEmpty() const
Definition: berryMessage.h:453
bool HasListeners() const
Definition: berryMessage.h:915
MessageAbstractDelegate4< T, U, V, W, A > AbstractDelegate
void operator+=(const AbstractDelegate &delegate) const
Definition: berryMessage.h:804
DelegateList< AbstractDelegate > delegates
void SetExceptionHandler(const AbstractExceptionHandler &handler)
Definition: berryMessage.h:758
void Send0(Dummy) const
Definition: berryMessage.h:459
bool operator==(const MessageAbstractDelegate3< T, U, V, A > *c)
Definition: berryMessage.h:287
ListenerList GetListeners() const
Definition: berryMessage.h:981
bool HasListeners() const
Definition: berryMessage.h:986
MessageAbstractDelegate2< T, U, A > * Clone() const
Definition: berryMessage.h:255
MessageExceptionHandler(R *r, HandleExceptionCallback c)
Definition: berryMessage.h:373
void Send(T t, U u, V v) const
Definition: berryMessage.h:961
MessageAbstractDelegate< A > AbstractDelegate
Definition: berryMessage.h:725
virtual A Execute(T t)
Definition: berryMessage.h:190
MessageAbstractDelegate1< T, A > AbstractDelegate
Definition: berryMessage.h:796
virtual MessageAbstractDelegate1 * Clone() const =0
void operator+=(const AbstractDelegate &delegate) const
virtual A Execute(T t, U u, V v) const
Definition: berryMessage.h:282
void RemoveListener(const AbstractDelegate &delegate) const
Definition: berryMessage.h:951
MessageAbstractDelegate2< T, U, A > AbstractDelegate
Definition: berryMessage.h:867
void Send(T t, U u, V v, W w) const
void operator+=(const AbstractDelegate &delegate) const
Definition: berryMessage.h:875
void Send1(T t) const
Definition: berryMessage.h:500
void RemoveListener(const AbstractDelegate &delegate) const
Definition: berryMessage.h:809
virtual MessageAbstractDelegate * Clone() const =0
void operator-=(const AbstractDelegate &delegate) const
ListenerList GetListeners() const
void Send4(T t, U u, V v, W w) const
Definition: berryMessage.h:620
ListType GetDelegates() const
Definition: berryMessage.h:673
ListenerList GetListeners() const
Definition: berryMessage.h:839
DelegateList< AbstractDelegate > delegates
Definition: berryMessage.h:785
virtual void HandleException(const std::exception &exc)=0
MessageAbstractDelegate1< T, A > * Clone() const
Definition: berryMessage.h:209
DelegateList< AbstractDelegate > delegates
Definition: berryMessage.h:998
virtual MessageAbstractDelegate4 * Clone() const =0
void operator()(T t, U u, V v) const
Definition: berryMessage.h:966
bool operator==(const MessageAbstractDelegate4< T, U, V, W, A > *c)
Definition: berryMessage.h:334
void(R::* HandleExceptionCallback)(const std::exception &)
Definition: berryMessage.h:371
Event/message/notification class.
Definition: berryMessage.h:720
virtual AbstractExceptionHandler * Clone() const =0
MessageAbstractDelegate3< T, U, V, A > * Clone() const
Definition: berryMessage.h:301
void HandleException(const std::exception &exc) override
Definition: berryMessage.h:378
void Send() const
Definition: berryMessage.h:748
void AddListener(const AbstractDelegate &delegate) const
void AddListener(const AbstractDelegate &delegate) const
Definition: berryMessage.h:870
void RemoveListener(const AbstractDelegate &delegate) const
DelegateList< AbstractDelegate >::ListType ListenerList
Definition: berryMessage.h:939
void operator-=(const AbstractDelegate &delegate) const
Definition: berryMessage.h:956
bool IsEmpty() const
Definition: berryMessage.h:849
void operator+=(const AbstractDelegate &delegate) const
Definition: berryMessage.h:733
void RemoveListener(const AbstractDelegate &delegate) const
Definition: berryMessage.h:880
void AddListener(const AbstractDelegate &delegate) const
Definition: berryMessage.h:941
bool operator==(const MessageAbstractDelegate< A > *c)
Definition: berryMessage.h:149
void Remove(const Delegate &d) const
Definition: berryMessage.h:438
DelegateList< AbstractDelegate >::ListType ListenerList
AbstractExceptionHandler * GetExceptionHandler() const
Definition: berryMessage.h:666
virtual bool operator==(const MessageAbstractDelegate2 *cmd)=0
bool operator==(const MessageAbstractDelegate2< T, U, A > *c)
Definition: berryMessage.h:241
ListenerList GetListeners() const
Definition: berryMessage.h:768
void operator+=(const AbstractDelegate &delegate) const
Definition: berryMessage.h:946