From 3048dcadbc42fcf6679edc959484ecd4b948eb9c Mon Sep 17 00:00:00 2001 From: Eduardo Davila Date: Wed, 16 Sep 2009 12:28:57 +0000 Subject: [PATCH] *** empty log message *** --- src/creaMessageManager.h | 952 +++++++++++++++++++++++---------------- src/creaSystem.cxx | 10 +- src/creaVtk.h | 2 +- src/creaVtk.txx | 2 +- 4 files changed, 582 insertions(+), 384 deletions(-) diff --git a/src/creaMessageManager.h b/src/creaMessageManager.h index 37fe5bf..87fb5f8 100644 --- a/src/creaMessageManager.h +++ b/src/creaMessageManager.h @@ -1,376 +1,576 @@ - -/*! \file - - \brief Class creaMessageManager and Macros for outputing messages in crea - - There are 4 kinds of messages : - - Messages (normal messages) - - Debug messages (not compiled in release) - - Warnings - - Errors - 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 - 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 : - crea::MessageManager::RegisterMessageType("Kernel","Messages generated by the core classes of the library",5); - where : - -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 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 : - creaMessage, creaDebugMessage, creaWarning, creaError or their variants. - - example : - - creaMessage("Kernel",4,"problem with "< -#include - -#include -#include -#include -#include - -// Comment out these symbols to prevent compilation -//#define CREA_COMPILE_MESSAGES -//#define CREA_COMPILE_DEBUG_MESSAGES -//#define CREA_COMPILE_WARNING_MESSAGES -//#define CREA_COMPILE_ERROR_MESSAGES - - -#define creaOnMessageLevel(key,value) \ - int __creaOnMessageLevelVariable = \ - crea::MessageManager::GetMessageLevel(key); \ - if ( __creaOnMessageLevelVariable<0) \ - { \ - creaWarning("message type '"<0) \ - { \ - std::cerr << "!! WARNING !! " << MESSAGE << std::endl; \ - if (lev >1) \ - { \ - std::cerr << "!! WARNING !! In file '"<<__FILE__ \ - <<"' ; Line "<<__LINE__< MessageSignalType; - typedef MessageSignalType::slot_function_type MessageCallbackType; - //============================================= - /// - MessageManager(); - /// - ~MessageManager(); - /// - static MessageManager* GetInstance(); - /// - static void RegisterMessageType(const std::string& key, - const std::string& help, - unsigned char default_level = 9); - /// - static void SetMessageLevel(const std::string& key, unsigned char level); - /// - static int GetMessageLevel(const std::string& key); - /// - static void SendMessage(const std::string& key, const std::string& mess); - /// - static void AddMessageObserver(const std::string& key, MessageCallbackType callback ); - /// - static void SendMessagesToCout(bool v = true); - /// - static std::string& GetTab() { static std::string s; return s; } - /// - static std::string GetSpace(int n) { - std::string s; s.insert(0," ",n); return s; } - /// - static void IncTab() { GetTab() += std::string(" "); } - /// - static void DecTab() { GetTab() = GetTab().substr(0,GetTab().length()-1); } - /// - static void ResetTab() { GetTab() = std::string(""); } - /// - static void PrintInfo(); - /// - - private: - struct MessageType - { - MessageType(int l, const std::string& h) : Level(l), Help(h) {} - int Level; - std::string Help; - MessageSignalType Signal; - }; - typedef std::map MessageMapType; - MessageMapType mMessageMap; - unsigned int mMaxMessageLength; - bool mSendToCout; - }; - //=========================================================== - -} - -#include "creaException.h" - -#endif + + +/*! \file + + + + \brief Class creaMessageManager and Macros for outputing messages in crea + + + + There are 4 kinds of messages : + + - Messages (normal messages) + + - Debug messages (not compiled in release) + + - Warnings + + - Errors + + 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 + + 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 : + + crea::MessageManager::RegisterMessageType("Kernel","Messages generated by the core classes of the library",5); + + where : + + -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 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 : + + creaMessage, creaDebugMessage, creaWarning, creaError or their variants. + + + + example : + + + + creaMessage("Kernel",4,"problem with "< + +#include + + + +#include + +#include + +#include + +#include + + + +// Comment out these symbols to prevent compilation + +//#define CREA_COMPILE_MESSAGES + +//#define CREA_COMPILE_DEBUG_MESSAGES + +//#define CREA_COMPILE_WARNING_MESSAGES + +//#define CREA_COMPILE_ERROR_MESSAGES + + + + + +#define creaOnMessageLevel(key,value) \ + int __creaOnMessageLevelVariable = \ + crea::MessageManager::GetMessageLevel(key); \ + if ( __creaOnMessageLevelVariable<0) \ + { \ + creaWarning("message type '"<0) \ + { \ + std::cerr << "!! WARNING !! " << MESSAGE << std::endl; \ + if (lev >1) \ + { \ + std::cerr << "!! WARNING !! In file '"<<__FILE__ \ + <<"' ; Line "<<__LINE__< MessageSignalType; + + typedef MessageSignalType::slot_function_type MessageCallbackType; + + //============================================= + + /// + + MessageManager(); + + /// + + ~MessageManager(); + + /// + + static MessageManager* GetInstance(); + + /// + + static void RegisterMessageType(const std::string& key, + + const std::string& help, + + unsigned char default_level = 9); + + /// + + static void SetMessageLevel(const std::string& key, unsigned char level); + + /// + + static int GetMessageLevel(const std::string& key); + + /// + + static void SendMessage(const std::string& key, const std::string& mess); + + /// + + static void AddMessageObserver(const std::string& key, MessageCallbackType callback ); + + /// + + static void SendMessagesToCout(bool v = true); + + /// + + static std::string& GetTab() { static std::string s; return s; } + + /// + + static std::string GetSpace(int n) { + + std::string s; s.insert(0," ",n); return s; } + + /// + + static void IncTab() { GetTab() += std::string(" "); } + + /// + + static void DecTab() { GetTab() = GetTab().substr(0,GetTab().length()-1); } + + /// + + static void ResetTab() { GetTab() = std::string(""); } + + /// + + static void PrintInfo(); + + /// + + + + private: + + struct MessageType + + { + + MessageType(int l, const std::string& h) : Level(l), Help(h) {} + + int Level; + + std::string Help; + + MessageSignalType Signal; + + }; + + typedef std::map MessageMapType; + + MessageMapType mMessageMap; + + unsigned int mMaxMessageLength; + + bool mSendToCout; + + }; + + //=========================================================== + + + +} + + + +#include "creaException.h" + + + +#endif + diff --git a/src/creaSystem.cxx b/src/creaSystem.cxx index 460bb7f..7225884 100644 --- a/src/creaSystem.cxx +++ b/src/creaSystem.cxx @@ -43,12 +43,9 @@ namespace crea return isatty(fileno(stdin)); } #endif -std::string System::GetDllAppPath(std::string nom){ - std::string path = "."; -#ifdef WIN32 -#endif - return path; -} + + + int System::GetAppPath(char *pname, size_t pathsize) { #ifdef LINUX @@ -171,6 +168,7 @@ int System::GetAppPath(char *pname, size_t pathsize) return -1; /* Path Lookup Failed */ } + std::string System::GetDllAppPath(std::string nomdll){ std::string path = "."; #ifdef WIN32 diff --git a/src/creaVtk.h b/src/creaVtk.h index 417438e..7302e98 100644 --- a/src/creaVtk.h +++ b/src/creaVtk.h @@ -10,7 +10,7 @@ namespace crea { template - vtkImageData* CREA_EXPORT NewVtkImageDataFromRaw( T* data, + vtkImageData* /*CREA_EXPORT*/ NewVtkImageDataFromRaw( T* data, int nx, int ny, int nz, diff --git a/src/creaVtk.txx b/src/creaVtk.txx index f0ea5be..7fd3539 100644 --- a/src/creaVtk.txx +++ b/src/creaVtk.txx @@ -19,7 +19,7 @@ namespace crea { template - vtkImageData* CREA_EXPORT NewVtkImageDataFromRaw( T* data, + vtkImageData* /*CREA_EXPORT*/ NewVtkImageDataFromRaw( T* data, int nx, int ny, int nz, -- 2.45.1