annotate Framework/Common/RetryDatabaseFactory.h @ 227:39cb02035f54

added missing files
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 02 Apr 2021 19:27:32 +0200
parents
children 16aac0287485
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
227
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "IDatabaseFactory.h"
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include <Compatibility.h>
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 namespace OrthancDatabases
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 {
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 class RetryDatabaseFactory : public IDatabaseFactory
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 {
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 private:
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 unsigned int maxConnectionRetries_;
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 unsigned int connectionRetryInterval_;
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 protected:
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 virtual IDatabase* TryOpen() = 0;
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 public:
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 RetryDatabaseFactory(unsigned int maxConnectionRetries,
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 unsigned int connectionRetryInterval) :
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 maxConnectionRetries_(maxConnectionRetries),
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 connectionRetryInterval_(connectionRetryInterval)
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 {
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 }
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 virtual IDatabase* Open() ORTHANC_OVERRIDE;
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 };
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 }