00001 /* 00002 $URL: https://repos.deltares.nl/repos/openda/openda_1/public/trunk/openda_core/native/src/cta/cta_interface.c $ 00003 $Revision: 671 $, $Date: 2008-10-07 14:49:42 +0200 (di, 07 okt 2008) $ 00004 00005 COSTA: Problem solving environment for data assimilation 00006 Copyright (C) 2005 Nils van Velzen 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Lesser General Public 00010 License as published by the Free Software Foundation; either 00011 version 2.1 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Lesser General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public 00019 License along with this library; if not, write to the Free Software 00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 */ 00022 00023 #ifndef CTA_MESSAGE_H 00024 #define CTA_MESSAGE_H 00025 #include "cta_functions.h" 00026 00027 00028 #ifdef __cplusplus 00029 extern "C" { 00030 #endif 00031 00032 /** \brief Write a message 00033 * 00034 * \param className I name of class that writes the message 00035 * \param method I name of the method that writes the message 00036 * \param message I message 00037 * \param type I type of message 00038 * -'M':message 00039 * -'I':Info 00040 * -'W':Warning 00041 * -'E':Error 00042 * -'F':Fatal error (will terminate application) 00043 */ 00044 CTAEXPORT void CTA_Message_Write(const char *className, const char *method, const char *message, char type); 00045 00046 /** \brief Set an external writer for handling messages 00047 * 00048 * An external writer must comply to the following C interface: 00049 * 00050 * void my_writer(char *className, char *method, char *message, char type); 00051 * 00052 * \param externalWriter I External writer 00053 * 00054 * 00055 * \note Fortran writers are not yet supported 00056 */ 00057 CTAEXPORT void CTA_Message_SetExternalWriter(CTA_Func externalWriter); 00058 00059 00060 /** \brief Toggle message handler between quiet and normal mode. 00061 * in the quiet mode no messages are send (not even to external writers) 00062 * 00063 * \param setting I set message handler in quiet mode CTA_TRUE/CTA_FALSE 00064 * 00065 */ 00066 CTAEXPORT void CTA_Message_Quiet(int setting); 00067 00068 00069 /** \brief Macro for writing errors 00070 * 00071 * The name of the class and the method name must be set by the defines CLSNAM and METHOD 00072 * 00073 * \param message I Error message 00074 * 00075 */ 00076 #define CTA_WRITE_ERROR(message) CTA_Message_Write(CLASSNAME,METHOD,message,'E') 00077 00078 /** \brief Macro for writing info messages 00079 * 00080 * The name of the class and the method name must be set by the defines CLSNAM and METHOD 00081 * 00082 * \param message I Info message 00083 * 00084 */ 00085 #define CTA_WRITE_INFO(message) CTA_Message_Write(CLASSNAME,METHOD,message,'I') 00086 00087 /** \brief Macro for writing warnings 00088 * 00089 * The name of the class and the method name must be set by the defines CLSNAM and METHOD 00090 * 00091 * \param message I Warning message 00092 * 00093 */ 00094 #define CTA_WRITE_WARNING(message) CTA_Message_Write(CLASSNAME,METHOD,message,'W') 00095 00096 #ifdef __cplusplus 00097 } 00098 #endif 00099 #endif 00100