comparison Plugin/Cache/CacheScheduler.cpp @ 266:4e9d30c19b4b

linking against orthanc framework library
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Jun 2020 12:32:46 +0200
parents aee499712ac4
children e376158e2dbb
comparison
equal deleted inserted replaced
265:af7108b06b4d 266:4e9d30c19b4b
21 21
22 #include "CacheScheduler.h" 22 #include "CacheScheduler.h"
23 23
24 #include "CacheIndex.h" 24 #include "CacheIndex.h"
25 25
26 #include <Core/OrthancException.h> 26 #include <Compatibility.h>
27 #include <OrthancException.h>
27 #include <stdio.h> 28 #include <stdio.h>
28 29
29 namespace OrthancPlugins 30 namespace OrthancPlugins
30 { 31 {
31 class DynamicString : public Orthanc::IDynamicObject 32 class DynamicString : public Orthanc::IDynamicObject
72 queue_.Enqueue(new DynamicString(item)); 73 queue_.Enqueue(new DynamicString(item));
73 } 74 }
74 75
75 DynamicString* Dequeue(int32_t msTimeout) 76 DynamicString* Dequeue(int32_t msTimeout)
76 { 77 {
77 std::auto_ptr<Orthanc::IDynamicObject> message(queue_.Dequeue(msTimeout)); 78 std::unique_ptr<Orthanc::IDynamicObject> message(queue_.Dequeue(msTimeout));
78 if (message.get() == NULL) 79 if (message.get() == NULL)
79 { 80 {
80 return NULL; 81 return NULL;
81 } 82 }
82 83
109 110
110 static void Worker(Prefetcher* that) 111 static void Worker(Prefetcher* that)
111 { 112 {
112 while (!(that->done_)) 113 while (!(that->done_))
113 { 114 {
114 std::auto_ptr<DynamicString> prefetch(that->queue_.Dequeue(500)); 115 std::unique_ptr<DynamicString> prefetch(that->queue_.Dequeue(500));
115 116
116 try 117 try
117 { 118 {
118 if (prefetch.get() != NULL) 119 if (prefetch.get() != NULL)
119 { 120 {
216 217
217 218
218 class CacheScheduler::BundleScheduler 219 class CacheScheduler::BundleScheduler
219 { 220 {
220 private: 221 private:
221 std::auto_ptr<ICacheFactory> factory_; 222 std::unique_ptr<ICacheFactory> factory_;
222 PrefetchQueue queue_; 223 PrefetchQueue queue_;
223 std::vector<Prefetcher*> prefetchers_; 224 std::vector<Prefetcher*> prefetchers_;
224 225
225 public: 226 public:
226 BundleScheduler(int bundleIndex, 227 BundleScheduler(int bundleIndex,
227 ICacheFactory* factory, 228 ICacheFactory* factory,
228 CacheManager& cache, 229 CacheManager& cache,
294 295
295 296
296 CacheScheduler::CacheScheduler(CacheManager& cache, 297 CacheScheduler::CacheScheduler(CacheManager& cache,
297 unsigned int maxPrefetchSize) : 298 unsigned int maxPrefetchSize) :
298 maxPrefetchSize_(maxPrefetchSize), 299 maxPrefetchSize_(maxPrefetchSize),
299 cache_(cache), 300 cache_(cache)
300 policy_(NULL)
301 { 301 {
302 } 302 }
303 303
304 304
305 CacheScheduler::~CacheScheduler() 305 CacheScheduler::~CacheScheduler()