comparison Core/DicomNetworking/DicomStoreUserConnection.cpp @ 3826:e82bd07c384e

putting DicomAssociation behind pimpl
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 10 Apr 2020 16:12:10 +0200
parents 4570c57668a8
children 83ea6939293d
comparison
equal deleted inserted replaced
3825:4570c57668a8 3826:e82bd07c384e
32 32
33 33
34 #include "../PrecompiledHeaders.h" 34 #include "../PrecompiledHeaders.h"
35 #include "DicomStoreUserConnection.h" 35 #include "DicomStoreUserConnection.h"
36 36
37 #include "DicomAssociation.h"
38
37 #include "../Logging.h" 39 #include "../Logging.h"
38 #include "../OrthancException.h" 40 #include "../OrthancException.h"
39 41
40 namespace Orthanc 42 namespace Orthanc
41 { 43 {
46 if (proposeUncompressedSyntaxes_) 48 if (proposeUncompressedSyntaxes_)
47 { 49 {
48 requiredCount += 1; 50 requiredCount += 1;
49 } 51 }
50 52
51 if (association_.GetRemainingPropositions() <= requiredCount) 53 if (association_->GetRemainingPropositions() <= requiredCount)
52 { 54 {
53 return false; // Not enough room 55 return false; // Not enough room
54 } 56 }
55 57
56 for (std::set<DicomTransferSyntax>::const_iterator 58 for (std::set<DicomTransferSyntax>::const_iterator
57 it = syntaxes.begin(); it != syntaxes.end(); ++it) 59 it = syntaxes.begin(); it != syntaxes.end(); ++it)
58 { 60 {
59 association_.ProposePresentationContext(sopClassUid, *it); 61 association_->ProposePresentationContext(sopClassUid, *it);
60 } 62 }
61 63
62 if (proposeUncompressedSyntaxes_) 64 if (proposeUncompressedSyntaxes_)
63 { 65 {
64 std::set<DicomTransferSyntax> uncompressed; 66 std::set<DicomTransferSyntax> uncompressed;
79 uncompressed.insert(DicomTransferSyntax_BigEndianExplicit); 81 uncompressed.insert(DicomTransferSyntax_BigEndianExplicit);
80 } 82 }
81 83
82 if (!uncompressed.empty()) 84 if (!uncompressed.empty())
83 { 85 {
84 association_.ProposePresentationContext(sopClassUid, uncompressed); 86 association_->ProposePresentationContext(sopClassUid, uncompressed);
85 } 87 }
86 } 88 }
87 89
88 return true; 90 return true;
89 } 91 }
95 DicomTransferSyntax transferSyntax) 97 DicomTransferSyntax transferSyntax)
96 { 98 {
97 typedef std::map<DicomTransferSyntax, uint8_t> PresentationContexts; 99 typedef std::map<DicomTransferSyntax, uint8_t> PresentationContexts;
98 100
99 PresentationContexts pc; 101 PresentationContexts pc;
100 if (association_.IsOpen() && 102 if (association_->IsOpen() &&
101 association_.LookupAcceptedPresentationContext(pc, sopClassUid)) 103 association_->LookupAcceptedPresentationContext(pc, sopClassUid))
102 { 104 {
103 PresentationContexts::const_iterator found = pc.find(transferSyntax); 105 PresentationContexts::const_iterator found = pc.find(transferSyntax);
104 if (found != pc.end()) 106 if (found != pc.end())
105 { 107 {
106 presentationContextId = found->second; 108 presentationContextId = found->second;
113 115
114 116
115 DicomStoreUserConnection::DicomStoreUserConnection( 117 DicomStoreUserConnection::DicomStoreUserConnection(
116 const DicomAssociationParameters& params) : 118 const DicomAssociationParameters& params) :
117 parameters_(params), 119 parameters_(params),
120 association_(new DicomAssociation),
118 proposeCommonClasses_(true), 121 proposeCommonClasses_(true),
119 proposeUncompressedSyntaxes_(true), 122 proposeUncompressedSyntaxes_(true),
120 proposeRetiredBigEndian_(false) 123 proposeRetiredBigEndian_(false)
121 { 124 {
122 } 125 }
156 } 159 }
157 160
158 // The association must be re-negotiated 161 // The association must be re-negotiated
159 LOG(INFO) << "Re-negociating DICOM association with " 162 LOG(INFO) << "Re-negociating DICOM association with "
160 << parameters_.GetRemoteApplicationEntityTitle(); 163 << parameters_.GetRemoteApplicationEntityTitle();
161 association_.ClearPresentationContexts(); 164 association_->ClearPresentationContexts();
162 PrepareStorageClass(sopClassUid, transferSyntax); 165 PrepareStorageClass(sopClassUid, transferSyntax);
163 166
164 167
165 /** 168 /**
166 * Step 2: Propose at least the mandatory SOP class. 169 * Step 2: Propose at least the mandatory SOP class.
229 /** 232 /**
230 * Step 5: Open the association, and check whether the pair (SOP 233 * Step 5: Open the association, and check whether the pair (SOP
231 * class UID, transfer syntax) was accepted by the remote host. 234 * class UID, transfer syntax) was accepted by the remote host.
232 **/ 235 **/
233 236
234 association_.Open(parameters_); 237 association_->Open(parameters_);
235 return LookupPresentationContext(presentationContextId, sopClassUid, transferSyntax); 238 return LookupPresentationContext(presentationContextId, sopClassUid, transferSyntax);
236 } 239 }
237 } 240 }