comparison OrthancServer/ServerContext.h @ 1436:0a3e3be59094

uncoupling of SignalChange for Lua scripts
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Jun 2015 17:19:26 +0200
parents f9cd40166269
children b2b09a3dbd8e
comparison
equal deleted inserted replaced
1435:6406f5493d92 1436:0a3e3be59094
30 **/ 30 **/
31 31
32 32
33 #pragma once 33 #pragma once
34 34
35 #include "../Core/MultiThreading/SharedMessageQueue.h"
35 #include "../Core/Cache/MemoryCache.h" 36 #include "../Core/Cache/MemoryCache.h"
36 #include "../Core/Cache/SharedArchive.h" 37 #include "../Core/Cache/SharedArchive.h"
37 #include "../Core/FileStorage/CompressedFileStorageAccessor.h" 38 #include "../Core/FileStorage/CompressedFileStorageAccessor.h"
38 #include "../Core/FileStorage/IStorageArea.h" 39 #include "../Core/FileStorage/IStorageArea.h"
39 #include "../Core/Lua/LuaContext.h" 40 #include "../Core/Lua/LuaContext.h"
46 #include "ParsedDicomFile.h" 47 #include "ParsedDicomFile.h"
47 #include "Scheduler/ServerScheduler.h" 48 #include "Scheduler/ServerScheduler.h"
48 #include "ServerIndex.h" 49 #include "ServerIndex.h"
49 50
50 #include <boost/filesystem.hpp> 51 #include <boost/filesystem.hpp>
52 #include <boost/thread.hpp>
53
51 54
52 namespace Orthanc 55 namespace Orthanc
53 { 56 {
54 /** 57 /**
55 * This class is responsible for maintaining the storage area on the 58 * This class is responsible for maintaining the storage area on the
98 }; 101 };
99 102
100 typedef std::list<ServerListener> ServerListeners; 103 typedef std::list<ServerListener> ServerListeners;
101 104
102 105
106 static void ChangeThread(ServerContext* that);
107
108
103 ServerIndex index_; 109 ServerIndex index_;
104 CompressedFileStorageAccessor accessor_; 110 CompressedFileStorageAccessor accessor_;
105 bool compressionEnabled_; 111 bool compressionEnabled_;
106 112
107 DicomCacheProvider provider_; 113 DicomCacheProvider provider_;
112 118
113 LuaScripting lua_; 119 LuaScripting lua_;
114 OrthancPlugins* plugins_; 120 OrthancPlugins* plugins_;
115 ServerListeners listeners_; 121 ServerListeners listeners_;
116 122
123 bool done_;
124 SharedMessageQueue pendingChanges_;
125 boost::thread changeThread_;
126
117 SharedArchive queryRetrieveArchive_; 127 SharedArchive queryRetrieveArchive_;
118 std::string defaultLocalAet_; 128 std::string defaultLocalAet_;
119 129
120 public: 130 public:
121 class DicomCacheLocker : public boost::noncopyable 131 class DicomCacheLocker : public boost::noncopyable
136 return *dicom_; 146 return *dicom_;
137 } 147 }
138 }; 148 };
139 149
140 ServerContext(IDatabaseWrapper& database); 150 ServerContext(IDatabaseWrapper& database);
151
152 ~ServerContext();
141 153
142 void SetStorageArea(IStorageArea& storage) 154 void SetStorageArea(IStorageArea& storage)
143 { 155 {
144 accessor_.SetStorageArea(storage); 156 accessor_.SetStorageArea(storage);
145 } 157 }