changeset 588:a0001c222b32

refactoring of samples
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 02 Oct 2013 15:00:18 +0200
parents 8b6ae96125dc
children 5c7e113b007a
files OrthancCppClient/SharedLibrary/AUTOGENERATED/OrthancCppClient.h Resources/Samples/OrthancCppClientStandalone/Basic/Build.sh Resources/Samples/OrthancCppClientStandalone/Basic/CMakeLists.txt Resources/Samples/OrthancCppClientStandalone/Basic/main.cpp Resources/Samples/OrthancCppClientStandalone/Vtk/main.cpp
diffstat 5 files changed, 18 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancCppClient/SharedLibrary/AUTOGENERATED/OrthancCppClient.h	Wed Oct 02 14:34:55 2013 +0200
+++ b/OrthancCppClient/SharedLibrary/AUTOGENERATED/OrthancCppClient.h	Wed Oct 02 15:00:18 2013 +0200
@@ -81,9 +81,9 @@
 
 /* cf. http://sourceforge.net/p/predef/wiki/Architectures/ */
 #ifdef __amd64__
-#define LAAW_ORTHANC_CLIENT_DEFAULT_PATH  "libOrthancClient.so.0.6"
+#define LAAW_ORTHANC_CLIENT_DEFAULT_PATH  "libOrthancClient.so"
 #else
-#define LAAW_ORTHANC_CLIENT_DEFAULT_PATH  "libOrthancClient.so.0.6"
+#define LAAW_ORTHANC_CLIENT_DEFAULT_PATH  "libOrthancClient.so"
 #endif
 
 #define LAAW_ORTHANC_CLIENT_CALL_CONV
