~ubuntu-branches/ubuntu/trusty/ginkgocadx/trusty

« back to all changes in this revision

Viewing changes to src/cadxcore/main/controllers/dcmtk/dicomservers.h

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2013-07-21 11:58:53 UTC
  • mfrom: (7.2.1 sid)
  • Revision ID: package-import@ubuntu.com-20130721115853-44e7n1xujqglu78e
Tags: 3.4.0.928.29+dfsg-1
* New upstream release [July 2013]
  + new B-D: "libjsoncpp-dev".
  + new patch "unbundle-libjsoncpp.patch" to avoid building bundled
    "libjsoncpp-dev".
  + new patch "fix-wx.patch" to avoid FTBFS due to missing
    "-lwx_gtk2u_html-2.8".
* Removed unnecessary versioned Build-Depends.
* Removed obsolete lintian override.
* Reference get-orig-source implementation for orig.tar clean-up and
  DFSG-repackaging.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
#pragma once
15
15
#include <string>
16
16
#include <vector>
 
17
#include <map>
17
18
 
18
19
#include <api/api.h>
 
20
#include <api/autoptr.h>
 
21
#include <api/ilock.h>
19
22
#include <api/internationalization/internationalization.h>
20
23
#include <api/iexception.h>
21
24
 
36
39
        GinkgoNoServerFoundException() throw() : GNC::GCS::IException(_Std("Server not found"), "DICOM", false) {}
37
40
};
38
41
 
 
42
class WLConfig {
 
43
public:
 
44
        WLConfig();
 
45
        WLConfig( const WLConfig& o);
 
46
        WLConfig& operator=(const WLConfig& o);
 
47
        ~WLConfig();
 
48
 
 
49
 
 
50
        bool useDICOMMPPS;
 
51
        bool useAbortMessage;
 
52
        std::string abortTemplate;
 
53
        bool useCompletedMessage;
 
54
        std::string completedTemplate;
 
55
        bool useInProgressMessage;
 
56
        std::string inProgressTemplate;
 
57
};
 
58
 
39
59
class DicomServer {
40
60
public:
41
 
        /* Constructor */
42
 
        inline DicomServer(const std::string& ID, const std::string& AET, const std::string& HostName, int port, int Lossy, bool isDefault, int PDU, bool useTLS, const std::string& pacsUser, const std::string& pacsPass, bool useMove, bool retrSeries, bool reuseConnection, bool verify, const std::string& cert, const std::string& key, const std::string& defaultCharset) {
43
 
                this->ID = ID;
44
 
                this->AET = AET;
45
 
                this->HostName = HostName;
46
 
                this->Port = port;
47
 
                this->Lossy = Lossy;
48
 
                this->isDefault = isDefault;
49
 
                this->PDU = PDU;
50
 
 
51
 
                this->reuseConnection = reuseConnection;
52
 
                retrieveSeries = retrSeries;
53
 
                retrieveWithMove = useMove;
54
 
                this->useTLS    = useTLS;
55
 
                this->pacsUser = pacsUser;
56
 
                this->pacsPass = pacsPass;
57
 
                this->verifyCredentials = verify;
58
 
                this->certificate = cert;
59
 
                this->privateKey  = key;
60
 
                this->defaultCharset = defaultCharset;
61
 
        }
62
 
 
63
 
        inline DicomServer( const DicomServer& o) {
64
 
                *this = o;
65
 
        }
66
 
 
67
 
        inline ~DicomServer() { }
68
 
 
69
 
        DicomServer& operator=(const DicomServer& o)
70
 
        {
71
 
                this->ID = o.ID;
72
 
                this->AET = o.AET;
73
 
                this->HostName = o.HostName;
74
 
                this->Port = o.Port;
75
 
                this->Lossy = o.Lossy;
76
 
                this->isDefault = o.isDefault;
77
 
                this->PDU = o.PDU;
78
 
                this->useTLS = o.useTLS;
79
 
                this->pacsUser = o.pacsUser;
80
 
                this->pacsPass = o.pacsPass;
81
 
                this->retrieveWithMove = o.retrieveWithMove;
82
 
                this->reuseConnection = o.reuseConnection;
83
 
                this->retrieveSeries = o.retrieveSeries;
84
 
                this->verifyCredentials = o.verifyCredentials;
85
 
                this->certificate = o.certificate;
86
 
                this->privateKey = o.privateKey;
87
 
                this->defaultCharset = o.defaultCharset;
88
 
                return *this;
89
 
        }
90
 
 
91
 
