]> Creatis software - crea.git/blobdiff - src/creaMessageManager.h
*** empty log message ***
[crea.git] / src / creaMessageManager.h
index 87fb5f887c9773b5120c2ec75cb8f213de3ef58e..9fbaae5be932bca8f282d99d4422039481da9c90 100644 (file)
-
-
 /*! \file
 /*! \file
-
-
   \brief Class creaMessageManager and Macros for outputing messages in crea
   \brief Class creaMessageManager and Macros for outputing messages in crea
-
-
-
   There are 4 kinds of messages :
   There are 4 kinds of messages :
-
   - Messages (normal messages)
   - Messages (normal messages)
-
   - Debug messages (not compiled in release)
   - Debug messages (not compiled in release)
-
   - Warnings 
   - Warnings 
-
   - Errors
   - Errors
-
   There are also "types" of messages which are strings which identify the nature of the message 
   There are also "types" of messages which are strings which identify the nature of the message 
-
   (for example : "Kernel" messages are generated by the core classes of the library, there can be a type of 
   (for example : "Kernel" messages are generated by the core classes of the library, there can be a type of 
-
   message for each type of Node, and so on...)
   message for each type of Node, and so on...)
-
   A type of message must be declared by registering it into the MessageManager. This is done by a line like :
   A type of message must be declared by registering it into the MessageManager. This is done by a line like :
-
   crea::MessageManager::RegisterMessageType("Kernel","Messages generated by the core classes of the library",5);
   crea::MessageManager::RegisterMessageType("Kernel","Messages generated by the core classes of the library",5);
-
   where : 
   where : 
-
   -The first string is the type of the message (the category which will be used to generate a message of this type)
   -The first string is the type of the message (the category which will be used to generate a message of this type)
-
   -The second string is help string
   -The second string is help string
-
   -The integer is the initial level for the messages of this type (see below).
   -The integer is the initial level for the messages of this type (see below).
-
-  
-
   To generate a message of a known type then use one of the macros :
   To generate a message of a known type then use one of the macros :
-
   creaMessage, creaDebugMessage, creaWarning, creaError or their variants.
   creaMessage, creaDebugMessage, creaWarning, creaError or their variants.
-
-
-
   example :
   example :
-
-
-
   creaMessage("Kernel",4,"problem with "<<GetName()<<creaendl);
   creaMessage("Kernel",4,"problem with "<<GetName()<<creaendl);
-
-
-
   will push the 3rd argument in std::cout if the message level of "Kernel" messages is greater or equal to 4.
   will push the 3rd argument in std::cout if the message level of "Kernel" messages is greater or equal to 4.
-
   which means that it generates a message of level 4 (0 : very important/always displayed ... 9 : deep debug message).
   which means that it generates a message of level 4 (0 : very important/always displayed ... 9 : deep debug message).
-
-
-
   At run time, one is able to change the level of the messages displayed by using a command like :
   At run time, one is able to change the level of the messages displayed by using a command like :
-
-  
-
   crea::MessageManager::SetMessageLevel("Kernel",5); 
   crea::MessageManager::SetMessageLevel("Kernel",5); 
-
-  
-
   which tells the manager to display all Kernel messages of level up to 5.
   which tells the manager to display all Kernel messages of level up to 5.
-
-
-
   Variants :
   Variants :
-
-
-
   crea*Cont : continues a previous creaMessage on the same line (without rewriting the type and level)
   crea*Cont : continues a previous creaMessage on the same line (without rewriting the type and level)
-
   crea*Inc / Dec : displays the message and then increments/decrement the messages tabulation 
   crea*Inc / Dec : displays the message and then increments/decrement the messages tabulation 
-
-
-
 */
 
   //===========================================================
 */
 
   //===========================================================
-
   /**
   /**
-
      \class crea::MessageManager
      \class crea::MessageManager
-
      \brief Manages the messages displayed by crea
      \brief Manages the messages displayed by crea
-
   */
 
   */
 
