# HG changeset patch # User Sebastien Jodogne # Date 1483542647 -3600 # Node ID 66ce710b19f7dd321a831ed9e1c774b5f711222a # Parent 5a4ac5c6ef79792a1dbd55c7a6b77f498f03d042 sync diff -r 5a4ac5c6ef79 -r 66ce710b19f7 Orthanc/Core/ChunkedBuffer.cpp --- a/Orthanc/Core/ChunkedBuffer.cpp Fri Dec 16 14:47:31 2016 +0100 +++ b/Orthanc/Core/ChunkedBuffer.cpp Wed Jan 04 16:10:47 2017 +0100 @@ -2,6 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017 Osimis, Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff -r 5a4ac5c6ef79 -r 66ce710b19f7 Orthanc/Core/ChunkedBuffer.h --- a/Orthanc/Core/ChunkedBuffer.h Fri Dec 16 14:47:31 2016 +0100 +++ b/Orthanc/Core/ChunkedBuffer.h Wed Jan 04 16:10:47 2017 +0100 @@ -2,6 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017 Osimis, Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff -r 5a4ac5c6ef79 -r 66ce710b19f7 Orthanc/Core/Enumerations.cpp --- a/Orthanc/Core/Enumerations.cpp Fri Dec 16 14:47:31 2016 +0100 +++ b/Orthanc/Core/Enumerations.cpp Wed Jan 04 16:10:47 2017 +0100 @@ -2,6 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017 Osimis, Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff -r 5a4ac5c6ef79 -r 66ce710b19f7 Orthanc/Core/Enumerations.h --- a/Orthanc/Core/Enumerations.h Fri Dec 16 14:47:31 2016 +0100 +++ b/Orthanc/Core/Enumerations.h Wed Jan 04 16:10:47 2017 +0100 @@ -2,6 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017 Osimis, Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff -r 5a4ac5c6ef79 -r 66ce710b19f7 Orthanc/Core/Logging.h --- a/Orthanc/Core/Logging.h Fri Dec 16 14:47:31 2016 +0100 +++ b/Orthanc/Core/Logging.h Wed Jan 04 16:10:47 2017 +0100 @@ -2,6 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017 Osimis, Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -38,11 +39,27 @@ # error The macro ORTHANC_ENABLE_LOGGING must be defined #endif +#if !defined(ORTHANC_ENABLE_LOGGING_PLUGIN) +# if ORTHANC_ENABLE_LOGGING == 1 +# error The macro ORTHANC_ENABLE_LOGGING_PLUGIN must be defined +# else +# define ORTHANC_ENABLE_LOGGING_PLUGIN 0 +# endif +#endif + +#if ORTHANC_ENABLE_LOGGING_PLUGIN == 1 +# include +#endif + namespace Orthanc { namespace Logging { +#if ORTHANC_ENABLE_LOGGING_PLUGIN == 1 + void Initialize(OrthancPluginContext* context); +#else void Initialize(); +#endif void Finalize(); @@ -86,7 +103,41 @@ # define LOG(level) ::Orthanc::Logging::NullStream() # define VLOG(level) ::Orthanc::Logging::NullStream() -#else /* ORTHANC_ENABLE_LOGGING == 1 */ + +#elif ORTHANC_ENABLE_LOGGING_PLUGIN == 1 + +# include +# define LOG(level) ::Orthanc::Logging::InternalLogger(#level, __FILE__, __LINE__) +# define VLOG(level) ::Orthanc::Logging::InternalLogger("TRACE", __FILE__, __LINE__) + +namespace Orthanc +{ + namespace Logging + { + class InternalLogger : public boost::noncopyable + { + private: + std::string level_; + std::string message_; + + public: + InternalLogger(const char* level, + const char* file, + int line); + + ~InternalLogger(); + + InternalLogger& operator<< (const std::string& message); + + InternalLogger& operator<< (const char* message); + + InternalLogger& operator<< (int message); + }; + } +} + + +#else /* ORTHANC_ENABLE_LOGGING_PLUGIN == 0 && ORTHANC_ENABLE_LOGGING == 1 */ # include # define LOG(level) ::Orthanc::Logging::InternalLogger(#level, __FILE__, __LINE__) diff -r 5a4ac5c6ef79 -r 66ce710b19f7 Orthanc/Core/OrthancException.h --- a/Orthanc/Core/OrthancException.h Fri Dec 16 14:47:31 2016 +0100 +++ b/Orthanc/Core/OrthancException.h Wed Jan 04 16:10:47 2017 +0100 @@ -2,6 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017 Osimis, Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff -r 5a4ac5c6ef79 -r 66ce710b19f7 Orthanc/Core/PrecompiledHeaders.h --- a/Orthanc/Core/PrecompiledHeaders.h Fri Dec 16 14:47:31 2016 +0100 +++ b/Orthanc/Core/PrecompiledHeaders.h Wed Jan 04 16:10:47 2017 +0100 @@ -2,6 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017 Osimis, Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff -r 5a4ac5c6ef79 -r 66ce710b19f7 Orthanc/Core/Toolbox.cpp --- a/Orthanc/Core/Toolbox.cpp Fri Dec 16 14:47:31 2016 +0100 +++ b/Orthanc/Core/Toolbox.cpp Wed Jan 04 16:10:47 2017 +0100 @@ -2,6 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017 Osimis, Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -90,18 +91,6 @@ namespace Orthanc { - void Toolbox::USleep(uint64_t microSeconds) - { -#if defined(_WIN32) - ::Sleep(static_cast(microSeconds / static_cast(1000))); -#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__) || defined(__native_client__) - usleep(microSeconds); -#else -#error Support your platform here -#endif - } - - void Toolbox::ToUpperCase(std::string& s) { std::transform(s.begin(), s.end(), s.begin(), toupper); diff -r 5a4ac5c6ef79 -r 66ce710b19f7 Orthanc/Core/Toolbox.h --- a/Orthanc/Core/Toolbox.h Fri Dec 16 14:47:31 2016 +0100 +++ b/Orthanc/Core/Toolbox.h Wed Jan 04 16:10:47 2017 +0100 @@ -2,6 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017 Osimis, Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -78,8 +79,6 @@ namespace Toolbox { - void USleep(uint64_t microSeconds); - void ToUpperCase(std::string& s); // Inplace version void ToLowerCase(std::string& s); // Inplace version diff -r 5a4ac5c6ef79 -r 66ce710b19f7 Orthanc/Core/WebServiceParameters.cpp --- a/Orthanc/Core/WebServiceParameters.cpp Fri Dec 16 14:47:31 2016 +0100 +++ b/Orthanc/Core/WebServiceParameters.cpp Wed Jan 04 16:10:47 2017 +0100 @@ -2,6 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017 Osimis, Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -34,7 +35,6 @@ #include "WebServiceParameters.h" #include "../Core/Logging.h" -#include "../Core/Toolbox.h" #include "../Core/OrthancException.h" #if ORTHANC_SANDBOXED == 0 diff -r 5a4ac5c6ef79 -r 66ce710b19f7 Orthanc/Core/WebServiceParameters.h --- a/Orthanc/Core/WebServiceParameters.h Fri Dec 16 14:47:31 2016 +0100 +++ b/Orthanc/Core/WebServiceParameters.h Wed Jan 04 16:10:47 2017 +0100 @@ -2,6 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017 Osimis, Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff -r 5a4ac5c6ef79 -r 66ce710b19f7 Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp --- a/Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Fri Dec 16 14:47:31 2016 +0100 +++ b/Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Wed Jan 04 16:10:47 2017 +0100 @@ -2,6 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017 Osimis, Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff -r 5a4ac5c6ef79 -r 66ce710b19f7 Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.h --- a/Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.h Fri Dec 16 14:47:31 2016 +0100 +++ b/Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.h Wed Jan 04 16:10:47 2017 +0100 @@ -2,6 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017 Osimis, Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -447,7 +448,7 @@ Callback(output, url, request); return OrthancPluginErrorCode_Success; } - catch (ORTHANC_PLUGINS_GET_EXCEPTION_CLASS& e) + catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e) { return static_cast(e.GetErrorCode()); } diff -r 5a4ac5c6ef79 -r 66ce710b19f7 Orthanc/Plugins/Samples/Common/OrthancPluginException.h --- a/Orthanc/Plugins/Samples/Common/OrthancPluginException.h Fri Dec 16 14:47:31 2016 +0100 +++ b/Orthanc/Plugins/Samples/Common/OrthancPluginException.h Wed Jan 04 16:10:47 2017 +0100 @@ -2,6 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017 Osimis, Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -39,23 +40,23 @@ #if HAS_ORTHANC_EXCEPTION == 1 # include "../../../Core/OrthancException.h" -# define ORTHANC_PLUGINS_GET_ERROR_ENUMERATION ::Orthanc::ErrorCode -# define ORTHANC_PLUGINS_GET_ERROR_CODE(code) ::Orthanc::ErrorCode_ ## code -# define ORTHANC_PLUGINS_GET_EXCEPTION_CLASS ::Orthanc::OrthancException +# define ORTHANC_PLUGINS_ERROR_ENUMERATION ::Orthanc::ErrorCode +# define ORTHANC_PLUGINS_EXCEPTION_CLASS ::Orthanc::OrthancException +# define ORTHANC_PLUGINS_GET_ERROR_CODE(code) ::Orthanc::ErrorCode_ ## code #else # include -# define ORTHANC_PLUGINS_GET_ERROR_ENUMERATION ::OrthancPluginErrorCode -# define ORTHANC_PLUGINS_GET_ERROR_CODE(code) ::OrthancPluginErrorCode_ ## code -# define ORTHANC_PLUGINS_GET_EXCEPTION_CLASS ::OrthancPlugins::PluginException +# define ORTHANC_PLUGINS_ERROR_ENUMERATION ::OrthancPluginErrorCode +# define ORTHANC_PLUGINS_EXCEPTION_CLASS ::OrthancPlugins::PluginException +# define ORTHANC_PLUGINS_GET_ERROR_CODE(code) ::OrthancPluginErrorCode_ ## code #endif #define ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(code) \ - throw ORTHANC_PLUGINS_GET_EXCEPTION_CLASS(static_cast(code)); + throw ORTHANC_PLUGINS_EXCEPTION_CLASS(static_cast(code)); #define ORTHANC_PLUGINS_THROW_EXCEPTION(code) \ - throw ORTHANC_PLUGINS_GET_EXCEPTION_CLASS(ORTHANC_PLUGINS_GET_ERROR_CODE(code)); + throw ORTHANC_PLUGINS_EXCEPTION_CLASS(ORTHANC_PLUGINS_GET_ERROR_CODE(code)); #define ORTHANC_PLUGINS_CHECK_ERROR(code) \ diff -r 5a4ac5c6ef79 -r 66ce710b19f7 Orthanc/Resources/CMake/BoostConfiguration.cmake --- a/Orthanc/Resources/CMake/BoostConfiguration.cmake Fri Dec 16 14:47:31 2016 +0100 +++ b/Orthanc/Resources/CMake/BoostConfiguration.cmake Wed Jan 04 16:10:47 2017 +0100 @@ -99,6 +99,13 @@ -DBOOST_LOCALE_NO_POSIX_BACKEND=1 -DBOOST_LOCALE_NO_STD_BACKEND=1 ) + + elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten") + add_definitions( + -DBOOST_LOCALE_NO_POSIX_BACKEND=1 + -DBOOST_LOCALE_NO_STD_BACKEND=1 + ) + else() message(FATAL_ERROR "Support your platform here") endif() @@ -114,10 +121,15 @@ list(APPEND BOOST_SOURCES ${BOOST_REGEX_SOURCES} ${BOOST_SOURCES_DIR}/libs/date_time/src/gregorian/greg_month.cpp - ${BOOST_SOURCES_DIR}/libs/locale/src/encoding/codepage.cpp ${BOOST_SOURCES_DIR}/libs/system/src/error_code.cpp ) + if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten") + list(APPEND BOOST_SOURCES + ${BOOST_SOURCES_DIR}/libs/locale/src/encoding/codepage.cpp + ) + endif() + if (${CMAKE_SYSTEM_NAME} STREQUAL "PNaCl" OR ${CMAKE_SYSTEM_NAME} STREQUAL "NaCl32" OR ${CMAKE_SYSTEM_NAME} STREQUAL "NaCl64") diff -r 5a4ac5c6ef79 -r 66ce710b19f7 Orthanc/Resources/WindowsResources.py --- a/Orthanc/Resources/WindowsResources.py Fri Dec 16 14:47:31 2016 +0100 +++ b/Orthanc/Resources/WindowsResources.py Wed Jan 04 16:10:47 2017 +0100 @@ -3,6 +3,7 @@ # Orthanc - A Lightweight, RESTful DICOM Store # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics # Department, University Hospital of Liege, Belgium +# Copyright (C) 2017 Osimis, Belgium # # This program is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as