comparison OrthancServer/OrthancRestApi/OrthancRestModalities.cpp @ 3712:2a170a8f1faf

replacing std::auto_ptr by std::unique_ptr
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 02 Mar 2020 15:32:45 +0100
parents 4922bdd046dd
children 56f2397f027a
comparison
equal deleted inserted replaced
3709:1f4910999fe7 3712:2a170a8f1faf
414 /*************************************************************************** 414 /***************************************************************************
415 * DICOM C-Find and C-Move SCU => Recommended since Orthanc 0.9.0 415 * DICOM C-Find and C-Move SCU => Recommended since Orthanc 0.9.0
416 ***************************************************************************/ 416 ***************************************************************************/
417 417
418 static void AnswerQueryHandler(RestApiPostCall& call, 418 static void AnswerQueryHandler(RestApiPostCall& call,
419 std::auto_ptr<QueryRetrieveHandler>& handler) 419 std::unique_ptr<QueryRetrieveHandler>& handler)
420 { 420 {
421 ServerContext& context = OrthancRestApi::GetContext(call); 421 ServerContext& context = OrthancRestApi::GetContext(call);
422 422
423 if (handler.get() == NULL) 423 if (handler.get() == NULL)
424 { 424 {
464 throw OrthancException(ErrorCode_BadFileFormat, 464 throw OrthancException(ErrorCode_BadFileFormat,
465 "The field " + std::string(KEY_QUERY) + " must contain a JSON object"); 465 "The field " + std::string(KEY_QUERY) + " must contain a JSON object");
466 } 466 }
467 else 467 else
468 { 468 {
469 std::auto_ptr<QueryRetrieveHandler> handler(new QueryRetrieveHandler(context)); 469 std::unique_ptr<QueryRetrieveHandler> handler(new QueryRetrieveHandler(context));
470 470
471 handler->SetModality(call.GetUriComponent("id", "")); 471 handler->SetModality(call.GetUriComponent("id", ""));
472 handler->SetLevel(StringToResourceType(request[KEY_LEVEL].asCString())); 472 handler->SetLevel(StringToResourceType(request[KEY_LEVEL].asCString()));
473 473
474 if (request.isMember(KEY_QUERY)) 474 if (request.isMember(KEY_QUERY))
616 { 616 {
617 body = Json::objectValue; 617 body = Json::objectValue;
618 call.BodyToString(targetAet); 618 call.BodyToString(targetAet);
619 } 619 }
620 620
621 std::auto_ptr<DicomMoveScuJob> job(new DicomMoveScuJob(context)); 621 std::unique_ptr<DicomMoveScuJob> job(new DicomMoveScuJob(context));
622 622
623 { 623 {
624 QueryAccessor query(call); 624 QueryAccessor query(call);
625 job->SetTargetAet(targetAet); 625 job->SetTargetAet(targetAet);
626 job->SetLocalAet(query.GetHandler().GetLocalAet()); 626 job->SetLocalAet(query.GetHandler().GetLocalAet());
742 CHILDREN_LEVEL == ResourceType_Series || 742 CHILDREN_LEVEL == ResourceType_Series ||
743 CHILDREN_LEVEL == ResourceType_Instance); 743 CHILDREN_LEVEL == ResourceType_Instance);
744 744
745 ServerContext& context = OrthancRestApi::GetContext(call); 745 ServerContext& context = OrthancRestApi::GetContext(call);
746 746
747 std::auto_ptr<QueryRetrieveHandler> handler(new QueryRetrieveHandler(context)); 747 std::unique_ptr<QueryRetrieveHandler> handler(new QueryRetrieveHandler(context));
748 748
749 { 749 {
750 const QueryAccessor parent(call); 750 const QueryAccessor parent(call);
751 const ResourceType level = parent.GetHandler().GetLevel(); 751 const ResourceType level = parent.GetHandler().GetLevel();
752 752
942 ServerContext& context = OrthancRestApi::GetContext(call); 942 ServerContext& context = OrthancRestApi::GetContext(call);
943 943
944 std::string remote = call.GetUriComponent("id", ""); 944 std::string remote = call.GetUriComponent("id", "");
945 945
946 Json::Value request; 946 Json::Value request;
947 std::auto_ptr<DicomModalityStoreJob> job(new DicomModalityStoreJob(context)); 947 std::unique_ptr<DicomModalityStoreJob> job(new DicomModalityStoreJob(context));
948 948
949 GetInstancesToExport(request, *job, remote, call); 949 GetInstancesToExport(request, *job, remote, call);
950 950
951 std::string localAet = Toolbox::GetJsonStringField 951 std::string localAet = Toolbox::GetJsonStringField
952 (request, "LocalAet", context.GetDefaultLocalApplicationEntityTitle()); 952 (request, "LocalAet", context.GetDefaultLocalApplicationEntityTitle());
1082 ServerContext& context = OrthancRestApi::GetContext(call); 1082 ServerContext& context = OrthancRestApi::GetContext(call);
1083 1083
1084 std::string remote = call.GetUriComponent("id", ""); 1084 std::string remote = call.GetUriComponent("id", "");
1085 1085
1086 Json::Value request; 1086 Json::Value request;
1087 std::auto_ptr<OrthancPeerStoreJob> job(new OrthancPeerStoreJob(context)); 1087 std::unique_ptr<OrthancPeerStoreJob> job(new OrthancPeerStoreJob(context));
1088 1088
1089 GetInstancesToExport(request, *job, remote, call); 1089 GetInstancesToExport(request, *job, remote, call);
1090 1090
1091 OrthancConfiguration::ReaderLock lock; 1091 OrthancConfiguration::ReaderLock lock;
1092 1092
1274 { 1274 {
1275 const std::string& localAet = context.GetDefaultLocalApplicationEntityTitle(); 1275 const std::string& localAet = context.GetDefaultLocalApplicationEntityTitle();
1276 RemoteModalityParameters remote = 1276 RemoteModalityParameters remote =
1277 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", "")); 1277 MyGetModalityUsingSymbolicName(call.GetUriComponent("id", ""));
1278 1278
1279 std::auto_ptr<ParsedDicomFile> query 1279 std::unique_ptr<ParsedDicomFile> query
1280 (ParsedDicomFile::CreateFromJson(json, static_cast<DicomFromJsonFlags>(0), 1280 (ParsedDicomFile::CreateFromJson(json, static_cast<DicomFromJsonFlags>(0),
1281 "" /* no private creator */)); 1281 "" /* no private creator */));
1282 1282
1283 DicomFindAnswers answers(true); 1283 DicomFindAnswers answers(true);
1284 1284