Mercurial > hg > orthanc
comparison OrthancServer/ServerIndex.cpp @ 3920:82e88ff003d7 c-get
merge default -> c-get
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Tue, 12 May 2020 14:58:24 +0200 |
parents | aaaa442bfe39 |
children | 100fbe970762 |
comparison
equal
deleted
inserted
replaced
3918:dba48c162b7b | 3920:82e88ff003d7 |
---|---|
673 unsigned int threadSleep) : | 673 unsigned int threadSleep) : |
674 done_(false), | 674 done_(false), |
675 db_(db), | 675 db_(db), |
676 maximumStorageSize_(0), | 676 maximumStorageSize_(0), |
677 maximumPatients_(0), | 677 maximumPatients_(0), |
678 overwrite_(false), | |
679 mainDicomTagsRegistry_(new MainDicomTagsRegistry) | 678 mainDicomTagsRegistry_(new MainDicomTagsRegistry) |
680 { | 679 { |
681 listener_.reset(new Listener(context)); | 680 listener_.reset(new Listener(context)); |
682 db_.SetListener(*listener_); | 681 db_.SetListener(*listener_); |
683 | 682 |
751 } | 750 } |
752 | 751 |
753 | 752 |
754 StoreStatus ServerIndex::Store(std::map<MetadataType, std::string>& instanceMetadata, | 753 StoreStatus ServerIndex::Store(std::map<MetadataType, std::string>& instanceMetadata, |
755 DicomInstanceToStore& instanceToStore, | 754 DicomInstanceToStore& instanceToStore, |
756 const Attachments& attachments) | 755 const Attachments& attachments, |
756 bool overwrite) | |
757 { | 757 { |
758 boost::mutex::scoped_lock lock(mutex_); | 758 boost::mutex::scoped_lock lock(mutex_); |
759 | 759 |
760 const DicomMap& dicomSummary = instanceToStore.GetSummary(); | 760 const DicomMap& dicomSummary = instanceToStore.GetSummary(); |
761 const ServerIndex::MetadataMap& metadata = instanceToStore.GetMetadata(); | 761 const ServerIndex::MetadataMap& metadata = instanceToStore.GetMetadata(); |
782 if (!db_.CreateInstance(status, instanceId, hashPatient, | 782 if (!db_.CreateInstance(status, instanceId, hashPatient, |
783 hashStudy, hashSeries, hashInstance)) | 783 hashStudy, hashSeries, hashInstance)) |
784 { | 784 { |
785 // The instance already exists | 785 // The instance already exists |
786 | 786 |
787 if (overwrite_) | 787 if (overwrite) |
788 { | 788 { |
789 // Overwrite the old instance | 789 // Overwrite the old instance |
790 LOG(INFO) << "Overwriting instance: " << hashInstance; | 790 LOG(INFO) << "Overwriting instance: " << hashInstance; |
791 db_.DeleteResource(instanceId); | 791 db_.DeleteResource(instanceId); |
792 | 792 |
1658 } | 1658 } |
1659 | 1659 |
1660 StandaloneRecycling(); | 1660 StandaloneRecycling(); |
1661 } | 1661 } |
1662 | 1662 |
1663 void ServerIndex::SetOverwriteInstances(bool overwrite) | |
1664 { | |
1665 boost::mutex::scoped_lock lock(mutex_); | |
1666 overwrite_ = overwrite; | |
1667 } | |
1668 | |
1669 | 1663 |
1670 void ServerIndex::StandaloneRecycling() | 1664 void ServerIndex::StandaloneRecycling() |
1671 { | 1665 { |
1672 // WARNING: No mutex here, do not include this as a public method | 1666 // WARNING: No mutex here, do not include this as a public method |
1673 Transaction t(*this); | 1667 Transaction t(*this); |