-
-
-
-
 #ifndef __creaMessageManager_h__
 #ifndef __creaMessageManager_h__
-
 #define __creaMessageManager_h__
 
 #define __creaMessageManager_h__
 
-
-
 // The do { } while(0) statement in macros is made to "swallow the semicolon" 
 // The do { } while(0) statement in macros is made to "swallow the semicolon" 
-
 // see http://gcc.gnu.org/onlinedocs/cpp/Swallowing-the-Semicolon.html#Swallowing-the-Semicolon
 // see http://gcc.gnu.org/onlinedocs/cpp/Swallowing-the-Semicolon.html#Swallowing-the-Semicolon
-
-
-
 #include "creaSystem.h"
 #include "creaSystem.h"
-
 #include "creaRTTI.h" // for CREA_GET_CURRENT_OBJECT_NAME
 #include "creaRTTI.h" // for CREA_GET_CURRENT_OBJECT_NAME
-
 // Signal/slot mechanism for message events
 // Signal/slot mechanism for message events
-
 #include <boost/signal.hpp>
 #include <boost/signal.hpp>
-
 #include <boost/bind.hpp>
 #include <boost/bind.hpp>
-
-
-
 #include <string>
 #include <string>
-
 #include <map>
 #include <map>
-
 #include <iostream>
 #include <iostream>
-
 #include <sstream>
 #include <sstream>
-
-
-
 // Comment out these symbols to prevent compilation 
 // Comment out these symbols to prevent compilation 
-
 //#define CREA_COMPILE_MESSAGES
 //#define CREA_COMPILE_MESSAGES
-
 //#define CREA_COMPILE_DEBUG_MESSAGES
 //#define CREA_COMPILE_DEBUG_MESSAGES
-
 //#define CREA_COMPILE_WARNING_MESSAGES
 //#define CREA_COMPILE_WARNING_MESSAGES
-
 //#define CREA_COMPILE_ERROR_MESSAGES
 //#define CREA_COMPILE_ERROR_MESSAGES
-
-
-
-
-
 #define creaOnMessageLevel(key,value)                  \
   int __creaOnMessageLevelVariable =                   \
     crea::MessageManager::GetMessageLevel(key);                \
 #define creaOnMessageLevel(key,value)                  \
   int __creaOnMessageLevelVariable =                   \
     crea::MessageManager::GetMessageLevel(key);                \
     }                                                  \
   else if (value<= __creaOnMessageLevelVariable) 
 
     }                                                  \
   else if (value<= __creaOnMessageLevelVariable) 
 
-
-
 #ifdef CREA_PREPEND_MESSAGE_WITH_CODE
 #define creaMessageCode                                \
   key[0] << key[1] << key[2] << value << " "
 #ifdef CREA_PREPEND_MESSAGE_WITH_CODE
 #define creaMessageCode                                \
   key[0] << key[1] << key[2] << value << " "
 #define creaMessageCode ""
 #endif 
 
 #define creaMessageCode ""
 #endif 
 
-
-
 #ifdef CREA_PREPEND_MESSAGE_WITH_TAB
 #define creaMessageTab                         \
   crea::MessageManager::GetTab()
 #ifdef CREA_PREPEND_MESSAGE_WITH_TAB
 #define creaMessageTab                         \
   crea::MessageManager::GetTab()
 #define creaMessageTab ""
 #endif
 
 #define creaMessageTab ""
 #endif
 
-
-
 //#define CREA_PREPEND_MESSAGE_WITH_SPACE
 #ifdef CREA_PREPEND_MESSAGE_WITH_SPACE
 #define creaMessageSpace(value)                        \
 //#define CREA_PREPEND_MESSAGE_WITH_SPACE
 #ifdef CREA_PREPEND_MESSAGE_WITH_SPACE
 #define creaMessageSpace(value)                        \