00001 #ifndef ILLEGAL_SEND_ERROR_H 00002 #define ILLEGAL_SEND_ERROR_H 00003 00023 #include <string> 00024 #include <sstream> 00025 #include <typeinfo> 00026 #include <stdexcept> 00027 00058 template<typename EvType> 00059 class EventSender<EvType>::IllegalSendError 00060 : public std::logic_error 00061 { 00062 public: 00064 IllegalSendError() : std::logic_error( msg() ) {} 00065 00066 private: 00068 static std::string nl() throw() { return "\n!!! "; } 00069 00071 static std::string msg() 00072 { 00073 std::ostringstream ss; 00074 ss << nl() << "BUG alert (Recursive send forbidden): " 00075 << nl() << "Method send() of " << typeid(EventSender<EvType>).name() 00076 << nl() << "calls itself indirectly through listeners" 00077 << nl() << "(forbidden since could lead to infinite loop)."; 00078 return ss.str(); 00079 } 00080 }; 00081 00082 #endif // ILLEGAL_SEND_ERROR_H