@@ -522,9 +522,9 @@
     bool isReference_;
     void* pimpl_;
     OrthancConnection(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
+  public:
     OrthancConnection(const OrthancConnection& other) { *this = other; }
     void operator= (const OrthancConnection& other) { if (!other.isReference_) throw ::OrthancClient::OrthancClientException("Cannot copy a non-reference object"); pimpl_ = other.pimpl_; isReference_ = true;  }
-  public:
     inline OrthancConnection(const ::std::string& orthancUrl);
     inline OrthancConnection(const ::std::string& orthancUrl, const ::std::string& username, const ::std::string& password);
     inline ~OrthancConnection();
@@ -552,9 +552,9 @@
     bool isReference_;
     void* pimpl_;
     Patient(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
+  public:
     Patient(const Patient& other) { *this = other; }
     void operator= (const Patient& other) { if (!other.isReference_) throw ::OrthancClient::OrthancClientException("Cannot copy a non-reference object"); pimpl_ = other.pimpl_; isReference_ = true;  }
-  public:
     inline Patient(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
     inline ~Patient();
     inline void Reload();
@@ -577,9 +577,9 @@
     bool isReference_;
     void* pimpl_;
     Series(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
+  public:
     Series(const Series& other) { *this = other; }
     void operator= (const Series& other) { if (!other.isReference_) throw ::OrthancClient::OrthancClientException("Cannot copy a non-reference object"); pimpl_ = other.pimpl_; isReference_ = true;  }
-  public:
     inline Series(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
     inline ~Series();
     inline void Reload();
@@ -611,9 +611,9 @@
     bool isReference_;
     void* pimpl_;
     Study(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
+  public:
     Study(const Study& other) { *this = other; }
     void operator= (const Study& other) { if (!other.isReference_) throw ::OrthancClient::OrthancClientException("Cannot copy a non-reference object"); pimpl_ = other.pimpl_; isReference_ = true;  }
-  public:
     inline Study(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
     inline ~Study();
     inline void Reload();
@@ -636,9 +636,9 @@
     bool isReference_;
     void* pimpl_;
     Instance(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
+  public:
     Instance(const Instance& other) { *this = other; }
     void operator= (const Instance& other) { if (!other.isReference_) throw ::OrthancClient::OrthancClientException("Cannot copy a non-reference object"); pimpl_ = other.pimpl_; isReference_ = true;  }
-  public:
     inline Instance(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
     inline ~Instance();
     inline ::std::string GetId() const;
--- a/Resources/Samples/OrthancCppClientStandalone/Basic/Build.sh	Wed Oct 02 14:34:55 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-rm -rf i w32 w64
-mkdir i
-mkdir w32
-mkdir w64
-
-cd i && cmake .. && cd .. && \
-    cd w32 && cmake .. -DCMAKE_TOOLCHAIN_FILE=../../../../Resources/MinGWToolchain.cmake && cd .. && \
-    cd w64 && cmake .. -DCMAKE_TOOLCHAIN_FILE=../../../../Resources/MinGW64Toolchain.cmake && cd ..
-
-make -C i -j12
-make -C w32 -j12
-make -C w64 -j12
-
-# nm -C -D --defined-only i/libOrthancCppClient.so 
--- a/Resources/Samples/OrthancCppClientStandalone/Basic/CMakeLists.txt	Wed Oct 02 14:34:55 2013 +0200
+++ b/Resources/Samples/OrthancCppClientStandalone/Basic/CMakeLists.txt	Wed Oct 02 15:00:18 2013 +0200
@@ -8,6 +8,4 @@
   # Linking with "pthread" is necessary, otherwise the software crashes
   # http://sourceware.org/bugzilla/show_bug.cgi?id=10652#c17
   target_link_libraries(Test pthread dl)
-else()
-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
 endif()
--- a/Resources/Samples/OrthancCppClientStandalone/Basic/main.cpp	Wed Oct 02 14:34:55 2013 +0200
+++ b/Resources/Samples/OrthancCppClientStandalone/Basic/main.cpp	Wed Oct 02 15:00:18 2013 +0200
@@ -26,18 +26,15 @@
 
 
 #include <iostream>
-
-#include "../../../../OrthancCppClient/Package/AUTOGENERATED/OrthancClient.h"
+#include <orthanc/OrthancCppClient.h>
 
 int main()
 {
   try
   {
-#ifdef _WIN32
-    OrthancClient::Initialize("libOrthancCppClient.dll");
-#else
-    OrthancClient::Initialize("libOrthancCppClient.so");
-#endif
+    // The following explicit initialization is not required, except
+    // if you wish to specify the full path to the shared library
+    OrthancClient::Initialize();
 
     // Display the content of the local Orthanc instance
     OrthancClient::OrthancConnection orthanc("http://localhost:8042");
@@ -65,6 +62,8 @@
       }
     }
 
+    OrthancClient::Finalize();
+
     return 0;
   }
   catch (OrthancClient::OrthancClientException e)
--- a/Resources/Samples/OrthancCppClientStandalone/Vtk/main.cpp	Wed Oct 02 14:34:55 2013 +0200
+++ b/Resources/Samples/OrthancCppClientStandalone/Vtk/main.cpp	Wed Oct 02 15:00:18 2013 +0200
@@ -39,7 +39,7 @@
 #include <vtkOpenGLRenderer.h>
 #include <vtkInteractorStyleTrackballCamera.h>
 
-#include "../../../../OrthancCppClient/Package/AUTOGENERATED/OrthancClient.h"
+#include <orthanc/OrthancCppClient.h>
 
 
 void Display(OrthancClient::Series& series)
@@ -121,7 +121,9 @@
 {
   try
   {
-    OrthancClient::Initialize("libOrthancCppClient.so");
+    // The following explicit initialization is not required, except
+    // if you wish to specify the full path to the shared library
+    OrthancClient::Initialize();
 
     // Use the commented code below if you know the identifier of a
     // series that corresponds to a 3D image.
@@ -129,7 +131,7 @@
     /*
       {
       OrthancClient::OrthancConnection orthanc("http://localhost:8042");
-      OrthancClient::Series series(orthanc, "c1c4cb95-05e3bd11-8da9f5bb-87278f71-0b2b43f5");
+      OrthancClient::Series series(orthanc, "dc5ec3d9-6e1a7b2c-73a829f0-64c609f6-ef976a97");
       Display(series);
       return 0;
       }