Mercurial > hg > orthanc-databases
comparison Framework/PostgreSQL/PostgreSQLParameters.h @ 0:7cea966b6829
initial commit
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 04 Jul 2018 08:16:29 +0200 |
parents | |
children | 714c5d2bee76 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:7cea966b6829 |
---|---|
1 /** | |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
24 #if ORTHANC_ENABLE_POSTGRESQL != 1 | |
25 # error PostgreSQL support must be enabled to use this file | |
26 #endif | |
27 | |
28 #include <Plugins/Samples/Common/OrthancPluginCppWrapper.h> | |
29 | |
30 namespace OrthancDatabases | |
31 { | |
32 class PostgreSQLParameters | |
33 { | |
34 private: | |
35 std::string host_; | |
36 uint16_t port_; | |
37 std::string username_; | |
38 std::string password_; | |
39 std::string database_; | |
40 std::string uri_; | |
41 bool lock_; | |
42 | |
43 void Reset(); | |
44 | |
45 public: | |
46 PostgreSQLParameters(); | |
47 | |
48 PostgreSQLParameters(const OrthancPlugins::OrthancConfiguration& configuration); | |
49 | |
50 void SetConnectionUri(const std::string& uri); | |
51 | |
52 std::string GetConnectionUri() const; | |
53 | |
54 void SetHost(const std::string& host); | |
55 | |
56 const std::string& GetHost() const | |
57 { | |
58 return host_; | |
59 } | |
60 | |
61 void SetPortNumber(unsigned int port); | |
62 | |
63 uint16_t GetPortNumber() const | |
64 { | |
65 return port_; | |
66 } | |
67 | |
68 void SetUsername(const std::string& username); | |
69 | |
70 const std::string& GetUsername() const | |
71 { | |
72 return username_; | |
73 } | |
74 | |
75 void SetPassword(const std::string& password); | |
76 | |
77 const std::string& GetPassword() const | |
78 { | |
79 return password_; | |
80 } | |
81 | |
82 void SetDatabase(const std::string& database); | |
83 | |
84 void ResetDatabase() | |
85 { | |
86 SetDatabase(""); | |
87 } | |
88 | |
89 const std::string& GetDatabase() const | |
90 { | |
91 return database_; | |
92 } | |
93 | |
94 void SetLock(bool lock) | |
95 { | |
96 lock_ = lock; | |
97 } | |
98 | |
99 bool HasLock() const | |
100 { | |
101 return lock_; | |
102 } | |
103 | |
104 void Format(std::string& target) const; | |
105 }; | |
106 } |