        const std::string& GetID()
92
 
        {
93
 
                return ID;
94
 
        }
95
 
 
96
 
        const std::string& GetAET()
97
 
        {
98
 
                return AET;
99
 
        }
100
 
 
101
 
        const std::string& GetHostName()
102
 
        {
103
 
                return HostName;
104
 
        }
105
 
 
106
 
        int GetPort()
107
 
        {
108
 
                return Port;
109
 
        }
110
 
 
111
 
        int GetLossy()
112
 
        {
113
 
                return Lossy;
114
 
        }
115
 
 
116
 
        bool GetIsDefault() 
117
 
        {
118
 
                return isDefault;
119
 
        }
120
 
 
121
 
        int GetPDU()
122
 
        {
123
 
                return PDU;
124
 
        }
125
 
 
126
 
        bool GetUseTLS()
127
 
        {
128
 
                return useTLS;
129
 
        }
130
 
 
131
 
        const std::string& GetPACSUser()
132
 
        {
133
 
                return pacsUser;
134
 
        }
135
 
 
136
 
        const std::string& GetPACSPass()
137
 
        {
138
 
                return pacsPass;
139
 
        }
140
 
 
141
 
        bool GetRetrieveWithMove()
142
 
        {
143
 
                return retrieveWithMove;
144
 
        }
145
 
 
146
 
        bool GetRetrieveSeries()
147
 
        {
148
 
                return retrieveSeries;
149
 
        }
150
 
 
151
 
        bool GetRetrieveWithGet()
152
 
        {
153
 
                return !retrieveWithMove;
154
 
        }
155
 
 
156
 
        bool GetReuseConnection()
157
 
        {
158
 
                return reuseConnection;
159
 
        }
160
 
 
161
 
        bool GetverifyCredentials()
162
 
        {
163
 
                return verifyCredentials;
164
 
        }
165
 
 
166
 
        const std::string& GetCertificate()
167
 
        {
168
 
                return certificate;
169
 
        }
170
 
 
171
 
        const std::string& GetPrivateKey()
172
 
        {
173
 
                return privateKey;
174
 
        }
175
 
 
176
 
        const std::string& GetDefaultCharset()
177
 
        {
178
 
                return defaultCharset;
179
 
        }
 
61
        typedef enum TRetrieveMethod {
 
62
                MOVE = 0,
 
63
                GET,
 
64
                WADO
 
65
        }TRetrieveMethod;
 
66
        /* Constructor with all parameters*/
 
67
        DicomServer(const std::string& ID, const std::string& AET, const std::string& HostName, int port, int Lossy, bool isDefault, int PDU, bool useTLS, const std::string& pacsUser, const std::string& pacsPass, TRetrieveMethod retrieveMethod, const std::string& wadoURI, bool retrSeries, bool reuseConnection, bool verify, const std::string& cert, const std::string& key, const std::string& defaultCharset) ;
 
68
 
 
69
        /**local server constructor*/
 
70
        DicomServer(const std::string& ID, const std::string& AET, const std::string& HostName, int port, int PDU) ;
 
71
        /**
 
72
        default constructor
 
73
        */
 
74
        DicomServer();
 
75
 
 
76
        DicomServer( const DicomServer& o);
 
77
 
 
78
        ~DicomServer();
 
79
 
 
80
        DicomServer& operator=(const DicomServer& o);
 
81
 
 
82
        const std::string& GetID();
 
83
 
 
84
        const std::string& GetAET();
 
85
 
 
86
        const std::string& GetHostName();
 
87
 
 
88
        int GetPort();
 
89
 
 
90
        int GetLossy();
 
91
 
 
92
        bool GetIsDefault() ;
 
93
 
 
94
        int GetPDU();
 
95
 
 
96
        bool GetUseTLS();
 
97
 
 
98
        const std::string& GetPACSUser();
 
99
 
 
100
        const std::string& GetPACSPass();
 
101
 
 
102
        TRetrieveMethod GetRetrieveMethod();
 
103
 
 
104
        bool GetRetrieveSeries();
 
105
 
 
106
        bool GetReuseConnection();
 
107
 
 
108
        bool GetverifyCredentials();
 
109
 
 
110
        const std::string& GetCertificate();
 
111
 
 
112
        const std::string& GetPrivateKey();
 
113
 
 
114
        const std::string& GetDefaultCharset();
 
115
 
 
116
        const std::string& GetWADOURI() ;
 
117
 
 
118
        WLConfig& GetWlConfig() ;
180
119
 
181
120
        std::string ID;
182
121
        std::string AET;
186
125
        int  Lossy;
187
126
        bool isDefault;
188
127
 
189
 
