changeset 587:8b6ae96125dc

removal of old samples
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 02 Oct 2013 14:34:55 +0200
parents 0cef1adc0560
children a0001c222b32
files Resources/Samples/RestApi/CMakeLists.txt Resources/Samples/RestApi/Sample.cpp Resources/Samples/RestApiLinuxDynamic/AutoGeneratedCode.cmake Resources/Samples/RestApiLinuxDynamic/CMakeLists.txt Resources/Samples/RestApiLinuxDynamic/README.txt Resources/Samples/RestApiLinuxDynamic/Sample.cpp
diffstat 6 files changed, 0 insertions(+), 423 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/Samples/RestApi/CMakeLists.txt	Wed Oct 02 14:22:04 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-
-project(RestApiSample)
-
-include(ExternalProject)
-
-# Send the toolchain information to the Orthanc 
-if (CMAKE_TOOLCHAIN_FILE)
-  set(TOOLCHAIN "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
-endif()
-
-ExternalProject_Add(
-  ORTHANC_CORE
-
-  # We use the Orthanc-0.3.1 branch for this sample
-  DOWNLOAD_COMMAND hg clone https://code.google.com/p/orthanc/ -r Orthanc-0.3.1
-
-  # Optional step, to reuse the third-party downloads
-  PATCH_COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/../../../ThirdPartyDownloads ThirdPartyDownloads
-
-  PREFIX ${CMAKE_BINARY_DIR}/Orthanc/
-  UPDATE_COMMAND ""
-  SOURCE_DIR ${CMAKE_BINARY_DIR}/Orthanc/src/orthanc/
-  CMAKE_COMMAND ${CMAKE_COMMAND}
-  CMAKE_ARGS -DSTATIC_BUILD=ON -DSTANDALONE_BUILD=ON -DUSE_DYNAMIC_GOOGLE_LOG=OFF -DUSE_DYNAMIC_SQLITE=OFF -DENABLE_SSL=OFF ${TOOLCHAIN}
-  BUILD_COMMAND $(MAKE) CoreLibrary
-  INSTALL_COMMAND ""
-  BUILD_IN_SOURCE 0
-  )
-
-ExternalProject_Get_Property(ORTHANC_CORE source_dir)
-include_directories(${source_dir})
-
-ExternalProject_Get_Property(ORTHANC_CORE binary_dir)
-link_directories(${binary_dir})
-include_directories(${binary_dir}/jsoncpp-src-0.5.0/include)
-include_directories(${binary_dir}/glog-0.3.2/src)
-include_directories(${binary_dir}/boost_1_49_0)
-
-
-add_executable(RestApiSample
-  Sample.cpp
-  )
-
-add_dependencies(RestApiSample ORTHANC_CORE)
-
-target_link_libraries(RestApiSample 
-  # From Orthanc
-  CoreLibrary
-  GoogleLog
-
-  # These two libraries are not necessary
-  #OpenSSL
-  #Curl
-  )
-
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
-  target_link_libraries(RestApiSample pthread)
-elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
-  add_definitions(-DGOOGLE_GLOG_DLL_DECL=)
-  target_link_libraries(RestApiSample wsock32)
-endif()
--- a/Resources/Samples/RestApi/Sample.cpp	Wed Oct 02 14:22:04 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/**
- * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
- * Belgium
- *
- * This program is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * In addition, as a special exception, the copyright holders of this
- * program give permission to link the code of its release with the
- * OpenSSL project's "OpenSSL" library (or with modified versions of it
- * that use the same license as the "OpenSSL" library), and distribute
- * the linked executables. You must obey the GNU General Public License
- * in all respects for all of the code used other than "OpenSSL". If you
- * modify file(s) with this exception, you may extend this exception to
- * your version of the file(s), but you are not obligated to do so. If
- * you do not wish to do so, delete this exception statement from your
- * version. If you delete this exception statement from all source files
- * in the program, then also delete it here.
- * 
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- **/
-
-
-#include <Core/HttpServer/MongooseServer.h>
-#include <Core/RestApi/RestApi.h>
-#include <Core/Toolbox.h>
-#include <glog/logging.h>
-#include <stdio.h>
-
-
-/**
- * This is a demo program that shows how to setup a REST server with
- * the Orthanc Core API. Once the server is running, here are some 
- * sample command lines to interact with it:
- * 
- *  # curl http://localhost:8042
- *  # curl 'http://localhost:8042?name=Hide'
- *  # curl http://localhost:8042 -X DELETE
- *  # curl http://localhost:8042 -X PUT -d "PutBody"
- *  # curl http://localhost:8042 -X POST -d "PostBody"
- **/
-
-static void GetRoot(Orthanc::RestApi::GetCall& call)
-{
-  std::string answer = "Hello world\n";
-  answer += "Glad to meet you, Mr. " + call.GetArgument("name", "Nobody") + "\n";
-  call.GetOutput().AnswerBuffer(answer, "text/plain");
-}
- 
-static void DeleteRoot(Orthanc::RestApi::DeleteCall& call)
-{
-  call.GetOutput().AnswerBuffer("Hey, you have just deleted the server!\n",
-                                "text/plain");
-}
- 
-static void PostRoot(Orthanc::RestApi::PostCall& call)
-{
-  call.GetOutput().AnswerBuffer("I have received a POST with body: [" +
-                                call.GetPostBody() + "]\n", "text/plain");
-}
- 
-static void PutRoot(Orthanc::RestApi::PutCall& call)
-{
-  call.GetOutput().AnswerBuffer("I have received a PUT with body: [" +
-                                call.GetPutBody() + "]\n", "text/plain");
-}
- 
-int main()
-{
-  // Initialize the logging mechanism
-  google::InitGoogleLogging("Orthanc");
-  FLAGS_logtostderr = true;
-  FLAGS_minloglevel = 0;                      // Use the verbose mode
-  FLAGS_v = 0;
-  
-  // Define the callbacks of the REST API
-  std::auto_ptr<Orthanc::RestApi> rest(new Orthanc::RestApi);
-  rest->Register("/", GetRoot);
-  rest->Register("/", PostRoot);
-  rest->Register("/", PutRoot);
-  rest->Register("/", DeleteRoot);
-
-  // Setup the embedded HTTP server
-  Orthanc::MongooseServer httpServer;
-  httpServer.SetPortNumber(8042);             // Use TCP port 8042
-  httpServer.SetRemoteAccessAllowed(true);    // Do not block remote requests
-  httpServer.RegisterHandler(rest.release()); // The REST API is the handler
-
-  // Start the server and wait for the user to hit "Ctrl-C"
-  httpServer.Start();
-  LOG(WARNING) << "REST server has started";
-  Orthanc::Toolbox::ServerBarrier();
-  LOG(WARNING) << "REST server has stopped";
-
-  return 0;
-}
--- a/Resources/Samples/RestApiLinuxDynamic/AutoGeneratedCode.cmake	Wed Oct 02 14:22:04 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-set(AUTOGENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/AUTOGENERATED")
-set(AUTOGENERATED_SOURCES)
-
-file(MAKE_DIRECTORY ${AUTOGENERATED_DIR})
-include_directories(${AUTOGENERATED_DIR})
-
-macro(EmbedResources)
-  # Convert a semicolon separated list to a whitespace separated string
-  set(SCRIPT_ARGUMENTS)
-  set(DEPENDENCIES)
-  set(IS_PATH_NAME false)
-  foreach(arg ${ARGN})
-    if (${IS_PATH_NAME})
-      list(APPEND SCRIPT_ARGUMENTS "${arg}")
-      list(APPEND DEPENDENCIES "${arg}")
-      set(IS_PATH_NAME false)
-    else()
-      list(APPEND SCRIPT_ARGUMENTS "${arg}")
-      set(IS_PATH_NAME true)
-    endif()
-  endforeach()
-
-  set(TARGET_BASE "${AUTOGENERATED_DIR}/EmbeddedResources")
-  add_custom_command(
-    OUTPUT
-    "${TARGET_BASE}.h"
-    "${TARGET_BASE}.cpp"
-    COMMAND 
-    python
-    "${ORTHANC_DIR}/Resources/EmbedResources.py"
-    "${AUTOGENERATED_DIR}/EmbeddedResources"
-    ${SCRIPT_ARGUMENTS}
-    DEPENDS
-    "${ORTHANC_DIR}/Resources/EmbedResources.py"
-    ${DEPENDENCIES}
-    )
-
-  list(APPEND AUTOGENERATED_SOURCES
-    "${AUTOGENERATED_DIR}/EmbeddedResources.cpp"
-    ) 
-endmacro()
--- a/Resources/Samples/RestApiLinuxDynamic/CMakeLists.txt	Wed Oct 02 14:22:04 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-
-project(RestApiSample)
-
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -std=c++0x")
-
-file(DOWNLOAD 
-  http://mongoose.googlecode.com/files/mongoose-3.1.tgz 
-  ${CMAKE_BINARY_DIR}/mongoose-3.1.tar.gz
-  EXPECTED_MD5 "e718fc287b4eb1bd523be3fa00942bb0"
-  SHOW_PROGRESS
-  )
-
-file(DOWNLOAD 
-  http://downloads.sourceforge.net/project/jsoncpp/jsoncpp/0.5.0/jsoncpp-src-0.5.0.tar.gz
-  ${CMAKE_BINARY_DIR}/jsoncpp-src-0.5.0.tar.gz
-  EXPECTED_MD5 "24482b67c1cb17aac1ed1814288a3a8f"
-  SHOW_PROGRESS
-  )
-
-execute_process(
-  COMMAND hg clone -v -r Orthanc-0.4.0 https://code.google.com/p/orthanc/ Orthanc-0.4.0
-  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-  )
-
-execute_process(
-  COMMAND ${CMAKE_COMMAND} -E tar xvfz ${CMAKE_BINARY_DIR}/mongoose-3.1.tar.gz
-  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-  )
-
-# Apply a patch to improve Mongoose shutdown
-execute_process(
-  COMMAND patch mongoose.c ${ORTHANC_DIR}/Resources/Patches/mongoose-patch.diff
-  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/mongoose
-  )
-
-execute_process(
-  COMMAND ${CMAKE_COMMAND} -E tar xvfz ${CMAKE_BINARY_DIR}/jsoncpp-src-0.5.0.tar.gz
-  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-  )
-
-include(AutoGeneratedCode.cmake)
-
-add_definitions(
-  -DBOOST_HAS_FILESYSTEM_V3=1
-  -DBOOST_HAS_SCHED_YIELD=1
-  -DORTHANC_SSL_ENABLED=1
-  -DORTHANC_STANDALONE=1
-  -DORTHANC_STATIC=0
-  )
-
-set(ORTHANC_DIR ${CMAKE_BINARY_DIR}/Orthanc-0.4.0)
-set(MONGOOSE_DIR ${CMAKE_BINARY_DIR}/mongoose)
-set(JSONCPP_DIR ${CMAKE_BINARY_DIR}/jsoncpp-src-0.5.0)
-
-include_directories(
-  ${ORTHANC_DIR}
-  ${MONGOOSE_DIR}
-  ${JSONCPP_DIR}/include
-  )
-
-link_libraries(
-  boost_date_time
-  boost_filesystem
-  boost_system
-  boost_thread
-  curl
-  dl
-  glog
-  png
-  pthread
-  sqlite3
-  uuid
-  z
-  )
-
-set(THIRD_PARTY_SOURCES
-  ${MONGOOSE_DIR}/mongoose.c
-  ${JSONCPP_DIR}/src/lib_json/json_reader.cpp
-  ${JSONCPP_DIR}/src/lib_json/json_value.cpp 
-  ${JSONCPP_DIR}/src/lib_json/json_writer.cpp
-  )
-
-file(GLOB ORTHANC_SOURCES 
-  ${ORTHANC_DIR}/Core/*.cpp
-  ${ORTHANC_DIR}/Core/*/*.cpp
-  ${ORTHANC_DIR}/OrthancCppClient/*.cpp
-  ${ORTHANC_DIR}/Resources/base64/base64.cpp
-  ${ORTHANC_DIR}/Resources/md5/md5.c
-  ${ORTHANC_DIR}/Resources/sha1/sha1.cpp
-  ${ORTHANC_DIR}/Resources/minizip/zip.c
-  ${ORTHANC_DIR}/Resources/minizip/ioapi.c
-  )
-
-list(REMOVE_ITEM ORTHANC_SOURCES ${ORTHANC_DIR}/OrthancCppClient/main.cpp)
-
-EmbedResources(
-  #ORTHANC_EXPLORER ${ORTHANC_DIR}/OrthancExplorer
-  )
-
-add_executable(RestApiSample
-  Sample.cpp
-  ${ORTHANC_SOURCES}
-  ${AUTOGENERATED_SOURCES}
-  ${THIRD_PARTY_SOURCES}
-  )
--- a/Resources/Samples/RestApiLinuxDynamic/README.txt	Wed Oct 02 14:22:04 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-This folder shows how it is possible to link against the "Core" and
-"OrthancCppClient" libraries from the Orthanc distribution. It is
-shown how a sample REST API can be created.
-
-This is the same sample than in folder "../RestApi", but with a
-different build script and the use of C++ lambda functions.
-
-The build script of this folder does not rely on the default CMake
-script from Orthanc. It dynamically links against the standard system
-Linux libraries. This results in a simpler, standalone build
-script. However, it will only work on Linux-based systems.
--- a/Resources/Samples/RestApiLinuxDynamic/Sample.cpp	Wed Oct 02 14:22:04 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/**
- * Orthanc - A Lightweight, RESTful DICOM Store
- * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
- * Belgium
- *
- * This program is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * In addition, as a special exception, the copyright holders of this
- * program give permission to link the code of its release with the
- * OpenSSL project's "OpenSSL" library (or with modified versions of it
- * that use the same license as the "OpenSSL" library), and distribute
- * the linked executables. You must obey the GNU General Public License
- * in all respects for all of the code used other than "OpenSSL". If you
- * modify file(s) with this exception, you may extend this exception to
- * your version of the file(s), but you are not obligated to do so. If
- * you do not wish to do so, delete this exception statement from your
- * version. If you delete this exception statement from all source files
- * in the program, then also delete it here.
- * 
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- **/
-
-
-#include <Core/HttpServer/MongooseServer.h>
-#include <Core/RestApi/RestApi.h>
-#include <Core/Toolbox.h>
-#include <glog/logging.h>
-#include <stdio.h>
-
-
-/**
- * This is a demo program that shows how to setup a REST server with
- * the Orthanc Core API. Once the server is running, here are some 
- * sample command lines to interact with it:
- * 
- *  # curl http://localhost:8042
- *  # curl 'http://localhost:8042?name=Hide'
- *  # curl http://localhost:8042 -X DELETE
- *  # curl http://localhost:8042 -X PUT -d "PutBody"
- *  # curl http://localhost:8042 -X POST -d "PostBody"
- **/
-
-int main()
-{
-  // Initialize the logging mechanism
-  google::InitGoogleLogging("Orthanc");
-  FLAGS_logtostderr = true;
-  FLAGS_minloglevel = 0;                      // Use the verbose mode
-  FLAGS_v = 0;
-  
-  // Define the callbacks of the REST API using C++11 lambda functions
-  std::auto_ptr<Orthanc::RestApi> rest(new Orthanc::RestApi);
-
-  rest->Register("/", [] (Orthanc::RestApi::GetCall& call) {
-      std::string answer = "Hello world\n";
-      answer += "Glad to meet you, Mr. " + call.GetArgument("name", "Nobody") + "\n";
-      call.GetOutput().AnswerBuffer(answer, "text/plain");
-    });
-
-  rest->Register("/", [] (Orthanc::RestApi::DeleteCall& call) {
-      call.GetOutput().AnswerBuffer("Hey, you have just deleted the server!\n",
-                                    "text/plain");
-    });
-    
-  rest->Register("/", [] (Orthanc::RestApi::PostCall& call) {
-      call.GetOutput().AnswerBuffer("I have received a POST with body: [" +
-                                    call.GetPostBody() + "]\n", "text/plain");
-    });
-
-  rest->Register("/", [] (Orthanc::RestApi::PutCall& call) {
-      call.GetOutput().AnswerBuffer("I have received a PUT with body: [" +
-                                    call.GetPutBody() + "]\n", "text/plain");
-    });
-
-  // Setup the embedded HTTP server
-  Orthanc::MongooseServer httpServer;
-  httpServer.SetPortNumber(8042);             // Use TCP port 8042
-  httpServer.SetRemoteAccessAllowed(true);    // Do not block remote requests
-  httpServer.RegisterHandler(rest.release()); // The REST API is the handler
-
-  // Start the server and wait for the user to hit "Ctrl-C"
-  httpServer.Start();
-  LOG(WARNING) << "REST server has started";
-  Orthanc::Toolbox::ServerBarrier();
-  LOG(WARNING) << "REST server has stopped";
-
-  return 0;
-}