From b9fa14fbb05d7c90eacba39bd4185a64ae9d1e95 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Fri, 27 Jul 2018 16:26:16 +0200 Subject: [PATCH] #3204 crea Feature New Normal branch mingw64 --- CMakeLists.txt | 2 +- src/creaMessageManager.cxx | 2 +- src/creaMessageManager.h | 182 ++++++++++++------------------------- src/creaVtk.h | 8 +- src/creaVtk.txx | 2 +- 5 files changed, 65 insertions(+), 131 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c256e1d..138764e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,7 @@ MARK_AS_ADVANCED( LIBRARY_OUTPUT_PATH ) -SET (BOOST_FILESYSTEM_VERSION 2) +## SET (BOOST_FILESYSTEM_VERSION 2) #----------------------------------------------------------------------------- # messages compilation options diff --git a/src/creaMessageManager.cxx b/src/creaMessageManager.cxx index ae10284..fa24abd 100644 --- a/src/creaMessageManager.cxx +++ b/src/creaMessageManager.cxx @@ -173,7 +173,7 @@ namespace crea //=========================================================================== //=========================================================================== - void MessageManager::SendMessage(const std::string& key, const std::string& mess) + void MessageManager::HSendMessage(const std::string& key, const std::string& mess) { if (GetInstance()->mSendToCout) { diff --git a/src/creaMessageManager.h b/src/creaMessageManager.h index 4896599..54dd93e 100644 --- a/src/creaMessageManager.h +++ b/src/creaMessageManager.h @@ -61,6 +61,7 @@ \brief Manages the messages displayed by crea */ + #ifndef __creaMessageManager_h__ #define __creaMessageManager_h__ @@ -75,6 +76,58 @@ #include #include #include + + + +namespace crea +{ + class CREA_EXPORT MessageManager + { + public: + //============================================= + typedef boost::signals2::signal 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 HSendMessage(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; + }; + //=========================================================== +} + + + + + + + + // Comment out these symbols to prevent compilation //#define CREA_COMPILE_MESSAGES //#define CREA_COMPILE_DEBUG_MESSAGES @@ -129,7 +182,7 @@ << creaMessageTab \ << creaMessageSpace(value) \ << MESSAGE; \ - crea::MessageManager::SendMessage(key,s.str()); \ + crea::MessageManager::HSendMessage(key,s.str()); \ } \ } \ while (0) @@ -145,7 +198,7 @@ { \ std::ostringstream s; \ s << MESSAGE; \ - crea::MessageManager::SendMessage(key,s.str()); \ + crea::MessageManager::HSendMessage(key,s.str()); \ } \ } \ while (0) @@ -159,7 +212,7 @@ << creaMessageTab \ << creaMessageSpace(value) \ << MESSAGE; \ - crea::MessageManager::SendMessage(key,s.str()); \ + crea::MessageManager::HSendMessage(key,s.str()); \ crea::MessageManager::IncTab(); \ } \ } \ @@ -177,7 +230,7 @@ << creaMessageTab \ << creaMessageSpace(value) \ << MESSAGE; \ - crea::MessageManager::SendMessage(key,s.str()); \ + crea::MessageManager::HSendMessage(key,s.str()); \ } \ } \ while (0) @@ -374,127 +427,6 @@ -namespace crea - -{ - - - - class CREA_EXPORT MessageManager - - { - - public: - - //============================================= - - typedef boost::signals2::signal 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; - - }; - - //=========================================================== - - - -} diff --git a/src/creaVtk.h b/src/creaVtk.h index 636cf5c..c1b3c02 100644 --- a/src/creaVtk.h +++ b/src/creaVtk.h @@ -36,13 +36,15 @@ namespace crea { - template - - CREA_EXPORT vtkImageData* NewVtkImageDataFromRaw( T* data, + + template + /*CREA_EXPORT*/ vtkImageData* NewVtkImageDataFromRaw( T* data, int nx, int ny, int nz, bool do_not_desalloc = true); + + /* // Already provided by vtkTypeTraits::VTKTypeID() template diff --git a/src/creaVtk.txx b/src/creaVtk.txx index 91c250b..c83e758 100644 --- a/src/creaVtk.txx +++ b/src/creaVtk.txx @@ -46,7 +46,7 @@ #include namespace crea { - template + template /*CREA_EXPORT*/ vtkImageData* NewVtkImageDataFromRaw( T* data, int nx, int ny, -- 2.49.0