        bool retrieveWithMove;
 
128
        WLConfig wlConfig;
 
129
 
 
130
        TRetrieveMethod retrieveMethod;
 
131
        std::string wadoURI;
190
132
        bool reuseConnection;
191
133
        bool retrieveSeries;
192
134
        bool useTLS;
198
140
        std::string defaultCharset;
199
141
};
200
142
 
201
 
class EXTAPI DicomServerHolder {
202
 
public:
203
 
        DicomServer server;
204
 
        DicomServerHolder* next;
205
 
 
206
 
        DicomServerHolder(const std::string& ID, const std::string& AET, const std::string& HostName, int Port, int Lossy, bool isDefault, int PDU, bool useTLS, const std::string& pacsUser, const std::string& pacsPass, bool useMove, bool retrSeries, bool reuseConnection, bool verify, const std::string& cert, const std::string& key, const std::string& defaultCharset) : 
207
 
         server(ID, AET, HostName, Port, Lossy, isDefault, PDU, useTLS, pacsUser, pacsPass, useMove, retrSeries, reuseConnection, verify, cert, key, defaultCharset) {
208
 
                next = NULL;
209
 
        }
210
 
        ~DicomServerHolder() {}
211
 
};
212
 
 
213
 
class EXTAPI DicomServerList {
214
 
public:
 
143
class EXTAPI DicomServerList: public GNC::GCS::ILockable {
 
144
public:
 
145
        typedef std::list<GNC::GCS::Ptr<DicomServer> > TServerList;
 
146
        typedef std::map<std::string, GNC::GCS::Ptr<DicomServer> > TServerMap;
 
147
 
215
148
        static DicomServerList* Instance();
216
149
        static void FreeInstance();
217
150
 
218
151
        void AddServer(const DicomServer& server, bool isDefault);
219
152
        bool TieneServer(const std::string& ID);
220
 
        DicomServer* GetLocalServer();
221
 
        DicomServer* GetServer(const std::string& ID);
222
 
        DicomServerHolder* GetList();
223
 
        DicomServer* GetDefaultServer();
 
153
        const GNC::GCS::Ptr<DicomServer>& GetLocalServer();
 
154
        const GNC::GCS::Ptr<DicomServer>& GetServer(const std::string& ID);
 
155
        const GNC::GCS::Ptr<DicomServer>& GetDefaultServer();
224
156
        void SetDefaultServer(const std::string& ID);
225
 
        DicomServer* GetFirst();
226
 
        DicomServer* GetLast();
 
157
        bool Empty();
 
158
        TServerList GetServerList();
227
159
        void Reload();
228
160
 
229
161
protected:
230
162
        DicomServerList();
231
163
        ~DicomServerList();
232
 
        DicomServerHolder* serverHolders;
233
 
        DicomServerHolder* lastInsertedHolder;
234
 
        DicomServer* localServer;
 
164
        TServerMap ServerMap;
 
165
         GNC::GCS::Ptr<DicomServer> LocalServer;
235
166
 
236
167
protected:
237
168
        static DicomServerList *m_pInstance;