annotate OrthancServer/Sources/Database/Compatibility/SetOfResources.cpp @ 5852:ea547160f27e find-refactoring

StatelessDatabaseOperations: reimplementing LookupAttachment()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 29 Oct 2024 15:57:53 +0000
parents f7adfb22e20e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1753
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
5640
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 *
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * This program is free software: you can redistribute it and/or
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * modify it under the terms of the GNU General Public License as
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * published by the Free Software Foundation, either version 3 of the
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * License, or (at your option) any later version.
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 *
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful, but
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * General Public License for more details.
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 *
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 **/
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
3052
c7db469bbe8e new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3050
diff changeset
24 #include "../../PrecompiledHeadersServer.h"
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include "SetOfResources.h"
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
4045
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
27 #include "../../../../OrthancFramework/Sources/OrthancException.h"
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 namespace Orthanc
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
32 namespace Compatibility
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
34 void SetOfResources::Intersect(const std::list<int64_t>& resources)
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
36 if (resources_.get() == NULL)
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
38 resources_.reset(new Resources);
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
40 for (std::list<int64_t>::const_iterator
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
41 it = resources.begin(); it != resources.end(); ++it)
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
43 resources_->insert(*it);
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 }
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 }
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
46 else
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
47 {
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
48 std::unique_ptr<Resources> filtered(new Resources);
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
50 for (std::list<int64_t>::const_iterator
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
51 it = resources.begin(); it != resources.end(); ++it)
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
52 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
53 if (resources_->find(*it) != resources_->end())
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
54 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
55 filtered->insert(*it);
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
56 }
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
57 }
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
58
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
59 #if __cplusplus < 201103L
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
60 resources_.reset(filtered.release());
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
61 #else
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
62 resources_ = std::move(filtered);
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
63 #endif
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
64 }
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 }
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
67
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
68 void SetOfResources::GoDown()
1753
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1751
diff changeset
69 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
70 if (level_ == ResourceType_Instance)
1753
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1751
diff changeset
71 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
72 throw OrthancException(ErrorCode_BadSequenceOfCalls);
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 }
1753
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1751
diff changeset
74
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
75 if (resources_.get() != NULL)
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
76 {
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
77 std::unique_ptr<Resources> children(new Resources);
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
79 for (Resources::const_iterator it = resources_->begin();
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
80 it != resources_->end(); ++it)
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
81 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
82 std::list<int64_t> tmp;
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
83 transaction_.GetChildrenInternalId(tmp, *it);
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
84
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
85 for (std::list<int64_t>::const_iterator
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
86 child = tmp.begin(); child != tmp.end(); ++child)
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
87 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
88 children->insert(*child);
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
89 }
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
90 }
1747
ca69082ab200 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1746
diff changeset
91
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
92 #if __cplusplus < 201103L
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
93 resources_.reset(children.release());
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
94 #else
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
95 resources_ = std::move(children);
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
96 #endif
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
97 }
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
98
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
99 switch (level_)
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
100 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
101 case ResourceType_Patient:
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
102 level_ = ResourceType_Study;
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
103 break;
1747
ca69082ab200 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1746
diff changeset
104
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
105 case ResourceType_Study:
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
106 level_ = ResourceType_Series;
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
107 break;
1747
ca69082ab200 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1746
diff changeset
108
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
109 case ResourceType_Series:
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
110 level_ = ResourceType_Instance;
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
111 break;
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
112
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
113 default:
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
114 throw OrthancException(ErrorCode_InternalError);
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
115 }
1747
ca69082ab200 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1746
diff changeset
116 }
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
119 void SetOfResources::Flatten(std::list<std::string>& result)
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
121 result.clear();
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
122
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
123 if (resources_.get() == NULL)
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
125 // All the resources of this level are part of the filter
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
126 transaction_.GetAllPublicIds(result, level_);
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
127 }
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
128 else
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
129 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
130 for (Resources::const_iterator it = resources_->begin();
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
131 it != resources_->end(); ++it)
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
132 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
133 result.push_back(transaction_.GetPublicId(*it));
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
134 }
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 }
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 }
1750
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
137
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
138
3085
c829758b9ca0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
139 void SetOfResources::Flatten(ILookupResources& compatibility,
3084
195ba4cbac3f reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3061
diff changeset
140 std::list<int64_t>& result)
1750
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
141 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
142 result.clear();
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
143
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
144 if (resources_.get() == NULL)
1750
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
145 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
146 // All the resources of this level are part of the filter
3084
195ba4cbac3f reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3061
diff changeset
147 compatibility.GetAllInternalIds(result, level_);
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
148 }
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
149 else
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
150 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
151 for (Resources::const_iterator it = resources_->begin();
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
152 it != resources_->end(); ++it)
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
153 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
154 result.push_back(*it);
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
155 }
1750
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
156 }
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
157 }
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
158 }
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 }