Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef MED_Utilities_HeaderFile
00029 #define MED_Utilities_HeaderFile
00030
00031 #include "MED_WrapperBase.hxx"
00032
00033 #include <iostream>
00034 #include <sstream>
00035 #include <string>
00036 #include <string.h>
00037 #include <stdexcept>
00038
00039
00040 namespace MED
00041 {
00042 class MEDWRAPPER_EXPORT PrefixPrinter
00043 {
00044 static int myCounter;
00045 bool myIsActive;
00046 public:
00047 PrefixPrinter(bool theIsActive = true);
00048 ~PrefixPrinter();
00049
00050 static std::string GetPrefix();
00051 };
00052 }
00053
00054 #ifdef _DEBUG_
00055 #define MSG(deb,msg) if(deb) std::cout<<MED::PrefixPrinter::GetPrefix()<<msg<<" ("<<__FILE__<<" ["<<__LINE__<<"])\n"
00056 #define BEGMSG(deb,msg) if(deb) std::cout<<MED::PrefixPrinter::GetPrefix()<<msg
00057 #define INITMSGA(deb,lev,msg) MED::PrefixPrinter aPrefixPrinter_##lev(deb); BEGMSG(deb,msg)
00058 #define INITMSG(deb,msg) INITMSGA(deb,,msg)
00059 #define ADDMSG(deb,msg) if(deb) std::cout<<msg
00060 #else
00061 #define MSG(deb,msg)
00062 #define BEGMSG(deb,msg)
00063 #define INITMSGA(deb,lev,msg)
00064 #define INITMSG(deb,msg)
00065 #define ADDMSG(deb,msg)
00066 #endif
00067
00068
00069 #ifndef EXCEPTION
00070
00071 #define EXCEPTION(TYPE, MSG) {\
00072 std::ostringstream aStream;\
00073 aStream<<__FILE__<<"["<<__LINE__<<"]::"<<MSG;\
00074 throw TYPE(aStream.str().c_str());\
00075 }
00076
00077 #endif
00078
00079 #endif