changeset 2057:54417b0831c4

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 29 Jun 2016 13:40:24 +0200
parents e166a902b3c4
children 43cd2ab060c7
files Core/Toolbox.cpp Core/Toolbox.h Plugins/Samples/Common/OrthancPluginCppWrapper.h Resources/CMake/BoostConfiguration.cmake
diffstat 4 files changed, 37 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Toolbox.cpp	Mon Jun 27 17:35:58 2016 +0200
+++ b/Core/Toolbox.cpp	Wed Jun 29 13:40:24 2016 +0200
@@ -111,6 +111,7 @@
 
 namespace Orthanc
 {
+#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1
   static bool finish_;
   static ServerBarrierEvent barrierEvent_;
 
@@ -188,6 +189,7 @@
     const bool stopFlag = false;
     return ServerBarrierInternal(&stopFlag);
   }
+#endif  /* ORTHANC_SANDBOXED */
 
 
   void Toolbox::ToUpperCase(std::string& s)
@@ -677,11 +679,15 @@
     return std::string(pathbuf);
   }
 
+#elif defined(ORTHANC_SANDBOXED) && ORTHANC_SANDBOXED == 1
+  // Sandboxed Orthanc, no access to the executable
+
 #else
 #error Support your platform here
 #endif
 
 
+#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1
   std::string Toolbox::GetPathToExecutable()
   {
     boost::filesystem::path p(GetPathToExecutableInternal());
@@ -694,6 +700,7 @@
     boost::filesystem::path p(GetPathToExecutableInternal());
     return boost::filesystem::absolute(p.parent_path()).string();
   }
+#endif
 
 
   static const char* GetBoostLocaleEncoding(const Encoding sourceEncoding)
--- a/Core/Toolbox.h	Mon Jun 27 17:35:58 2016 +0200
+++ b/Core/Toolbox.h	Wed Jun 29 13:40:24 2016 +0200
@@ -49,9 +49,11 @@
 
   namespace Toolbox
   {
+#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1
     ServerBarrierEvent ServerBarrier(const bool& stopFlag);
 
     ServerBarrierEvent ServerBarrier();
+#endif
 
     void ToUpperCase(std::string& s);  // Inplace version
 
@@ -77,7 +79,9 @@
                    size_t size,
                    const std::string& path);
 
+#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1
     void USleep(uint64_t microSeconds);
+#endif
 
     void RemoveFile(const std::string& path);
 
@@ -137,9 +141,11 @@
                              const std::string& content);
 #endif
 
+#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1
     std::string GetPathToExecutable();
 
     std::string GetDirectoryOfExecutable();
+#endif
 
     std::string ConvertToUtf8(const std::string& source,
                               Encoding sourceEncoding);
--- a/Plugins/Samples/Common/OrthancPluginCppWrapper.h	Mon Jun 27 17:35:58 2016 +0200
+++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.h	Wed Jun 29 13:40:24 2016 +0200
@@ -332,6 +332,24 @@
                      const std::string& uri,
                      bool applyPlugins);
 
+  inline void LogError(OrthancPluginContext* context,
+                       const std::string& message)
+  {
+    OrthancPluginLogError(context, message.c_str());
+  }
+
+  inline void LogWarning(OrthancPluginContext* context,
+                         const std::string& message)
+  {
+    OrthancPluginLogWarning(context, message.c_str());
+  }
+
+  inline void LogInfo(OrthancPluginContext* context,
+                      const std::string& message)
+  {
+    OrthancPluginLogInfo(context, message.c_str());
+  }
+
 
   namespace Internals
   {
--- a/Resources/CMake/BoostConfiguration.cmake	Mon Jun 27 17:35:58 2016 +0200
+++ b/Resources/CMake/BoostConfiguration.cmake	Wed Jun 29 13:40:24 2016 +0200
@@ -54,7 +54,8 @@
   if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
       ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR
       ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
-      ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
+      ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
+      ${CMAKE_SYSTEM_NAME} STREQUAL "PNaCl")
     list(APPEND BOOST_SOURCES
       ${BOOST_SOURCES_DIR}/libs/thread/src/pthread/once.cpp
       ${BOOST_SOURCES_DIR}/libs/thread/src/pthread/thread.cpp
@@ -65,7 +66,8 @@
       -DBOOST_LOCALE_NO_STD_BACKEND=1
       )
 
-    if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
+    if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase" OR
+        ${CMAKE_SYSTEM_NAME} STREQUAL "PNaCl")
       add_definitions(-DBOOST_HAS_SCHED_YIELD=1)
     endif()
 
@@ -119,7 +121,8 @@
     if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
         ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR
         ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
-        ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
+        ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
+        ${CMAKE_SYSTEM_NAME} STREQUAL "PNaCl")
       list(APPEND BOOST_SOURCES
         ${BOOST_SOURCES_DIR}/libs/locale/src/posix/codecvt.cpp
         ${BOOST_SOURCES_DIR}/libs/locale/src/posix/collate.cpp