00001 #ifndef IOKERNEL__IOKERNEL_MESSAGES_H 00002 #define IOKERNEL__IOKERNEL_MESSAGES_H 00003 00004 #include "iokernel_forwarders.h" 00005 00006 #ifndef SUIF_MODULE 00007 #define SUIF_MODULE "Unknown" 00008 #endif 00009 00010 class IOKernelMessage { 00011 public: 00012 static IOKernelMessage& create( const char* file_name, 00013 int line_number, 00014 const char* module_name ); 00015 00016 void assert_message( const char* format, ... ); 00017 00018 IOKernelMessage* error( ObjectFactory* of, const char* format, ... ); 00019 IOKernelMessage* warning( ObjectFactory* of, const char* format, ... ); 00020 IOKernelMessage* information( ObjectFactory* of, int verbosity_level, const char* format, ... ); 00021 protected: 00022 IOKernelMessage( const char* file_name, 00023 int line_number, 00024 const char* module_name ); 00025 00026 const char* _file_name; 00027 int _line_number; 00028 const char* _module_name; 00029 private: 00030 IOKernelMessage& operator=(const IOKernelMessage&); 00031 IOKernelMessage(const IOKernelMessage&); 00032 00033 }; 00034 00035 00042 #define kernel_assert( expr ) if (expr) ; else IOKernelMessage::create( __FILE__, __LINE__, SUIF_MODULE ).assert_message("") ; 00043 00044 00051 #define kernel_assert_message( expr, params ) if (expr) ; else IOKernelMessage::create( __FILE__, __LINE__, SUIF_MODULE ).assert_message params ; 00052 00053 00059 #define kernel_error delete IOKernelMessage::create( __FILE__, __LINE__, SUIF_MODULE ).error 00060 00061 00067 #define kernel_warning delete IOKernelMessage::create( __FILE__, __LINE__, SUIF_MODULE ).warning 00068 00069 00075 #define kernel_information delete IOKernelMessage::create( __FILE__, __LINE__, SUIF_MODULE ).information 00076 00077 00078 #endif