Mercurial > hg > orthanc
annotate Plugins/Samples/StorageArea/Plugin.cpp @ 1758:318c2e83c2bd db-changes
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 28 Oct 2015 12:53:45 +0100 |
parents | 87c77b9b3679 |
children | b1291df2f780 |
rev | line source |
---|---|
1136
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics |
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1136
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
1136
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * |
1375
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1304
diff
changeset
|
6 * This program is free software: you can redistribute it and/or |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1304
diff
changeset
|
7 * modify it under the terms of the GNU General Public License as |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1304
diff
changeset
|
8 * published by the Free Software Foundation, either version 3 of the |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1304
diff
changeset
|
9 * License, or (at your option) any later version. |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1304
diff
changeset
|
10 * |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1304
diff
changeset
|
11 * This program is distributed in the hope that it will be useful, but |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1304
diff
changeset
|
12 * WITHOUT ANY WARRANTY; without even the implied warranty of |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1304
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1304
diff
changeset
|
14 * General Public License for more details. |
1136
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * |
1375
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1304
diff
changeset
|
16 * You should have received a copy of the GNU General Public License |
3d76e26b3865
fix licensing terms of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1304
diff
changeset
|
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1136
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 **/ |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
1425
97268448bdfc
refactoring of samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1375
diff
changeset
|
21 #include <orthanc/OrthancCPlugin.h> |
1136
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 #include <string.h> |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include <stdio.h> |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 #include <string> |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 static OrthancPluginContext* context = NULL; |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 static std::string GetPath(const char* uuid) |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 { |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 return "plugin_" + std::string(uuid); |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 } |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 |
1627
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
36 static OrthancPluginErrorCode StorageCreate(const char* uuid, |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
37 const void* content, |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
38 int64_t size, |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
39 OrthancPluginContentType type) |
1136
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 { |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 std::string path = GetPath(uuid); |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 FILE* fp = fopen(path.c_str(), "wb"); |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 if (!fp) |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 { |
1643
87c77b9b3679
provision for error codes in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
46 return OrthancPluginErrorCode_StorageAreaPlugin; |
1136
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 } |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 bool ok = fwrite(content, size, 1, fp) == 1; |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 fclose(fp); |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 |
1643
87c77b9b3679
provision for error codes in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
52 return ok ? OrthancPluginErrorCode_Success : OrthancPluginErrorCode_StorageAreaPlugin; |
1136
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 } |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 |
1627
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
56 static OrthancPluginErrorCode StorageRead(void** content, |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
57 int64_t* size, |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
58 const char* uuid, |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
59 OrthancPluginContentType type) |
1136
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 { |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 std::string path = GetPath(uuid); |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 FILE* fp = fopen(path.c_str(), "rb"); |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 if (!fp) |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 { |
1643
87c77b9b3679
provision for error codes in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
66 return OrthancPluginErrorCode_StorageAreaPlugin; |
1136
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 } |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 if (fseek(fp, 0, SEEK_END) < 0) |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 { |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 fclose(fp); |
1643
87c77b9b3679
provision for error codes in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
72 return OrthancPluginErrorCode_StorageAreaPlugin; |
1136
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 } |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 *size = ftell(fp); |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 if (fseek(fp, 0, SEEK_SET) < 0) |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 { |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 fclose(fp); |
1643
87c77b9b3679
provision for error codes in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
80 return OrthancPluginErrorCode_StorageAreaPlugin; |
1136
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 } |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 bool ok = true; |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 if (*size == 0) |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 { |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 *content = NULL; |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 } |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 else |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 { |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 *content = malloc(*size); |
1304 | 92 if (*content == NULL || |
1136
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 fread(*content, *size, 1, fp) != 1) |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 { |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 ok = false; |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 } |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 } |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 fclose(fp); |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 |
1643
87c77b9b3679
provision for error codes in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
101 return ok ? OrthancPluginErrorCode_Success : OrthancPluginErrorCode_StorageAreaPlugin; |
1136
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 } |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 |
1627
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
105 static OrthancPluginErrorCode StorageRemove(const char* uuid, |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
106 OrthancPluginContentType type) |
1136
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
107 { |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 std::string path = GetPath(uuid); |
1627
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
109 |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
110 if (remove(path.c_str()) == 0) |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
111 { |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
112 return OrthancPluginErrorCode_Success; |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
113 } |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
114 else |
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
115 { |
1643
87c77b9b3679
provision for error codes in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1627
diff
changeset
|
116 return OrthancPluginErrorCode_StorageAreaPlugin; |
1627
da7854deb662
Plugin callbacks must now return explicit "OrthancPluginErrorCode" instead of integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1425
diff
changeset
|
117 } |
1136
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 } |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 extern "C" |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 { |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c) |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 { |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
125 context = c; |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
126 OrthancPluginLogWarning(context, "Storage plugin is initializing"); |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
127 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
128 /* Check the version of the Orthanc core */ |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
129 if (OrthancPluginCheckVersion(c) == 0) |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
130 { |
1304 | 131 char info[1024]; |
1136
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 sprintf(info, "Your version of Orthanc (%s) must be above %d.%d.%d to run this plugin", |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 c->orthancVersion, |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER, |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER, |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER); |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 OrthancPluginLogError(context, info); |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 return -1; |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 } |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 OrthancPluginRegisterStorageArea(context, StorageCreate, StorageRead, StorageRemove); |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 return 0; |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 } |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
146 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 ORTHANC_PLUGINS_API void OrthancPluginFinalize() |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 { |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 OrthancPluginLogWarning(context, "Storage plugin is finalizing"); |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 } |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 ORTHANC_PLUGINS_API const char* OrthancPluginGetName() |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
154 { |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 return "storage"; |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 } |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 ORTHANC_PLUGINS_API const char* OrthancPluginGetVersion() |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 { |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 return "1.0"; |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 } |
208dc67b9bab
sample custom storage plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 } |