comparison Framework/Plugins/IndexBackend.cpp @ 157:275e14f57f1e

replacing deprecated std::auto_ptr by std::unique_ptr
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 06 Jul 2020 12:45:58 +0200
parents 063aa53b5917
children 2ccde9c7311b 3236894320d6
comparison
equal deleted inserted replaced
156:710537acb488 157:275e14f57f1e
25 #include "../Common/BinaryStringValue.h" 25 #include "../Common/BinaryStringValue.h"
26 #include "../Common/Integer64Value.h" 26 #include "../Common/Integer64Value.h"
27 #include "../Common/Utf8StringValue.h" 27 #include "../Common/Utf8StringValue.h"
28 #include "GlobalProperties.h" 28 #include "GlobalProperties.h"
29 29
30 #include <Compatibility.h> // For std::unique_ptr<>
30 #include <Logging.h> 31 #include <Logging.h>
31 #include <OrthancException.h> 32 #include <OrthancException.h>
32 33
33 34
34 namespace OrthancDatabases 35 namespace OrthancDatabases
690 } 691 }
691 692
692 693
693 uint64_t IndexBackend::GetResourceCount(OrthancPluginResourceType resourceType) 694 uint64_t IndexBackend::GetResourceCount(OrthancPluginResourceType resourceType)
694 { 695 {
695 std::auto_ptr<DatabaseManager::CachedStatement> statement; 696 std::unique_ptr<DatabaseManager::CachedStatement> statement;
696 697
697 switch (manager_.GetDialect()) 698 switch (manager_.GetDialect())
698 { 699 {
699 case Dialect_MySQL: 700 case Dialect_MySQL:
700 statement.reset(new DatabaseManager::CachedStatement( 701 statement.reset(new DatabaseManager::CachedStatement(
755 } 756 }
756 757
757 758
758 uint64_t IndexBackend::GetTotalCompressedSize() 759 uint64_t IndexBackend::GetTotalCompressedSize()
759 { 760 {
760 std::auto_ptr<DatabaseManager::CachedStatement> statement; 761 std::unique_ptr<DatabaseManager::CachedStatement> statement;
761 762
762 // NB: "COALESCE" is used to replace "NULL" by "0" if the number of rows is empty 763 // NB: "COALESCE" is used to replace "NULL" by "0" if the number of rows is empty
763 764
764 switch (manager_.GetDialect()) 765 switch (manager_.GetDialect())
765 { 766 {
792 } 793 }
793 794
794 795
795 uint64_t IndexBackend::GetTotalUncompressedSize() 796 uint64_t IndexBackend::GetTotalUncompressedSize()
796 { 797 {
797 std::auto_ptr<DatabaseManager::CachedStatement> statement; 798 std::unique_ptr<DatabaseManager::CachedStatement> statement;
798 799
799 // NB: "COALESCE" is used to replace "NULL" by "0" if the number of rows is empty 800 // NB: "COALESCE" is used to replace "NULL" by "0" if the number of rows is empty
800 801
801 switch (manager_.GetDialect()) 802 switch (manager_.GetDialect())
802 { 803 {
1007 uint16_t group, 1008 uint16_t group,
1008 uint16_t element, 1009 uint16_t element,
1009 OrthancPluginIdentifierConstraint constraint, 1010 OrthancPluginIdentifierConstraint constraint,
1010 const char* value) 1011 const char* value)
1011 { 1012 {
1012 std::auto_ptr<DatabaseManager::CachedStatement> statement; 1013 std::unique_ptr<DatabaseManager::CachedStatement> statement;
1013 1014
1014 std::string header = 1015 std::string header =
1015 "SELECT d.id FROM DicomIdentifiers AS d, Resources AS r WHERE " 1016 "SELECT d.id FROM DicomIdentifiers AS d, Resources AS r WHERE "
1016 "d.id = r.internalId AND r.resourceType=${type} AND d.tagGroup=${group} " 1017 "d.id = r.internalId AND r.resourceType=${type} AND d.tagGroup=${group} "
1017 "AND d.tagElement=${element} AND "; 1018 "AND d.tagElement=${element} AND ";
1463 1464
1464 1465
1465 // For unit testing only! 1466 // For unit testing only!
1466 uint64_t IndexBackend::GetResourcesCount() 1467 uint64_t IndexBackend::GetResourcesCount()
1467 { 1468 {
1468 std::auto_ptr<DatabaseManager::CachedStatement> statement; 1469 std::unique_ptr<DatabaseManager::CachedStatement> statement;
1469 1470
1470 switch (manager_.GetDialect()) 1471 switch (manager_.GetDialect())
1471 { 1472 {
1472 case Dialect_MySQL: 1473 case Dialect_MySQL:
1473 statement.reset(new DatabaseManager::CachedStatement( 1474 statement.reset(new DatabaseManager::CachedStatement(
1499 1500
1500 1501
1501 // For unit testing only! 1502 // For unit testing only!
1502 uint64_t IndexBackend::GetUnprotectedPatientsCount() 1503 uint64_t IndexBackend::GetUnprotectedPatientsCount()
1503 { 1504 {
1504 std::auto_ptr<DatabaseManager::CachedStatement> statement; 1505 std::unique_ptr<DatabaseManager::CachedStatement> statement;
1505 1506
1506 switch (manager_.GetDialect()) 1507 switch (manager_.GetDialect())
1507 { 1508 {
1508 case Dialect_MySQL: 1509 case Dialect_MySQL:
1509 statement.reset(new DatabaseManager::CachedStatement( 1510 statement.reset(new DatabaseManager::CachedStatement(