annotate OrthancServer/Database/Compatibility/SetOfResources.cpp @ 3835:cbe847575c62

merge
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 15 Apr 2020 16:59:47 +0200
parents 2a170a8f1faf
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
3640
94f4a18a79cc upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3093
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * In addition, as a special exception, the copyright holders of this
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * program give permission to link the code of its release with the
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * that use the same license as the "OpenSSL" library), and distribute
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * the linked executables. You must obey the GNU General Public License
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * in all respects for all of the code used other than "OpenSSL". If you
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * modify file(s) with this exception, you may extend this exception to
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * your version of the file(s), but you are not obligated to do so. If
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * you do not wish to do so, delete this exception statement from your
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * version. If you delete this exception statement from all source files
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * in the program, then also delete it here.
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 *
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * This program is distributed in the hope that it will be useful, but
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * General Public License for more details.
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 *
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 **/
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
3052
c7db469bbe8e new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3050
diff changeset
34 #include "../../PrecompiledHeadersServer.h"
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #include "SetOfResources.h"
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
3052
c7db469bbe8e new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3050
diff changeset
37 #include "../../../Core/OrthancException.h"
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 namespace Orthanc
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
42 namespace Compatibility
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
44 void SetOfResources::Intersect(const std::list<int64_t>& resources)
1746
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 if (resources_.get() == NULL)
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
48 resources_.reset(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)
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
53 resources_->insert(*it);
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 }
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 }
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
56 else
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
57 {
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
58 std::unique_ptr<Resources> filtered(new Resources);
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
60 for (std::list<int64_t>::const_iterator
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
61 it = resources.begin(); it != resources.end(); ++it)
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
62 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
63 if (resources_->find(*it) != resources_->end())
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
64 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
65 filtered->insert(*it);
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
66 }
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
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
69 #if __cplusplus < 201103L
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
70 resources_.reset(filtered.release());
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
71 #else
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
72 resources_ = std::move(filtered);
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
73 #endif
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
74 }
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 }
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
77
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
78 void SetOfResources::GoDown()
1753
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1751
diff changeset
79 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
80 if (level_ == ResourceType_Instance)
1753
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1751
diff changeset
81 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
82 throw OrthancException(ErrorCode_BadSequenceOfCalls);
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 }
1753
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1751
diff changeset
84
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
85 if (resources_.get() != NULL)
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
86 {
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
87 std::unique_ptr<Resources> children(new Resources);
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
89 for (Resources::const_iterator it = resources_->begin();
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
90 it != resources_->end(); ++it)
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
91 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
92 std::list<int64_t> tmp;
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
93 database_.GetChildrenInternalId(tmp, *it);
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
94
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
95 for (std::list<int64_t>::const_iterator
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
96 child = tmp.begin(); child != tmp.end(); ++child)
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 children->insert(*child);
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
99 }
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
100 }
1747
ca69082ab200 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1746
diff changeset
101
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
102 #if __cplusplus < 201103L
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
103 resources_.reset(children.release());
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
104 #else
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
105 resources_ = std::move(children);
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
106 #endif
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
107 }
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
108
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
109 switch (level_)
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
110 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
111 case ResourceType_Patient:
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
112 level_ = ResourceType_Study;
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
113 break;
1747
ca69082ab200 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1746
diff changeset
114
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
115 case ResourceType_Study:
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
116 level_ = ResourceType_Series;
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
117 break;
1747
ca69082ab200 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1746
diff changeset
118
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
119 case ResourceType_Series:
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
120 level_ = ResourceType_Instance;
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
121 break;
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 default:
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
124 throw OrthancException(ErrorCode_InternalError);
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
125 }
1747
ca69082ab200 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1746
diff changeset
126 }
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
129 void SetOfResources::Flatten(std::list<std::string>& result)
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
131 result.clear();
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
132
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
133 if (resources_.get() == NULL)
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
135 // All the resources of this level are part of the filter
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
136 database_.GetAllPublicIds(result, level_);
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
137 }
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
138 else
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
139 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
140 for (Resources::const_iterator it = resources_->begin();
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
141 it != resources_->end(); ++it)
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
142 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
143 result.push_back(database_.GetPublicId(*it));
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
144 }
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 }
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 }
1750
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
147
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
148
3085
c829758b9ca0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
149 void SetOfResources::Flatten(ILookupResources& compatibility,
3084
195ba4cbac3f reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3061
diff changeset
150 std::list<int64_t>& result)
1750
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
151 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
152 result.clear();
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 if (resources_.get() == NULL)
1750
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
155 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
156 // All the resources of this level are part of the filter
3084
195ba4cbac3f reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3061
diff changeset
157 compatibility.GetAllInternalIds(result, level_);
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
158 }
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
159 else
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
160 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
161 for (Resources::const_iterator it = resources_->begin();
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
162 it != resources_->end(); ++it)
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
163 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
164 result.push_back(*it);
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
165 }
1750
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
166 }
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
167 }
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
168 }
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 }