Mercurial > hg > orthanc-object-storage
annotate Common/Resources/Orthanc/CMake/EmbedResources.py @ 117:a3590caf93a3 2.3.0
sync orthanc folder
author | Alain Mazy <am@osimis.io> |
---|---|
date | Mon, 13 Nov 2023 20:56:41 +0100 |
parents | 37a4b8e2577f |
children | 40efe821932a |
rev | line source |
---|---|
59
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 #!/usr/bin/python |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 # Orthanc - A Lightweight, RESTful DICOM Store |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 # Department, University Hospital of Liege, Belgium |
110 | 6 # Copyright (C) 2017-2023 Osimis S.A., Belgium |
7 # Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium | |
59
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 # |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 # This program is free software: you can redistribute it and/or |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 # modify it under the terms of the GNU Lesser General Public License |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 # as published by the Free Software Foundation, either version 3 of |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 # the License, or (at your option) any later version. |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 # |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 # This program is distributed in the hope that it will be useful, but |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 # WITHOUT ANY WARRANTY; without even the implied warranty of |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 # Lesser General Public License for more details. |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 # |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 # You should have received a copy of the GNU Lesser General Public |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 # License along with this program. If not, see |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 # <http://www.gnu.org/licenses/>. |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 import sys |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 import os |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 import os.path |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 import pprint |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 import re |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 UPCASE_CHECK = True |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 USE_SYSTEM_EXCEPTION = False |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 EXCEPTION_CLASS = 'OrthancException' |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 OUT_OF_RANGE_EXCEPTION = '::Orthanc::OrthancException(::Orthanc::ErrorCode_ParameterOutOfRange)' |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 INEXISTENT_PATH_EXCEPTION = '::Orthanc::OrthancException(::Orthanc::ErrorCode_InexistentItem)' |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 NAMESPACE = 'Orthanc.EmbeddedResources' |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 FRAMEWORK_PATH = None |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 ARGS = [] |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 for i in range(len(sys.argv)): |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 if not sys.argv[i].startswith('--'): |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 ARGS.append(sys.argv[i]) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 elif sys.argv[i].lower() == '--no-upcase-check': |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 UPCASE_CHECK = False |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 elif sys.argv[i].lower() == '--system-exception': |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 USE_SYSTEM_EXCEPTION = True |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 EXCEPTION_CLASS = '::std::runtime_error' |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 OUT_OF_RANGE_EXCEPTION = '%s("Parameter out of range")' % EXCEPTION_CLASS |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 INEXISTENT_PATH_EXCEPTION = '%s("Unknown path in a directory resource")' % EXCEPTION_CLASS |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 elif sys.argv[i].startswith('--namespace='): |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 NAMESPACE = sys.argv[i][sys.argv[i].find('=') + 1 : ] |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 elif sys.argv[i].startswith('--framework-path='): |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 FRAMEWORK_PATH = sys.argv[i][sys.argv[i].find('=') + 1 : ] |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 if len(ARGS) < 2 or len(ARGS) % 2 != 0: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 print ('Usage:') |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 print ('python %s [--no-upcase-check] [--system-exception] [--namespace=<Namespace>] <TargetBaseFilename> [ <Name> <Source> ]*' % sys.argv[0]) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 exit(-1) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 TARGET_BASE_FILENAME = ARGS[1] |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 SOURCES = ARGS[2:] |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 try: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 # Make sure the destination directory exists |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 os.makedirs(os.path.normpath(os.path.join(TARGET_BASE_FILENAME, '..'))) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 except: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 pass |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 ##################################################################### |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 ## Read each resource file |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 ##################################################################### |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 def CheckNoUpcase(s): |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 global UPCASE_CHECK |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 if (UPCASE_CHECK and |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 re.search('[A-Z]', s) != None): |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 raise Exception("Path in a directory with an upcase letter: %s" % s) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 resources = {} |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 counter = 0 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 i = 0 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 while i < len(SOURCES): |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 resourceName = SOURCES[i].upper() |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 pathName = SOURCES[i + 1] |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 if not os.path.exists(pathName): |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 raise Exception("Non existing path: %s" % pathName) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 if resourceName in resources: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 raise Exception("Twice the same resource: " + resourceName) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 if os.path.isdir(pathName): |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 # The resource is a directory: Recursively explore its files |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 content = {} |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 for root, dirs, files in os.walk(pathName): |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 dirs.sort() |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 files.sort() |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 base = os.path.relpath(root, pathName) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 # Fix issue #24 (Build fails on OSX when directory has .DS_Store files): |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 # Ignore folders whose name starts with a dot (".") |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 if base.find('/.') != -1: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 print('Ignoring folder: %s' % root) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 continue |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
106 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
107 for f in files: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 if f.find('~') == -1: # Ignore Emacs backup files |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
109 if base == '.': |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 r = f |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 else: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 r = os.path.join(base, f) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 CheckNoUpcase(r) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 r = '/' + r.replace('\\', '/') |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 if r in content: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 raise Exception("Twice the same filename (check case): " + r) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 content[r] = { |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 'Filename' : os.path.join(root, f), |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 'Index' : counter |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 } |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 counter += 1 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
125 resources[resourceName] = { |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
126 'Type' : 'Directory', |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
127 'Files' : content |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
128 } |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
129 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
130 elif os.path.isfile(pathName): |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 resources[resourceName] = { |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 'Type' : 'File', |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 'Index' : counter, |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 'Filename' : pathName |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 } |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 counter += 1 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 else: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 raise Exception("Not a regular file, nor a directory: " + pathName) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 i += 2 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 #pprint.pprint(resources) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
146 ##################################################################### |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 ## Write .h header |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 ##################################################################### |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 header = open(TARGET_BASE_FILENAME + '.h', 'w') |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 header.write(""" |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 #pragma once |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
154 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 #include <string> |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 #include <list> |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 #if defined(_MSC_VER) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 # pragma warning(disable: 4065) // "Switch statement contains 'default' but no 'case' labels" |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 #endif |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 """) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 for ns in NAMESPACE.split('.'): |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 header.write('namespace %s {\n' % ns) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
168 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
169 header.write(""" |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
170 enum FileResourceId |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
171 { |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
172 """) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
174 isFirst = True |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
175 for name in resources: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
176 if resources[name]['Type'] == 'File': |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
177 if isFirst: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
178 isFirst = False |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
179 else: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
180 header.write(',\n') |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
181 header.write(' %s' % name) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
182 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
183 header.write(""" |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
184 }; |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
185 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
186 enum DirectoryResourceId |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
187 { |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
188 """) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
189 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
190 isFirst = True |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
191 for name in resources: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
192 if resources[name]['Type'] == 'Directory': |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
193 if isFirst: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
194 isFirst = False |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
195 else: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
196 header.write(',\n') |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
197 header.write(' %s' % name) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
198 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
199 header.write(""" |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
200 }; |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
201 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
202 const void* GetFileResourceBuffer(FileResourceId id); |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
203 size_t GetFileResourceSize(FileResourceId id); |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
204 void GetFileResource(std::string& result, FileResourceId id); |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
205 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
206 const void* GetDirectoryResourceBuffer(DirectoryResourceId id, const char* path); |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
207 size_t GetDirectoryResourceSize(DirectoryResourceId id, const char* path); |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
208 void GetDirectoryResource(std::string& result, DirectoryResourceId id, const char* path); |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
209 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
210 void ListResources(std::list<std::string>& result, DirectoryResourceId id); |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
211 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
212 """) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
213 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
214 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
215 for ns in NAMESPACE.split('.'): |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
216 header.write('}\n') |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
217 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
218 header.close() |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
219 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
220 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
221 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
222 ##################################################################### |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
223 ## Write the resource content in the .cpp source |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
224 ##################################################################### |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
225 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
226 PYTHON_MAJOR_VERSION = sys.version_info[0] |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
227 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
228 def WriteResource(cpp, item): |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
229 cpp.write(' static const uint8_t resource%dBuffer[] = {' % item['Index']) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
230 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
231 f = open(item['Filename'], "rb") |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
232 content = f.read() |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
233 f.close() |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
234 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
235 # http://stackoverflow.com/a/1035360 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
236 pos = 0 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
237 buffer = [] # instead of appending a few bytes at a time to the cpp file, |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
238 # we first append each chunk to a list, join it and write it |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
239 # to the file. We've measured that it was 2-3 times faster in python3. |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
240 # Note that speed is important since if generation is too slow, |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
241 # cmake might try to compile the EmbeddedResources.cpp file while it is |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
242 # still being generated ! |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
243 for b in content: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
244 if PYTHON_MAJOR_VERSION == 2: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
245 c = ord(b[0]) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
246 else: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
247 c = b |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
248 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
249 if pos > 0: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
250 buffer.append(",") |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
251 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
252 if (pos % 16) == 0: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
253 buffer.append("\n") |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
254 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
255 if c < 0: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
256 raise Exception("Internal error") |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
257 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
258 buffer.append("0x%02x" % c) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
259 pos += 1 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
260 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
261 cpp.write("".join(buffer)) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
262 # Zero-size array are disallowed, so we put one single void character in it. |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
263 if pos == 0: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
264 cpp.write(' 0') |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
265 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
266 cpp.write(' };\n') |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
267 cpp.write(' static const size_t resource%dSize = %d;\n' % (item['Index'], pos)) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
268 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
269 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
270 cpp = open(TARGET_BASE_FILENAME + '.cpp', 'w') |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
271 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
272 cpp.write('#include "%s.h"\n' % os.path.basename(TARGET_BASE_FILENAME)) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
273 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
274 if USE_SYSTEM_EXCEPTION: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
275 cpp.write('#include <stdexcept>') |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
276 elif FRAMEWORK_PATH != None: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
277 cpp.write('#include "%s/OrthancException.h"' % FRAMEWORK_PATH) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
278 else: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
279 cpp.write('#include <OrthancException.h>') |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
280 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
281 cpp.write(""" |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
282 #include <stdint.h> |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
283 #include <string.h> |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
284 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
285 """) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
286 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
287 for ns in NAMESPACE.split('.'): |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
288 cpp.write('namespace %s {\n' % ns) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
289 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
290 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
291 for name in resources: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
292 if resources[name]['Type'] == 'File': |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
293 WriteResource(cpp, resources[name]) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
294 else: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
295 for f in resources[name]['Files']: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
296 WriteResource(cpp, resources[name]['Files'][f]) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
297 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
298 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
299 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
300 ##################################################################### |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
301 ## Write the accessors to the file resources in .cpp |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
302 ##################################################################### |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
303 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
304 cpp.write(""" |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
305 const void* GetFileResourceBuffer(FileResourceId id) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
306 { |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
307 switch (id) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
308 { |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
309 """) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
310 for name in resources: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
311 if resources[name]['Type'] == 'File': |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
312 cpp.write(' case %s:\n' % name) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
313 cpp.write(' return resource%dBuffer;\n' % resources[name]['Index']) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
314 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
315 cpp.write(""" |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
316 default: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
317 throw %s; |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
318 } |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
319 } |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
320 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
321 size_t GetFileResourceSize(FileResourceId id) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
322 { |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
323 switch (id) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
324 { |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
325 """ % OUT_OF_RANGE_EXCEPTION) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
326 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
327 for name in resources: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
328 if resources[name]['Type'] == 'File': |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
329 cpp.write(' case %s:\n' % name) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
330 cpp.write(' return resource%dSize;\n' % resources[name]['Index']) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
331 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
332 cpp.write(""" |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
333 default: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
334 throw %s; |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
335 } |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
336 } |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
337 """ % OUT_OF_RANGE_EXCEPTION) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
338 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
339 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
340 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
341 ##################################################################### |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
342 ## Write the accessors to the directory resources in .cpp |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
343 ##################################################################### |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
344 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
345 cpp.write(""" |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
346 const void* GetDirectoryResourceBuffer(DirectoryResourceId id, const char* path) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
347 { |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
348 switch (id) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
349 { |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
350 """) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
351 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
352 for name in resources: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
353 if resources[name]['Type'] == 'Directory': |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
354 cpp.write(' case %s:\n' % name) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
355 isFirst = True |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
356 for path in resources[name]['Files']: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
357 cpp.write(' if (!strcmp(path, "%s"))\n' % path) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
358 cpp.write(' return resource%dBuffer;\n' % resources[name]['Files'][path]['Index']) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
359 cpp.write(' throw %s;\n\n' % INEXISTENT_PATH_EXCEPTION) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
360 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
361 cpp.write(""" default: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
362 throw %s; |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
363 } |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
364 } |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
365 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
366 size_t GetDirectoryResourceSize(DirectoryResourceId id, const char* path) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
367 { |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
368 switch (id) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
369 { |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
370 """ % OUT_OF_RANGE_EXCEPTION) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
371 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
372 for name in resources: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
373 if resources[name]['Type'] == 'Directory': |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
374 cpp.write(' case %s:\n' % name) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
375 isFirst = True |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
376 for path in resources[name]['Files']: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
377 cpp.write(' if (!strcmp(path, "%s"))\n' % path) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
378 cpp.write(' return resource%dSize;\n' % resources[name]['Files'][path]['Index']) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
379 cpp.write(' throw %s;\n\n' % INEXISTENT_PATH_EXCEPTION) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
380 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
381 cpp.write(""" default: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
382 throw %s; |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
383 } |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
384 } |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
385 """ % OUT_OF_RANGE_EXCEPTION) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
386 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
387 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
388 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
389 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
390 ##################################################################### |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
391 ## List the resources in a directory |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
392 ##################################################################### |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
393 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
394 cpp.write(""" |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
395 void ListResources(std::list<std::string>& result, DirectoryResourceId id) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
396 { |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
397 result.clear(); |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
398 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
399 switch (id) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
400 { |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
401 """) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
402 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
403 for name in resources: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
404 if resources[name]['Type'] == 'Directory': |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
405 cpp.write(' case %s:\n' % name) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
406 for path in sorted(resources[name]['Files']): |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
407 cpp.write(' result.push_back("%s");\n' % path) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
408 cpp.write(' break;\n\n') |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
409 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
410 cpp.write(""" default: |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
411 throw %s; |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
412 } |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
413 } |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
414 """ % OUT_OF_RANGE_EXCEPTION) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
415 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
416 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
417 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
418 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
419 ##################################################################### |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
420 ## Write the convenience wrappers in .cpp |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
421 ##################################################################### |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
422 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
423 cpp.write(""" |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
424 void GetFileResource(std::string& result, FileResourceId id) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
425 { |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
426 size_t size = GetFileResourceSize(id); |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
427 result.resize(size); |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
428 if (size > 0) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
429 memcpy(&result[0], GetFileResourceBuffer(id), size); |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
430 } |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
431 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
432 void GetDirectoryResource(std::string& result, DirectoryResourceId id, const char* path) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
433 { |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
434 size_t size = GetDirectoryResourceSize(id, path); |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
435 result.resize(size); |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
436 if (size > 0) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
437 memcpy(&result[0], GetDirectoryResourceBuffer(id, path), size); |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
438 } |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
439 """) |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
440 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
441 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
442 for ns in NAMESPACE.split('.'): |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
443 cpp.write('}\n') |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
444 |
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
445 cpp.close() |