# HG changeset patch # User Sebastien Jodogne # Date 1409929928 -7200 # Node ID f4e65808ea586d5af23941d89843ac492d572a38 # Parent bf67431a7383ef63cc14aa64894f9c78c62ecfa9 FilesystemStorageWithoutDicom diff -r bf67431a7383 -r f4e65808ea58 OrthancServer/main.cpp --- a/OrthancServer/main.cpp Fri Sep 05 17:01:42 2014 +0200 +++ b/OrthancServer/main.cpp Fri Sep 05 17:12:08 2014 +0200 @@ -37,6 +37,7 @@ #include #include +#include "../Core/Uuid.h" #include "../Core/FileStorage/FilesystemStorage.h" #include "../Core/HttpServer/EmbeddedResourceHttpHandler.h" #include "../Core/HttpServer/FilesystemHttpHandler.h" @@ -315,6 +316,55 @@ +class FilesystemStorageWithoutDicom : public IStorageArea +{ +private: + FilesystemStorage storage_; + +public: + FilesystemStorageWithoutDicom(const std::string& path) : storage_(path) + { + } + + virtual std::string Create(const void* content, + size_t size, + FileContentType type) + { + if (type != FileContentType_Dicom) + { + return storage_.Create(content, size, type); + } + else + { + return Toolbox::GenerateUuid(); + } + } + + virtual void Read(std::string& content, + const std::string& uuid, + FileContentType type) const + { + if (type != FileContentType_Dicom) + { + storage_.Read(content, uuid, type); + } + else + { + throw OrthancException(ErrorCode_UnknownResource); + } + } + + virtual void Remove(const std::string& uuid, + FileContentType type) + { + if (type != FileContentType_Dicom) + { + storage_.Remove(uuid, type); + } + } +}; + + static bool StartOrthanc() { std::string storageDirectoryStr = Configuration::GetGlobalStringParameter("StorageDirectory", "OrthancStorage"); @@ -322,7 +372,10 @@ boost::filesystem::path indexDirectory = Configuration::InterpretStringParameterAsPath( Configuration::GetGlobalStringParameter("IndexDirectory", storageDirectoryStr)); + // TODO HERE FilesystemStorage storage(storageDirectory.string()); + //FilesystemStorageWithoutDicom storage(storageDirectory.string()); + ServerContext context(storage, indexDirectory); LOG(WARNING) << "Storage directory: " << storageDirectory;