Mercurial > hg > orthanc
comparison Core/DicomNetworking/DicomAssociationParameters.h @ 3875:ea1d32861cfc transcoding
moving timeout from DicomAssocation to DicomAssociationParameters
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 04 May 2020 14:49:31 +0200 |
parents | 3d1bb2193832 |
children | 661c931f22ad |
comparison
equal
deleted
inserted
replaced
3874:2effa961f67f | 3875:ea1d32861cfc |
---|---|
33 | 33 |
34 #pragma once | 34 #pragma once |
35 | 35 |
36 #include "RemoteModalityParameters.h" | 36 #include "RemoteModalityParameters.h" |
37 | 37 |
38 #include <json/value.h> | |
39 | |
38 class OFCondition; // From DCMTK | 40 class OFCondition; // From DCMTK |
39 | 41 |
40 namespace Orthanc | 42 namespace Orthanc |
41 { | 43 { |
42 class DicomAssociationParameters | 44 class DicomAssociationParameters |
43 { | 45 { |
44 private: | 46 private: |
45 std::string localAet_; | 47 std::string localAet_; |
46 std::string remoteAet_; | 48 RemoteModalityParameters remote_; |
47 std::string remoteHost_; | 49 uint32_t timeout_; |
48 uint16_t remotePort_; | |
49 ModalityManufacturer manufacturer_; | |
50 uint32_t timeout_; | |
51 | 50 |
52 void ReadDefaultTimeout(); | 51 static void CheckHost(const std::string& host); |
52 | |
53 static uint32_t GetDefaultTimeout(); | |
53 | 54 |
54 public: | 55 public: |
55 DicomAssociationParameters(); | 56 DicomAssociationParameters(); |
56 | 57 |
57 DicomAssociationParameters(const std::string& localAet, | 58 DicomAssociationParameters(const std::string& localAet, |
60 const std::string& GetLocalApplicationEntityTitle() const | 61 const std::string& GetLocalApplicationEntityTitle() const |
61 { | 62 { |
62 return localAet_; | 63 return localAet_; |
63 } | 64 } |
64 | 65 |
65 const std::string& GetRemoteApplicationEntityTitle() const | |
66 { | |
67 return remoteAet_; | |
68 } | |
69 | |
70 const std::string& GetRemoteHost() const | |
71 { | |
72 return remoteHost_; | |
73 } | |
74 | |
75 uint16_t GetRemotePort() const | |
76 { | |
77 return remotePort_; | |
78 } | |
79 | |
80 ModalityManufacturer GetRemoteManufacturer() const | |
81 { | |
82 return manufacturer_; | |
83 } | |
84 | |
85 void SetLocalApplicationEntityTitle(const std::string& aet) | 66 void SetLocalApplicationEntityTitle(const std::string& aet) |
86 { | 67 { |
87 localAet_ = aet; | 68 localAet_ = aet; |
88 } | 69 } |
89 | 70 |
71 const RemoteModalityParameters& GetRemoteModality() const | |
72 { | |
73 return remote_; | |
74 } | |
75 | |
76 void SetRemoteModality(const RemoteModalityParameters& parameters); | |
77 | |
90 void SetRemoteApplicationEntityTitle(const std::string& aet) | 78 void SetRemoteApplicationEntityTitle(const std::string& aet) |
91 { | 79 { |
92 remoteAet_ = aet; | 80 remote_.SetApplicationEntityTitle(aet); |
93 } | 81 } |
94 | 82 |
95 void SetRemoteHost(const std::string& host); | 83 void SetRemoteHost(const std::string& host); |
96 | 84 |
97 void SetRemotePort(uint16_t port) | 85 void SetRemotePort(uint16_t port) |
98 { | 86 { |
99 remotePort_ = port; | 87 remote_.SetPortNumber(port); |
100 } | 88 } |
101 | 89 |
102 void SetRemoteManufacturer(ModalityManufacturer manufacturer) | 90 void SetRemoteManufacturer(ModalityManufacturer manufacturer) |
103 { | 91 { |
104 manufacturer_ = manufacturer; | 92 remote_.SetManufacturer(manufacturer); |
105 } | 93 } |
106 | |
107 void SetRemoteModality(const RemoteModalityParameters& parameters); | |
108 | 94 |
109 bool IsEqual(const DicomAssociationParameters& other) const; | 95 bool IsEqual(const DicomAssociationParameters& other) const; |
110 | 96 |
111 void SetTimeout(uint32_t seconds) | 97 // Setting it to "0" disables the timeout (infinite wait) |
112 { | 98 void SetTimeout(uint32_t seconds); |
113 timeout_ = seconds; | |
114 } | |
115 | 99 |
116 uint32_t GetTimeout() const | 100 uint32_t GetTimeout() const |
117 { | 101 { |
118 return timeout_; | 102 return timeout_; |
119 } | 103 } |
120 | 104 |
121 bool HasTimeout() const | 105 bool HasTimeout() const |
122 { | 106 { |
123 return timeout_ != 0; | 107 return timeout_ != 0; |
124 } | 108 } |
109 | |
110 void SerializeJob(Json::Value& target) const; | |
111 | |
112 static DicomAssociationParameters UnserializeJob(const Json::Value& serialized); | |
125 | 113 |
126 static void SetDefaultTimeout(uint32_t seconds); | 114 static void SetDefaultTimeout(uint32_t seconds); |
127 }; | 115 }; |
128 } | 116 } |