Mercurial > hg > orthanc-dicomweb
changeset 178:66ce710b19f7
sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 04 Jan 2017 16:10:47 +0100 |
parents | 5a4ac5c6ef79 |
children | 7f772fb832bb |
files | Orthanc/Core/ChunkedBuffer.cpp Orthanc/Core/ChunkedBuffer.h Orthanc/Core/Enumerations.cpp Orthanc/Core/Enumerations.h Orthanc/Core/Logging.h Orthanc/Core/OrthancException.h Orthanc/Core/PrecompiledHeaders.h Orthanc/Core/Toolbox.cpp Orthanc/Core/Toolbox.h Orthanc/Core/WebServiceParameters.cpp Orthanc/Core/WebServiceParameters.h Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Orthanc/Plugins/Samples/Common/OrthancPluginCppWrapper.h Orthanc/Plugins/Samples/Common/OrthancPluginException.h Orthanc/Resources/CMake/BoostConfiguration.cmake Orthanc/Resources/WindowsResources.py |
diffstat | 16 files changed, 88 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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
--- 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
--- 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
--- 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 <orthanc/OrthancCPlugin.h> +#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 <boost/noncopyable.hpp> +# 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 <boost/thread/mutex.hpp> # define LOG(level) ::Orthanc::Logging::InternalLogger(#level, __FILE__, __LINE__)
--- 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
--- 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
--- 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<DWORD>(microSeconds / static_cast<uint64_t>(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);
--- 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
--- 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
--- 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
--- 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
--- 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<OrthancPluginErrorCode>(e.GetErrorCode()); }
--- 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 <orthanc/OrthancCPlugin.h> -# 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<ORTHANC_PLUGINS_GET_ERROR_ENUMERATION>(code)); + throw ORTHANC_PLUGINS_EXCEPTION_CLASS(static_cast<ORTHANC_PLUGINS_ERROR_ENUMERATION>(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) \
--- 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")
--- 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