annotate Applications/BasicApplication.h @ 228:210c1ce8e1a6 am

WasmViewport is no more a singleton
author am@osimis.io
date Thu, 14 Jun 2018 15:06:29 +0200
parents d7b2590744f8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
221
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
1 /**
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
2 * Stone of Orthanc
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
6 *
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
10 * the License, or (at your option) any later version.
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
11 *
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
15 * Affero General Public License for more details.
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
16 *
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
19 **/
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
20
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
21
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
22 #pragma once
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
23
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
24 #include "BasicApplicationContext.h"
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
25
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
26 #include <boost/program_options.hpp>
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
27
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
28 #if ORTHANC_ENABLE_SDL == 1
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
29 # include <SDL.h> // Necessary to avoid undefined reference to `SDL_main'
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
30 #endif
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
31
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
32 namespace OrthancStone
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
33 {
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
34 class IBasicApplication : public boost::noncopyable
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
35 {
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
36 public:
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
37 virtual ~IBasicApplication()
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
38 {
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
39 }
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
40
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
41 virtual void DeclareStartupOption(const std::string& name, const std::string& defaultValue, const std::string& helpText) = 0;
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
42 virtual void Initialize(IStatusBar& statusBar, const std::map<std::string, std::string> startupOptions);
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
43
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
44
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
45 virtual void DeclareCommandLineOptions(boost::program_options::options_description& options) = 0;
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
46
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
47 virtual std::string GetTitle() const = 0;
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
48
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
49 virtual void Initialize(BasicApplicationContext& context,
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
50 IStatusBar& statusBar,
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
51 const boost::program_options::variables_map& parameters) = 0;
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
52
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
53 virtual void Finalize() = 0;
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
54
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
55 #if ORTHANC_ENABLE_SDL == 1
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
56 static int ExecuteWithSdl(IBasicApplication& application,
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
57 int argc,
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
58 char* argv[]);
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
59 #endif
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
60 };
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
61
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
62 class IBasicSdlApplication : public IBasicApplication
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
63 {
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
64 public:
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
65
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
66
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
67 }
d7b2590744f8 wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
diff changeset
68 }