Mercurial > hg > orthanc
annotate OrthancServer/Sources/Database/Compatibility/SetOfResources.h @ 5084:9770d537880d attach-custom-data
added support for revision in SQLite + avoid upgrading DB version
author | Alain Mazy <am@osimis.io> |
---|---|
date | Thu, 15 Sep 2022 09:02:07 +0200 |
parents | 6eff25f70121 |
children | 0ea402b4d901 |
rev | line source |
---|---|
1746 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1746 | 4 * Department, University Hospital of Liege, Belgium |
4870
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
1746 | 7 * |
8 * This program is free software: you can redistribute it and/or | |
9 * modify it under the terms of the GNU General Public License as | |
10 * published by the Free Software Foundation, either version 3 of the | |
11 * License, or (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 * General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 **/ | |
21 | |
22 | |
23 #pragma once | |
24 | |
4045 | 25 #include "../../../../OrthancFramework/Sources/Compatibility.h" |
3093
2e1808b6146a
reorganization of folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3085
diff
changeset
|
26 #include "../IDatabaseWrapper.h" |
3085 | 27 #include "ILookupResources.h" |
1746 | 28 |
29 #include <set> | |
30 #include <memory> | |
31 | |
32 namespace Orthanc | |
33 { | |
3056
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
34 namespace Compatibility |
1746 | 35 { |
3056
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
36 class SetOfResources : public boost::noncopyable |
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
37 { |
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
38 private: |
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
39 typedef std::set<int64_t> Resources; |
1746 | 40 |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
41 IDatabaseWrapper::ITransaction& transaction_; |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
42 ResourceType level_; |
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
43 std::unique_ptr<Resources> resources_; |
1746 | 44 |
3056
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
45 public: |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
46 SetOfResources(IDatabaseWrapper::ITransaction& transaction, |
3056
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
47 ResourceType level) : |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
48 transaction_(transaction), |
3056
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
49 level_(level) |
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
50 { |
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
51 } |
1746 | 52 |
3056
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
53 ResourceType GetLevel() const |
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
54 { |
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
55 return level_; |
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
56 } |
1746 | 57 |
3056
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
58 void Intersect(const std::list<int64_t>& resources); |
1746 | 59 |
3056
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
60 void GoDown(); |
1746 | 61 |
3085 | 62 void Flatten(ILookupResources& compatibility, |
3084 | 63 std::list<int64_t>& result); |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1747
diff
changeset
|
64 |
3056
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
65 void Flatten(std::list<std::string>& result); |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1747
diff
changeset
|
66 |
3056
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
67 void Clear() |
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
68 { |
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
69 resources_.reset(NULL); |
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
70 } |
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
71 }; |
6c5d4281da4a
removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3050
diff
changeset
|
72 } |
1746 | 73 } |