comparison Core/DicomNetworking/DicomServer.cpp @ 3786:3801435e34a1 SylvainRouquette/fix-issue169-95b752c

integration Orthanc-1.6.0->SylvainRouquette
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 19 Mar 2020 11:48:30 +0100
parents 56f2397f027a
children 4f78da5613a1
comparison
equal deleted inserted replaced
3785:763533d6dd67 3786:3801435e34a1
1 /** 1 /**
2 * Orthanc - A Lightweight, RESTful DICOM Store 2 * Orthanc - A Lightweight, RESTful DICOM Store
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium 4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium 5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
6 * 6 *
7 * This program is free software: you can redistribute it and/or 7 * This program is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as 8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation, either version 3 of the 9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version. 10 * License, or (at your option) any later version.
51 { 51 {
52 struct DicomServer::PImpl 52 struct DicomServer::PImpl
53 { 53 {
54 boost::thread thread_; 54 boost::thread thread_;
55 T_ASC_Network *network_; 55 T_ASC_Network *network_;
56 std::auto_ptr<RunnableWorkersPool> workers_; 56 std::unique_ptr<RunnableWorkersPool> workers_;
57 }; 57 };
58 58
59 59
60 void DicomServer::ServerThread(DicomServer* server) 60 void DicomServer::ServerThread(DicomServer* server)
61 { 61 {
63 63
64 while (server->continue_) 64 while (server->continue_)
65 { 65 {
66 /* receive an association and acknowledge or reject it. If the association was */ 66 /* receive an association and acknowledge or reject it. If the association was */
67 /* acknowledged, offer corresponding services and invoke one or more if required. */ 67 /* acknowledged, offer corresponding services and invoke one or more if required. */
68 std::auto_ptr<Internals::CommandDispatcher> dispatcher(Internals::AcceptAssociation(*server, server->pimpl_->network_)); 68 std::unique_ptr<Internals::CommandDispatcher> dispatcher(Internals::AcceptAssociation(*server, server->pimpl_->network_));
69 69
70 try 70 try
71 { 71 {
72 if (dispatcher.get() != NULL) 72 if (dispatcher.get() != NULL)
73 { 73 {
92 modalities_ = NULL; 92 modalities_ = NULL;
93 findRequestHandlerFactory_ = NULL; 93 findRequestHandlerFactory_ = NULL;
94 moveRequestHandlerFactory_ = NULL; 94 moveRequestHandlerFactory_ = NULL;
95 storeRequestHandlerFactory_ = NULL; 95 storeRequestHandlerFactory_ = NULL;
96 worklistRequestHandlerFactory_ = NULL; 96 worklistRequestHandlerFactory_ = NULL;
97 storageCommitmentFactory_ = NULL;
97 applicationEntityFilter_ = NULL; 98 applicationEntityFilter_ = NULL;
98 checkCalledAet_ = true; 99 checkCalledAet_ = true;
99 associationTimeout_ = 30; 100 associationTimeout_ = 30;
100 continue_ = false; 101 continue_ = false;
101 } 102 }
287 { 288 {
288 throw OrthancException(ErrorCode_NoWorklistHandler); 289 throw OrthancException(ErrorCode_NoWorklistHandler);
289 } 290 }
290 } 291 }
291 292
293 void DicomServer::SetStorageCommitmentRequestHandlerFactory(IStorageCommitmentRequestHandlerFactory& factory)
294 {
295 Stop();
296 storageCommitmentFactory_ = &factory;
297 }
298
299 bool DicomServer::HasStorageCommitmentRequestHandlerFactory() const
300 {
301 return (storageCommitmentFactory_ != NULL);
302 }
303
304 IStorageCommitmentRequestHandlerFactory& DicomServer::GetStorageCommitmentRequestHandlerFactory() const
305 {
306 if (HasStorageCommitmentRequestHandlerFactory())
307 {
308 return *storageCommitmentFactory_;
309 }
310 else
311 {
312 throw OrthancException(ErrorCode_NoStorageCommitmentHandler);
313 }
314 }
315
292 void DicomServer::SetApplicationEntityFilter(IApplicationEntityFilter& factory) 316 void DicomServer::SetApplicationEntityFilter(IApplicationEntityFilter& factory)
293 { 317 {
294 Stop(); 318 Stop();
295 applicationEntityFilter_ = &factory; 319 applicationEntityFilter_ = &factory;
296 } 320 }
376 else 400 else
377 { 401 {
378 return modalities_->IsSameAETitle(aet, GetApplicationEntityTitle()); 402 return modalities_->IsSameAETitle(aet, GetApplicationEntityTitle());
379 } 403 }
380 } 404 }
381
382 } 405 }