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