comparison PalanthirServer/DicomProtocol/DicomServer.cpp @ 50:a15e90e5d6fc

rename in code
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 05 Sep 2012 15:50:12 +0200
parents 33d67e1ab173
children
comparison
equal deleted inserted replaced
49:e1a3ae0dadf3 50:a15e90e5d6fc
1 /** 1 /**
2 * Palantir - A Lightweight, RESTful DICOM Store 2 * Palanthir - A Lightweight, RESTful DICOM Store
3 * Copyright (C) 2012 Medical Physics Department, CHU of Liege, 3 * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
4 * Belgium 4 * Belgium
5 * 5 *
6 * This program is free software: you can redistribute it and/or 6 * This program is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as 7 * modify it under the terms of the GNU General Public License as
18 **/ 18 **/
19 19
20 20
21 #include "DicomServer.h" 21 #include "DicomServer.h"
22 22
23 #include "../../Core/PalantirException.h" 23 #include "../../Core/PalanthirException.h"
24 #include "../../Core/Toolbox.h" 24 #include "../../Core/Toolbox.h"
25 #include "../Internals/CommandDispatcher.h" 25 #include "../Internals/CommandDispatcher.h"
26 26
27 #include <boost/thread.hpp> 27 #include <boost/thread.hpp>
28 #include <dcmtk/dcmdata/dcdict.h> 28 #include <dcmtk/dcmdata/dcdict.h>
29 29
30 30
31 namespace Palantir 31 namespace Palanthir
32 { 32 {
33 struct DicomServer::PImpl 33 struct DicomServer::PImpl
34 { 34 {
35 boost::thread thread_; 35 boost::thread thread_;
36 36
62 (NET_ACCEPTOR, OFstatic_cast(int, server->port_), /*opt_acse_timeout*/ 30, &net); 62 (NET_ACCEPTOR, OFstatic_cast(int, server->port_), /*opt_acse_timeout*/ 30, &net);
63 if (cond.bad()) 63 if (cond.bad())
64 { 64 {
65 OFString temp_str; 65 OFString temp_str;
66 OFLOG_ERROR(Internals::Logger, "cannot create network: " << DimseCondition::dump(temp_str, cond)); 66 OFLOG_ERROR(Internals::Logger, "cannot create network: " << DimseCondition::dump(temp_str, cond));
67 throw PalantirException("Cannot create network"); 67 throw PalanthirException("Cannot create network");
68 } 68 }
69 69
70 OFLOG_WARN(Internals::Logger, "DICOM server started"); 70 OFLOG_WARN(Internals::Logger, "DICOM server started");
71 71
72 server->started_ = true; 72 server->started_ = true;
168 168
169 void DicomServer::SetApplicationEntityTitle(const std::string& aet) 169 void DicomServer::SetApplicationEntityTitle(const std::string& aet)
170 { 170 {
171 if (aet.size() == 0) 171 if (aet.size() == 0)
172 { 172 {
173 throw PalantirException("Too short AET"); 173 throw PalanthirException("Too short AET");
174 } 174 }
175 175
176 for (size_t i = 0; i < aet.size(); i++) 176 for (size_t i = 0; i < aet.size(); i++)
177 { 177 {
178 if (!isalnum(aet[i]) && aet[i] != '-') 178 if (!isalnum(aet[i]) && aet[i] != '-')
179 { 179 {
180 throw PalantirException("Only alphanumeric characters are allowed in AET"); 180 throw PalanthirException("Only alphanumeric characters are allowed in AET");
181 } 181 }
182 } 182 }
183 183
184 Stop(); 184 Stop();
185 aet_ = aet; 185 aet_ = aet;
207 { 207 {
208 return *findRequestHandlerFactory_; 208 return *findRequestHandlerFactory_;
209 } 209 }
210 else 210 else
211 { 211 {
212 throw PalantirException("No C-FIND request handler factory"); 212 throw PalanthirException("No C-FIND request handler factory");
213 } 213 }
214 } 214 }
215 215
216 void DicomServer::SetMoveRequestHandlerFactory(IMoveRequestHandlerFactory& factory) 216 void DicomServer::SetMoveRequestHandlerFactory(IMoveRequestHandlerFactory& factory)
217 { 217 {
230 { 230 {
231 return *moveRequestHandlerFactory_; 231 return *moveRequestHandlerFactory_;
232 } 232 }
233 else 233 else
234 { 234 {
235 throw PalantirException("No C-MOVE request handler factory"); 235 throw PalanthirException("No C-MOVE request handler factory");
236 } 236 }
237 } 237 }
238 238
239 void DicomServer::SetStoreRequestHandlerFactory(IStoreRequestHandlerFactory& factory) 239 void DicomServer::SetStoreRequestHandlerFactory(IStoreRequestHandlerFactory& factory)
240 { 240 {
253 { 253 {
254 return *storeRequestHandlerFactory_; 254 return *storeRequestHandlerFactory_;
255 } 255 }
256 else 256 else
257 { 257 {
258 throw PalantirException("No C-STORE request handler factory"); 258 throw PalanthirException("No C-STORE request handler factory");
259 } 259 }
260 } 260 }
261 261
262 void DicomServer::SetApplicationEntityFilter(IApplicationEntityFilter& factory) 262 void DicomServer::SetApplicationEntityFilter(IApplicationEntityFilter& factory)
263 { 263 {
276 { 276 {
277 return *applicationEntityFilter_; 277 return *applicationEntityFilter_;
278 } 278 }
279 else 279 else
280 { 280 {
281 throw PalantirException("No application entity filter"); 281 throw PalanthirException("No application entity filter");
282 } 282 }
283 } 283 }
284 284
285 void DicomServer::Start() 285 void DicomServer::Start()
286 { 286 {