annotate Plugin/GoogleUpdater.h @ 54:509334672b6b default tip

updated copyright, as Orthanc Team now replaces Osimis
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 30 May 2024 22:48:01 +0200
parents 21499c134785
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Google Cloud Platform credentials for DICOMweb and Orthanc
54
509334672b6b updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 42
diff changeset
3 * Copyright (C) 2019-2023 Osimis S.A., Belgium
509334672b6b updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 42
diff changeset
4 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
509334672b6b updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 42
diff changeset
5 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
0
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * In addition, as a special exception, the copyright holders of this
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * program give permission to link the code of its release with the
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * that use the same license as the "OpenSSL" library), and distribute
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * the linked executables. You must obey the GNU General Public License
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * in all respects for all of the code used other than "OpenSSL". If you
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * modify file(s) with this exception, you may extend this exception to
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * your version of the file(s), but you are not obligated to do so. If
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * you do not wish to do so, delete this exception statement from your
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * version. If you delete this exception statement from all source files
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * in the program, then also delete it here.
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 *
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * This program is distributed in the hope that it will be useful, but
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * General Public License for more details.
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 *
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 **/
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #pragma once
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 #include "GoogleAccount.h"
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 #include <boost/thread.hpp>
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 class GoogleUpdater : public boost::noncopyable
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 {
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 private:
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 enum State
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 {
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 State_Setup,
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 State_Running,
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 State_Done
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 };
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 static void Worker(const State* state,
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 const GoogleAccount* account,
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 long refreshIntervalSeconds);
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 State state_;
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 std::vector<boost::thread*> workers_;
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 // Singleton
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 GoogleUpdater() :
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 state_(State_Setup)
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 {
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 }
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 public:
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 static GoogleUpdater& GetInstance()
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 {
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 static GoogleUpdater updater;
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 return updater;
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 }
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 ~GoogleUpdater();
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 void Start();
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 void Stop();
520cba9a0d42 initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 };