comparison Plugin/GoogleUpdater.h @ 0:520cba9a0d42

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